From 783be762300d8e64c226f9ec3993cd9e63624f72 Mon Sep 17 00:00:00 2001 From: lcc Date: Fri, 9 Aug 2024 16:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=93=E9=A2=98=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/Market_sytopic_enroll_model.php | 16 +- .../market/Market_sytopic_module_model.php | 2 + .../Market_sytopic_module_option_model.php | 18 +- .../controllers/h5/market/sytopic/Welcome.php | 22 ++- home/views/h5/market/sytopic/index.php | 187 ++++++++---------- market/controllers/api/sytopic/Topic.php | 3 + 6 files changed, 125 insertions(+), 123 deletions(-) diff --git a/common/models/market/Market_sytopic_enroll_model.php b/common/models/market/Market_sytopic_enroll_model.php index fb99a0d4..aa4bc521 100644 --- a/common/models/market/Market_sytopic_enroll_model.php +++ b/common/models/market/Market_sytopic_enroll_model.php @@ -19,25 +19,32 @@ class Market_sytopic_enroll_model extends HD_Model } //专题报名 - public function enroll($id, $topicUserId, $name, $mobile) + public function enroll($topicId, $moduleOptionId, $topicUserId, $name, $mobile) { $this->load->model('market/Market_sytopic_user_model', 'topic_user_model'); $this->load->model('market/market_sytopic_module_option_model'); $this->load->model('market/market_sylive_organization_model'); $this->load->model('market/market_sytopic_model', 'topic_model'); - $optionRow = $this->market_sytopic_module_option_model->get(['id' => $id]); $topicUser = $this->topic_user_model->get(['id' => $topicUserId]); - $row = $this->get(['status' => 0, 'moduleOptionId' => $id, 'userId' => $topicUser['userId']]); + $where = ['status' => 0, 'topicId' => $topicId, 'userId' => $topicUser['userId'], 'moduleOptionId' => 0]; + if ($moduleOptionId) { + $where['moduleOptionId'] = $moduleOptionId; + } + $row = $this->get($where); if ($row) { // $this->update(['name' => $name, 'mobile' => $mobile], ['id' => $row['id']]); return ['code' => 0, 'msg' => '您的信息已收到,无需重复操作']; } - $topic = $this->topic_model->get(['id' => $optionRow['topicId']]); + if ($moduleOptionId) { + $optionRow = $this->market_sytopic_module_option_model->get(['id' => $moduleOptionId]); + } + $topic = $this->topic_model->get(['id' => $topicId]); $org = $this->market_sylive_organization_model->get(['organizationId' => $topic['organizationId']]); $data = [ 'topicUserId' => $topicUserId, 'userId' => $topicUser['userId'], 'channelId' => $topicUser['channelId'], + 'topicId' => $topicId, 'name' => $name, 'mobile' => $mobile, 'enTime' => date('Y-m-d H:i:s'), @@ -45,7 +52,6 @@ class Market_sytopic_enroll_model extends HD_Model 'enrollDeal' => $org ? $org['enrollDeal'] : self::ENROLL_DEAL_NO, ]; $optionRow['id'] && $data['moduleOptionId'] = $optionRow['id']; - $optionRow['topicId'] && $data['topicId'] = $optionRow['topicId']; $optionRow['moduleId'] && $data['moduleId'] = $optionRow['moduleId']; $res = $this->add($data); if (!$res) { diff --git a/common/models/market/Market_sytopic_module_model.php b/common/models/market/Market_sytopic_module_model.php index a53b3833..7ed4d59d 100644 --- a/common/models/market/Market_sytopic_module_model.php +++ b/common/models/market/Market_sytopic_module_model.php @@ -12,6 +12,7 @@ class Market_sytopic_module_model extends HD_Model const TYPE_HORIZONTAL = 5; // 横排 const TYPE_ARTICLE = 6; // 文章 const TYPE_ENROLL_BANNER = 7; // 报名轮播图 + const TYPE_ENROLL_GIFT = 8; // 礼品模块 const TYPE_ARRAY = [ // self::TYPE_BANNER => '主图', @@ -21,6 +22,7 @@ class Market_sytopic_module_model extends HD_Model self::TYPE_SWIPER_BANNER => '轮播图', self::TYPE_ARTICLE => '富文本', self::TYPE_ENROLL_BANNER => '横排轮播图', + self::TYPE_ENROLL_GIFT => '礼品', ]; public function __construct() diff --git a/common/models/market/Market_sytopic_module_option_model.php b/common/models/market/Market_sytopic_module_option_model.php index bd2a1f7f..4ca9b851 100644 --- a/common/models/market/Market_sytopic_module_option_model.php +++ b/common/models/market/Market_sytopic_module_option_model.php @@ -37,10 +37,10 @@ class Market_sytopic_module_option_model extends HD_Model { $this->load->model('market/market_sytopic_module_model'); $moduleModel = new Market_sytopic_module_model(); - $modelList = $moduleModel->select(['type'=>$moduleModel::TYPE_ENROLL_BANNER],'','','','id'); + $modelList = $moduleModel->select(['type' => $moduleModel::TYPE_ENROLL_BANNER], '', '', '', 'id'); $lists = []; if ($modelList) { - $modelIdsStr = implode(',', array_column($modelList,'id')); + $modelIdsStr = implode(',', array_column($modelList, 'id')); $where = ['topicId' => $topicId, 'status' => 0, "moduleId in ({$modelIdsStr})" => null]; $modelOptionsList = $this->select($where, "FIELD (moduleId,{$modelIdsStr})", 1, 100); foreach ($modelOptionsList as $item) { @@ -110,6 +110,20 @@ class Market_sytopic_module_option_model extends HD_Model $data['introduction'] = $item['introduction']; $data['createTime'] = $item['createTime']; break; + case Market_sytopic_module_model::TYPE_ENROLL_GIFT://礼品模块 + $enroll = true; //是否可报名 + if ($item['enrollEndTime'] != '0000-00-00 00:00:00') { + $enrollEndTime = $item['enrollEndTime']; + if (strtotime($item['enrollEndTime']) - time() <= 0) { + $data['btnText'] = '已结束'; + $enroll = false; + } + } else { + $enrollEndTime = ''; + } + $data['enrollEndTime'] = $enrollEndTime; + $data['enroll'] = $enroll; + break; default: $data['introduction'] = strip_tags($item['introduction']); } diff --git a/home/controllers/h5/market/sytopic/Welcome.php b/home/controllers/h5/market/sytopic/Welcome.php index 65eef223..170c25c7 100644 --- a/home/controllers/h5/market/sytopic/Welcome.php +++ b/home/controllers/h5/market/sytopic/Welcome.php @@ -13,7 +13,7 @@ class Welcome extends Wx parent::__construct(); $this->load->model('market/Market_sytopic_module_option_model', 'module_option_model'); $this->load->model('market/Market_sytopic_enroll_model', 'sytopic_enroll_model'); - $this->load->model('market/market_sylive_organization_model','organization_model'); + $this->load->model('market/market_sylive_organization_model', 'organization_model'); $this->load->library('qiniu'); $this->load->library("ssApi"); $this->skey = $this->input->get_post('skey'); @@ -36,6 +36,7 @@ class Welcome extends Wx $actUser['channelId'] && $channelRow = $this->user_model->get(['userId' => $actUser['channelId']]); $jsonData = json_decode($row['jsondata'], true); $info = [ + 'id' =>$row['id'], 'title' => $row['title'], 'isAdmin' => $this->user_model->checkTopicIsAdmin($this->uid, $this->a_id), 'channelName' => $channelRow ? $channelRow['uname'] : '', @@ -43,18 +44,19 @@ class Welcome extends Wx 'channelTel' => $channelRow ? $channelRow['mobile'] : '', 'banner' => $jsonData['banner'] ? build_qiniu_image_url($jsonData['banner']) : '', 'bgColor' => $jsonData['bg_color'] ?: '', + 'buttonType' => $jsonData['button_type'] ? (int)$jsonData['button_type'] : '', ]; $moduleLists = $this->module_option_model->getTopicModelOptionsList($this->a_id); $this->data['modules'] = array_values($moduleLists); $this->data['logoList'] = $this->module_option_model->getTypeEnrollBannerList($this->a_id); //获取门店信息 - $orgRow = $this->organization_model->get(['organizationId'=>$row['organizationId']]); + $orgRow = $this->organization_model->get(['organizationId' => $row['organizationId']]); $ssBizId = (int)$orgRow['comments']; $biz = []; - if($ssBizId){ + if ($ssBizId) { $ssApi = new SsApi(); $req = $ssApi->getBiz($ssBizId); - if($req['code']){ + if ($req['code']) { $biz = $req['data']; } } @@ -72,6 +74,10 @@ class Welcome extends Wx { $redis = &load_cache(); $optionId = intval($this->input->post('optionId')); + $topicId = intval($this->input->post('topicId')); + if(!$topicId){ + $this->show_json('', 400, '参数错误'); + } $info = $this->input->post('info'); $name = $info['name']; $mobile = $info['phone']; @@ -80,10 +86,10 @@ class Welcome extends Wx $this->show_json('', 400, '请输入姓名'); } $key = self::ENROLL_SIGN_KEY . $mobile; - if (!$code || $code != $redis->get($key)) { - $this->show_json('', 400, '请输入正确的验证码'); - } - $result = $this->sytopic_enroll_model->enroll($optionId, $this->act_uid, $name, $mobile); +// if (!$code || $code != $redis->get($key)) { +// $this->show_json('', 400, '请输入正确的验证码'); +// } + $result = $this->sytopic_enroll_model->enroll($topicId,$optionId, $this->act_uid, $name, $mobile); if (!$result['code']) { $this->show_json('', 400, $result['msg']); } diff --git a/home/views/h5/market/sytopic/index.php b/home/views/h5/market/sytopic/index.php index 6529b5f6..8b4f8ddb 100644 --- a/home/views/h5/market/sytopic/index.php +++ b/home/views/h5/market/sytopic/index.php @@ -1,4 +1,4 @@ - +
@@ -124,32 +124,6 @@
- -
-
-
到店有礼
-
-
-
- -
-
-
-

清凉夏日防晒套装清凉夏日防晒套装

-

品牌遮阳伞+移动风扇移动风扇+防晒喷雾

-
- 截止时间 - 2024年11月11日11:00:00 -
-
-
-
市场价1.8万
-
立即领取
-
-
-
-
- - + + + +
@@ -345,27 +352,16 @@

{{info.title}}

-
+
-
-

立即咨询

-
-
+

{{popCarInfo.title}}

指导价{{popCarInfo.subTitle}}

- -
-
-

- 专属顾问:{{info.channelName}} -

-
-
@@ -383,7 +379,7 @@
@@ -395,9 +391,8 @@ :style="{ 'min-height': '30%', 'background-color': 'transparent' }">
-

立即咨询

-

{{info.title}}

-
+

{{info.title}}

+
@@ -407,14 +402,6 @@

- -
-
-

- 专属顾问:{{info.channelName}} -

-
-
@@ -432,7 +419,7 @@
@@ -453,11 +440,12 @@
成交经纪人 -

厦门汽车空间站

+

{{info.biz.biz_name}}

-

百城车展焕新季

+

{{info.title}}

+
@@ -481,12 +469,14 @@
- +
@@ -500,7 +490,7 @@ el: '#app', data() { return { - info: , + info: , bg: '/img/h5/sytopic/bg.jpg', modules: , car_swiper_index: 0, @@ -512,8 +502,6 @@ phone: '', code: '' }, - showPopCarInfo: false, - showPopChannel: false, popCarInfo: { banner: '', title: '', @@ -523,7 +511,6 @@ optionId: 0, counttime: 60000, show_retry: false, - showType: 1, // 1 活动标题 2立即咨询 logo_list: , location_info: { // 地理位置信息 20240807 lat: 23.099994, @@ -537,37 +524,20 @@ this.initSwpier(); // 20240807 }, methods: { - showGwEnroll(){ - this.showPopChannel = true - this.showPopCarInfo = false - this.show_signup_bottom = true - this.showType = 1 + showGwEnroll() { + this.show_signup_agent_bottom = true }, - showEnroll(type, row, showPopChannel, showType) { - this.showPopChannel = false - this.showPopCarInfo = false + showEnroll(type, row) { let popUpType = row.popUpType ? parseInt(row.popUpType) : 0 - if (parseInt(type) === 6) { - if (showPopChannel) { - this.showPopChannel = true - } - } else { - this.showPopCarInfo = true - this.popCarInfo.title = row.title - this.popCarInfo.subTitle = row.subTitle - this.popCarInfo.banner = row.banner - } + this.popCarInfo.title = row.title + this.popCarInfo.subTitle = row.subTitle + this.popCarInfo.banner = row.banner this.optionId = row.id if (popUpType === 1) { this.show_signup_bottom = true } else { this.show_signup_center = true } - if (showType) { - this.showType = 2 - } else { - this.showType = 1 - } }, getCode() { //获取验证码 if (this.isSubmiting) { @@ -610,6 +580,7 @@ var that = this; $.post('/h5/market/sytopic/welcome/enroll', { 'optionId': this.optionId, + 'topicId': this.info.id, 'skey': '', 'info': this.form }, function (res) { diff --git a/market/controllers/api/sytopic/Topic.php b/market/controllers/api/sytopic/Topic.php index 5492eb6d..e962191d 100644 --- a/market/controllers/api/sytopic/Topic.php +++ b/market/controllers/api/sytopic/Topic.php @@ -47,6 +47,7 @@ class Topic extends BaseController $shareImg = $sharePhoto = $banner = []; $jsonData = json_decode($v['jsondata'], true); $jsonData['bg_color'] = $jsonData['bg_color'] ?: ''; + $jsonData['button_type'] = $jsonData['button_type'] ?: ''; if ($v['banner']) { $banner = [['uid' => 1, 'fileUrl' => $v['banner'], 'url' => build_qiniu_image_url($v['banner']), 'status' => 'done']]; } @@ -131,6 +132,7 @@ class Topic extends BaseController $setJsonData['banner'] = ''; } $setJsonData['bg_color'] = $jsonData['bg_color'] ?: ''; + $setJsonData['button_type'] = $jsonData['button_type'] ?: ''; $createTime = date('Y-m-d H:i:s'); $addData = ['title' => $title, 'banner' => $banner, 'status' => 1, 'createTime' => $createTime, 'organizationId' => $organizationId, 'sharePhoto' => $sharePhoto, 'shareTitle' => $shareTitle, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'jsondata' => json_encode($setJsonData, JSON_UNESCAPED_UNICODE)]; @@ -184,6 +186,7 @@ class Topic extends BaseController $setJsonData['banner'] = ''; } $setJsonData['bg_color'] = $jsonData['bg_color'] ?: ''; + $setJsonData['button_type'] = $jsonData['button_type'] ?: ''; $addData = ['title' => $title, 'banner' => $banner, 'organizationId' => $organizationId, 'sharePhoto' => $sharePhoto, 'shareTitle' => $shareTitle, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'jsondata' => json_encode($setJsonData, JSON_UNESCAPED_UNICODE)]; $setShareImg && $addData['shareImg'] = $setShareImg;