0, 'template_type' => 'fenxiao', 'poster_name' => '', 'background' => '', //二维码 'qrcode_type' => '', 'qrcode_width' => 80, 'qrcode_height' => 80, 'qrcode_top' => 540, 'qrcode_left' => 260, //json数据 'template_json' => [ //头像 'headimg_is_show' => 1, 'headimg_shape' => 'circle', 'headimg_width' => 56, 'headimg_height' => 56, 'headimg_top' => 426, 'headimg_left' => 41, //昵称 'nickname_is_show' => 1, 'nickname_font_size' => 22, 'nickname_color' => '#faa87a', 'nickname_width' => 150, 'nickname_height' => 30, 'nickname_top' => 515, 'nickname_left' => 20, //分享语 'share_content' => '邀您一起分享赚佣金', 'share_content_is_show' => 1, 'share_content_font_size' => 14, 'share_content_color' => '#8D8D8D', 'share_content_width' => 130, 'share_content_height' => 30, 'share_content_top' => 550, 'share_content_left' => 20, ] ]; /** * 添加海报模板 * @param array $condition * @param int $page * @param int $page_size * @param string $field * @param string $order * @return array */ public function addPosterTemplate($data) { $res = model('poster_template')->add($data); if ($res === false) { return $this->error('', 'RESULT_ERROR'); } return $this->success($res); } /** * 编辑海报模板 * @param $data * @param $condition * @return array */ public function editPosterTemplate($data, $condition) { $res = model('poster_template')->update($data, $condition); if ($res === false) { return $this->error('', 'SAVE_FAIL'); } return $this->success($res); } /** * 删除海报模板 * @param array $condition * @param int $page * @param int $page_size * @param string $field * @param string $order * @return array */ public function deletePosterTemplate($condition) { $res = model('poster_template')->delete($condition); if ($res === false) { return $this->error('', 'RESULT_ERROR'); } return $this->success($res); } /** * 获取海报模板信息 * @param array $condition * @param string $field * @return array */ public function getPosterTemplateInfo($condition = [], $field = '*') { $info = model('poster_template')->getInfo($condition, $field); return $this->success($info); } /** * 获取海报模板列表 * @param array $condition * @param string $field * @param string $order * @param null $limit * @return array */ public function getPosterTemplateList($condition = [], $field = '*', $order = 'create_time desc') { $list = model('poster_template')->getList($condition, $field, $order); return $this->success($list); } /** * 获取海报模板分页列表 * @param array $condition * @param int $page * @param int $page_size * @param string $field * @param string $order * @return array */ public function getPosterTemplatePageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $field = '*', $order = 'create_time desc') { $list = model('poster_template')->pageList($condition, $field, $order, $page, $page_size); return $this->success($list); } /** * 对之前的数据做兼容处理 * @param $template_json */ public function correctTemplateJsonData($template_json) { //兼容处理 if (!isset($template_json[ 'share_content_is_show' ])) $template_json[ 'share_content_is_show' ] = 1; if (!isset($template_json[ 'share_content_font_size' ])) $template_json[ 'share_content_font_size' ] = 14; if (!isset($template_json[ 'share_content_color' ])) $template_json[ 'share_content_color' ] = '#8D8D8D'; return $this->success($template_json); } /*************************** 模板默认数据 ********************************/ public function getMubanInfo($condition = [], $field = '*', $alias = 'a', $join = []) { $list = model('poster_muban')->getInfo($condition, $field, $alias, $join); return $this->success($list); } public function getMubanList($condition = [], $field = '*') { $list = model('poster_muban')->getList($condition, $field); return $this->success($list); } }