66 lines
2.7 KiB
PHP
66 lines
2.7 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Market_sytopic_enroll_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_market_sytopic_enroll';
|
|
|
|
const ENROLL_DEAL_NO = 0; // 报名不处理
|
|
const ENROLL_DEAL_PUSH_CLUE = 1; // 提交狸车线索池
|
|
const ENROLL_DEAL_PUSH_CUSTOMER = 2; // 提交狸车客户池
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
//专题报名
|
|
public function enroll($id, $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']]);
|
|
if ($row) {
|
|
// $this->update(['name' => $name, 'mobile' => $mobile], ['id' => $row['id']]);
|
|
return ['code' => 0, 'msg' => '您的信息已收到,无需重复操作'];
|
|
}
|
|
$topic = $this->topic_model->get(['id' => $optionRow['topicId']]);
|
|
$org = $this->market_sylive_organization_model->get(['organizationId' => $topic['organizationId']]);
|
|
$data = [
|
|
'topicUserId' => $topicUserId,
|
|
'userId' => $topicUser['userId'],
|
|
'channelId' => $topicUser['channelId'],
|
|
'name' => $name,
|
|
'mobile' => $mobile,
|
|
'enTime' => date('Y-m-d H:i:s'),
|
|
'createTime' => date('Y-m-d H:i:s'),
|
|
'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) {
|
|
return ['code' => 0, 'msg' => '提交失败'];
|
|
}
|
|
if(is_numeric($res)){ //数据同步到空间站
|
|
$this->load->library('market/sytopic_enroll_entity');
|
|
$this->sytopic_enroll_entity->synEnroll($res);
|
|
}
|
|
return ['code' => 1, 'msg' => '保存成功'];
|
|
}
|
|
|
|
public function statusCn()
|
|
{
|
|
$statusArray = [
|
|
0 => '待确认',
|
|
1 => '已确认',
|
|
2 => '无效单'
|
|
];
|
|
return $statusArray;
|
|
}
|
|
} |