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 @@ - +
品牌遮阳伞+移动风扇移动风扇+防晒喷雾
-{{val.introduction}}
+指导价{{popCarInfo.subTitle}}
- 专属顾问:{{info.channelName}} -
-- 专属顾问:{{info.channelName}} -
-厦门汽车空间站
+{{info.biz.biz_name}}
发送验证码
+发送验证码
+