From 369c715c4a2bb4bcf03bd00ecdadd46da861a247 Mon Sep 17 00:00:00 2001 From: dengbw Date: Fri, 3 Dec 2021 17:48:19 +0800 Subject: [PATCH] admin_material_1203 --- admin/controllers/app/material/Template.php | 7 +++++++ admin/views/app/material/template/edit.php | 8 ++++++++ api/controllers/wxapp/material/Topic.php | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/admin/controllers/app/material/Template.php b/admin/controllers/app/material/Template.php index c8a0544a..f5702d8c 100644 --- a/admin/controllers/app/material/Template.php +++ b/admin/controllers/app/material/Template.php @@ -164,6 +164,7 @@ class Template extends HD_Controller $info['cover'] = array('value' => '', 'src' => ''); $info['moments'] = ''; $info['tag_id'] = ''; + $info['biz_pop'] = 0; $json_lists = $json_item = $brands = $pyqwa_list = array(); foreach ($this->mdTemplate->typeAry() as $key => $value) { $json_lists[$key] = array(); @@ -175,8 +176,10 @@ class Template extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '模板不存在!'); } $moments = $tag_id = ''; + $biz_pop = 0; if ($re['json_data']) { $json_data = json_decode($re['json_data'], true); + $json_data['biz_pop'] && $biz_pop = $json_data['biz_pop']; $json_data['moments'] && $moments = $json_data['moments']; $json_data['tag_id'] && $tag_id = $json_data['tag_id']; $lists = array(); @@ -214,6 +217,7 @@ class Template extends HD_Controller unset($re['json_data']); } $info = $re; + $info['biz_pop'] = $biz_pop; $info['moments'] = $moments; $info['tag_id'] = $tag_id; $info['cover'] = $info['cover'] ? array('value' => $info['cover'], 'src' => build_qiniu_image_url($info['cover'])) @@ -231,6 +235,7 @@ class Template extends HD_Controller $showInfo['statusAry'] = $this->mdTemplate->statusAry(); $showInfo['typeAry'] = $this->mdTemplate->typeAry(); $showInfo['tagAry'] = $this->mdTemplate->tagAry(); + $showInfo['bizPopAry'] = [0 => '否', 1 => '是']; $showInfo['brands'] = $brands; $showInfo['pyqwa_list'] = $pyqwa_list; $showInfo['json_lists'] = $json_lists; @@ -275,6 +280,7 @@ class Template extends HD_Controller $brand_ids .= ',0'; } } + $json_data['biz_pop'] = $info['biz_pop']; $json_data['moments'] = $info['moments']; $json_data['tag_id'] = $info['tag_id']; if ($info['lists']) { @@ -336,6 +342,7 @@ class Template extends HD_Controller $brand_ids .= ',0'; } } + $json_data['biz_pop'] = $info['biz_pop']; $json_data['moments'] = $info['moments']; $json_data['tag_id'] = $info['tag_id']; if ($info['lists']) { diff --git a/admin/views/app/material/template/edit.php b/admin/views/app/material/template/edit.php index 33cdfd84..d448a14a 100644 --- a/admin/views/app/material/template/edit.php +++ b/admin/views/app/material/template/edit.php @@ -58,6 +58,14 @@ +
+ +
+ +
+
diff --git a/api/controllers/wxapp/material/Topic.php b/api/controllers/wxapp/material/Topic.php index 7fc3f68f..9439594c 100644 --- a/api/controllers/wxapp/material/Topic.php +++ b/api/controllers/wxapp/material/Topic.php @@ -42,6 +42,7 @@ class Topic extends Wxapp if (!$re || empty($re)) { throw new Hd_exception('专题不存在', API_CODE_FAIL); } + $biz_info = ['pop' => 0]; if ($biz_id) { $re_biz = $this->mdMaterialBiz->get(array('app_id' => $this->app_id, 't_id' => $id, 'biz_id' => $biz_id)); if (!$re_biz || empty($re_biz)) { @@ -61,10 +62,25 @@ class Topic extends Wxapp $this->mdBizStatistics->add($where_s); $this->app_redis->save($key, 1, 24 * 3600);//有效期1天 } + } $lists = array(); if ($re['json_data']) { $json_data = json_decode($re['json_data'], true); + if ($json_data['biz_pop']) {//授权弹窗 + $biz_info['pop'] = $json_data['biz_pop']; + $biz_info['biz_name'] = ''; + $biz_info['headimg'] = 'https://qs.haodian.cn/wechat_app/liche/common/dark-logo2.jpg'; + $biz_info['pop_content'] = '您好,欢迎您访问狸车。授权手机号后将给您提供最新的新能源汽车资讯和优惠活动哦~'; + if ($biz_id) { + $this->load->model("biz/biz_model", 'mdBiz'); + $re_biz = $this->mdBiz->get(array('id' => $biz_id, 'status' => 1)); + if ($re_biz) { + $biz_info['biz_name'] = $re_biz['biz_name']; + $re_biz['headimg'] && $biz_info['headimg'] = build_qiniu_image_url($re_biz['headimg']); + } + } + } foreach ($json_data['lists'] as $key => $value) { $setValue = array(); $setValue['title'] = $value['title']; @@ -90,6 +106,7 @@ class Topic extends Wxapp $this->data['type'] = $re['type']; $this->data['sign_up'] = 1; $this->data['lists'] = $lists; + $this->data['biz_info'] = $biz_info; return $this->data; }