-
diff --git a/api/controllers/wxapp/liche/Topics.php b/api/controllers/wxapp/liche/Topics.php
new file mode 100644
index 00000000..99220116
--- /dev/null
+++ b/api/controllers/wxapp/liche/Topics.php
@@ -0,0 +1,196 @@
+login_white = [];//登录白名单
+ $this->check_status = [];//用户状态校验
+ $this->check_mobile = [];//需要手机号
+ $this->check_headimg = [];//授权微信信息
+ $this->load->model('topics/topics_model', 'mdTopics');
+ $this->load->model('topics/topic_modules_model', 'mdTopicModules');
+ $this->load->model('topics/topic_module_text_model', 'mdModuleText');
+ $this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
+ $this->load->model('topics/topic_module_button_model', 'mdModuleButton');
+ $this->load->model('receiver/receiver_clues_model', 'mdReceiverClues');
+ }
+
+ /**
+ * Notes:专题请情页
+ * Created on: 2023/3/09 11:26
+ * Created by: dengbw
+ * @return array
+ * @throws Hd_exception
+ */
+ protected function get()
+ {
+ $params = $this->input_param();
+ $id = intval($params['id']);//活动id
+ $re = $this->mdTopics->get(['id' => $id, 'app_id' => $this->app_id]);
+ if (!$re) {
+ throw new Hd_exception('专题不存在', API_CODE_FAIL);
+ }
+ $list = $mButton = [];
+ if ($re['module_ids']) {
+ $where = is_numeric($re['module_ids']) ? ['id' => $re['module_ids']] : ["id in ({$re['module_ids']})" => null];
+ $where['status'] = 1;
+ $res = $this->mdTopicModules->select($where, 'sort desc', 0, 0, 'id,type,jsondata');
+ foreach ($res as $row_topic) {
+ $mid = $row_topic['id'];
+ $type = $row_topic['type'];
+ $json_topic = json_decode($row_topic['jsondata'], true);
+ $title_img = "";
+ $title_icon = "";
+ if ($json_topic['title_img']) {
+ $title_img = build_qiniu_image_url($json_topic['title_img']);
+ } else {
+ $title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
+ }
+ switch ($type) {
+ case "ad"://广告
+ $module = $this->mdModuleAd->get(array('module_id' => $mid));
+ $module_json = $module['img_json'] ? json_decode($module['img_json'], true) : array();
+ $ads = [];
+ foreach ($module_json as $ad) {
+ $url = strval($ad['link']);
+ $img = $ad['img'] ? build_qiniu_image_url($ad['img']) : '';
+ $ads[] = [
+ 'type' => $type,
+ 'img' => $img,
+ 'url' => $url ? $url : '',
+ 'jump_type' => intval($ad['jump_type']),
+ 'title' => $ad['title']
+ ];
+ }
+ $title_img = "";
+ $title_icon = "";
+ if ($json_topic['title_img']) {
+ $title_img = build_qiniu_image_url($json_topic['title_img']);
+ } else {
+ $title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
+ }
+ $list[] = [
+ "type" => $type,
+ 'id' => $mid,
+ 'title' => $module['title'] ? $module['title'] : '',
+ "title_img" => $title_img,
+ "title_icon" => $title_icon,
+ "title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
+ "title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#fe7c35",//背景色
+ 'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
+ 'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : (2 == $module['style'] ? '#FFF' : ''),
+ "border_color" => strval($json_topic['border_color']),
+ 'descrip' => $module['descrip'] ? $module['descrip'] : '',
+ 'content' => '',
+ 'style' => $module['style'],
+ 'ads' => $ads,
+ ];
+ break;
+ case "text"://文本类型
+ $module = $this->mdModuleText->get(array('module_id' => $mid));
+ $list[] = array(
+ "type" => $type,
+ 'id' => $mid,
+ 'title' => $module['title'] ? $module['title'] : '',
+ "title_img" => $title_img,
+ "title_icon" => $title_icon,
+ "title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
+ "title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#ee5b15",//背景色
+ 'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
+ 'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : '#ff0',
+ "border_color" => strval($json_topic['border_color']),
+ 'descrip' => $module['descrip'] ? $module['descrip'] : '',
+ 'content' => $module['content'] ? $module['content'] : '',
+ 'style' => 0,
+ 'ads' => [],
+ );
+ break;
+ case "button"://按钮类型
+ $module = $this->mdModuleButton->get(['module_id' => $mid]);
+ $jsondata = $module['jsondata'] ? json_decode($module['jsondata'], true) : array();
+ $mButton = [
+ 'url' => $jsondata['url'] ? $jsondata['url'] : '',
+ 'type' => $module['type'],
+ 'title' => $jsondata['title'] ? $jsondata['title'] : '',
+ 'img' => $jsondata['img'] ? build_qiniu_image_url($jsondata['img']) : '',
+ 'color' => $jsondata['color'] ? $jsondata['color'] : '',
+ 'descrip' => $module['descrip'] ? $module['descrip'] : '',
+ ];
+ break;
+ default:
+ }
+ }
+ }
+ $data = [
+ 'id' => $re['id'],
+ 'title' => $re['title'],
+ 'bg_img' => build_qiniu_image_url($re['bg_img']),
+ 'bg_color' => $re['bg_color'],
+ 'list' => $list,
+ 'mButton' => $mButton
+ ];
+ return $data;
+ }
+
+ /**
+ * Notes:提交报名资料
+ * Created on: 2023/3/10 14:24
+ * Created by: dengbw
+ * @throws Hd_exception
+ */
+ protected function post()
+ {
+ $id = $this->input_param('id');
+ $mobile = $this->session['mobile'];
+ $nickname = $this->session['nickname'];
+ if (!$id || !$mobile) {
+ throw new Hd_exception('参数错误', API_CODE_INVILD_PARAM);
+ }
+ $this->load->library('receiver/clues_entity');
+ $cf_title = $this->clues_entity->cf_title($this->cf_id);
+ $log_msg = '用户报名';
+ $cf_title && $log_msg = "用户通过【{$cf_title}】报名";
+ $uname = $nickname ? $nickname : '用户';
+ $row = $this->mdReceiverClues->get(['mobile' => $mobile]);
+ if ($row) {
+ $update = ['en_time' => date('Y-m-d H:i:s')];
+ $this->mdReceiverClues->update($update, ['id' => $row['id']]);
+ //增加日志
+ $this->clues_entity->add_log($row['id'], $this->session['uid'], $uname, $log_msg);
+ throw new Hd_exception('预约报名成功了!', API_CODE_SUCCESS);
+ }
+ $add_data = [
+ 'name' => $nickname ? $nickname : '',
+ 'mobile' => $mobile,
+ 'cf_uid' => $this->session['uid'],
+ 'cf_id' => $this->cf_id,
+ 'app_id' => $this->app_id,
+ 'out_id' => $id,
+ 'if_driver' => 1,
+ 'cf_platform' => 'wxapp',
+ 'en_time' => date('Y-m-d H:i:s'),
+ 'c_time' => time()
+ ];
+ $id = $this->mdReceiverClues->add($add_data);
+ if ($id) {//增加日志
+ $this->clues_entity->add_log($id, $this->session['uid'], $uname, $log_msg);
+ }
+ throw new Hd_exception('预约报名成功!', API_CODE_SUCCESS);
+ }
+
+}
\ No newline at end of file