diff --git a/common/libraries/SsApi.php b/common/libraries/SsApi.php index 9fa531cd..f9eb43b6 100644 --- a/common/libraries/SsApi.php +++ b/common/libraries/SsApi.php @@ -29,11 +29,12 @@ class SsApi * @param $name * @param $mobile * @param $en_time + * @param $remark * @param $to_customers 是否添加到客户池 * @param $biz_id * @return array */ - public function postClues($id, $name, $mobile, $en_time, $to_customers = 0, $biz_id = 0) + public function postClues($id, $name, $mobile, $en_time, $remark, $to_customers = 0, $biz_id = 0) { $data = [ 'name' => $name, @@ -43,6 +44,7 @@ class SsApi 'cf_platform' => self::CF_PLATFORM, 'biz_id' => $biz_id, 'to_customers' => $to_customers, + 'remark' => $remark, 'nonce_str' => random_string('alpha'), 'app_id' => $this->app_id, ]; @@ -134,7 +136,7 @@ class SsApi $options = [ \GuzzleHttp\RequestOptions::HEADERS => ['Content-Type' => 'application/json'], ]; - $url = $this->api_url . self::BIZ_METHOD.'?'.http_build_query($data); + $url = $this->api_url . self::BIZ_METHOD . '?' . http_build_query($data); try { debug_log("[info]#请求地址:" . $url, $this->log_path); $response = $client->get($url, $options); diff --git a/common/libraries/market/Sytopic_enroll_entity.php b/common/libraries/market/Sytopic_enroll_entity.php index 26a9f8bc..58dbfa80 100644 --- a/common/libraries/market/Sytopic_enroll_entity.php +++ b/common/libraries/market/Sytopic_enroll_entity.php @@ -13,6 +13,8 @@ class Sytopic_enroll_entity $this->ci->load->model('market/market_sylive_organization_model'); $this->ci->load->model('market/market_sytopic_enroll_model', 'sytopic_enroll_model'); $this->ci->load->model('market/Market_sytopic_model', 'topic_model'); + $this->ci->load->model('market/Market_sytopic_module_option_model', 'module_option_model'); + $this->ci->load->model('market/Market_sytopic_module_model', 'module_model'); $this->ci->load->library('ssApi'); } @@ -49,11 +51,20 @@ class Sytopic_enroll_entity } else { //同步到客户 debug_log("[info]# 同步到空间站.", $this->log_file); $to_customers = 0; - if($enrollDeal==$enrollModel::ENROLL_DEAL_PUSH_CUSTOMER){ + if ($enrollDeal == $enrollModel::ENROLL_DEAL_PUSH_CUSTOMER) { $to_customers = 1; } + $modelOptionRow = $this->ci->module_option_model->get(['id' => $enrollRow['moduleOptionId']]); + $modelRow = $this->ci->module_option_model->get(['id' => $enrollRow['moduleId']]); + if ($modelOptionRow || $modelRow) { + $remark = "用户通过 " . $modelRow['title']; + $modelOptionRow && $remark .= "-" . $modelOptionRow['title']; + $remark .= " 留资"; + } else { + $remark = '用户通过 ' . $topicRow['title'] . ' 留资'; + } $res = $ssApi->postClues($enrollId, $enrollRow['name'], - $enrollRow['mobile'], $enrollRow['enTime'], $to_customers, (int)$organizationRow['comments']); + $enrollRow['mobile'], $enrollRow['enTime'], $remark, $to_customers, (int)$organizationRow['comments']); debug_log("[info]# 接口请求结果:" . json_encode($res, JSON_UNESCAPED_UNICODE), $this->log_file); return $res; } diff --git a/common/models/market/Market_sytopic_module_model.php b/common/models/market/Market_sytopic_module_model.php index 7ed4d59d..6ca7c54b 100644 --- a/common/models/market/Market_sytopic_module_model.php +++ b/common/models/market/Market_sytopic_module_model.php @@ -14,6 +14,8 @@ class Market_sytopic_module_model extends HD_Model const TYPE_ENROLL_BANNER = 7; // 报名轮播图 const TYPE_ENROLL_GIFT = 8; // 礼品模块 + const TYPE_ENROLL = 9; // 报名模块 + const TYPE_ARRAY = [ // self::TYPE_BANNER => '主图', self::TYPE_DISCOUNT => '轮播报名', @@ -23,6 +25,7 @@ class Market_sytopic_module_model extends HD_Model self::TYPE_ARTICLE => '富文本', self::TYPE_ENROLL_BANNER => '横排轮播图', self::TYPE_ENROLL_GIFT => '礼品', + self::TYPE_ENROLL => '直接报名', ]; 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 4ca9b851..f889446e 100644 --- a/common/models/market/Market_sytopic_module_option_model.php +++ b/common/models/market/Market_sytopic_module_option_model.php @@ -45,7 +45,11 @@ class Market_sytopic_module_option_model extends HD_Model $modelOptionsList = $this->select($where, "FIELD (moduleId,{$modelIdsStr})", 1, 100); foreach ($modelOptionsList as $item) { $lists[] = [ - 'banner' => $item['banner'] ? build_qiniu_image_url($item['banner']) : '' + 'id' => $item['id'], + 'title' => '', + 'popUpType' => $item['popUpType'], + 'banner' => $item['banner'] ? build_qiniu_image_url($item['banner']) : '', + 'type' => $moduleModel::TYPE_ENROLL_BANNER, ]; } } diff --git a/home/controllers/h5/market/sytopic/Welcome.php b/home/controllers/h5/market/sytopic/Welcome.php index ac2c4d3f..b20c7d21 100644 --- a/home/controllers/h5/market/sytopic/Welcome.php +++ b/home/controllers/h5/market/sytopic/Welcome.php @@ -36,7 +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'], + 'id' => $row['id'], 'title' => $row['title'], 'isAdmin' => $this->user_model->checkTopicIsAdmin($this->uid, $this->a_id), 'channelName' => $channelRow ? $channelRow['uname'] : '', @@ -50,7 +50,7 @@ class Welcome extends Wx $this->data['modules'] = array_values($moduleLists); $this->data['logoList'] = $this->module_option_model->getTypeEnrollBannerList($this->a_id); //获取门店信息 - $orgRow = $this->organization_model->get(['organizationId' => $channelRow['bizId']]); + $orgRow = $this->organization_model->get(['organizationId' => $row['organizationId']]); $ssBizId = (int)$orgRow['comments']; $biz = []; if ($ssBizId) { @@ -75,7 +75,7 @@ class Welcome extends Wx $redis = &load_cache(); $optionId = intval($this->input->post('optionId')); $topicId = intval($this->input->post('topicId')); - if(!$topicId){ + if (!$topicId) { $this->show_json('', 400, '参数错误'); } $info = $this->input->post('info'); @@ -86,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($topicId,$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']); } @@ -174,4 +174,5 @@ class Welcome extends Wx $this->data['share'] = $wx_info['share']; $this->show_view('h5/market/sytopic/share'); } + } diff --git a/home/views/h5/market/sytopic/index.php b/home/views/h5/market/sytopic/index.php index 1057336e..1d72531a 100644 --- a/home/views/h5/market/sytopic/index.php +++ b/home/views/h5/market/sytopic/index.php @@ -103,7 +103,7 @@
{{info.channelName}}
+{{info.biz.biz_name}}
+发送验证码
+