introduce_323
This commit is contained in:
@@ -27,23 +27,22 @@ class Auto extends Wxapp
|
||||
protected function get_introduce()
|
||||
{
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$id = intval($this->input_param('id'));
|
||||
$biz_id = intval($this->input_param('biz_id'));
|
||||
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
|
||||
if (!$re || empty($re)) {
|
||||
throw new Exception('车型介绍不存在', API_CODE_FAIL);
|
||||
}
|
||||
$sign_up = $this->session['mobile'] ? 0 : 1;
|
||||
$title = '';
|
||||
if ($re['s_id']) {
|
||||
$re_b = $this->mdAutoBrand->get(['id' => $re['brand_id']]);
|
||||
$re_b && $title = $re_b['name'];
|
||||
$re_s = $this->mdAutoSeries->get(['id' => $re['s_id']]);
|
||||
$re_s && $title = $title ? $title . '-' . $re_s['name'] : $title;
|
||||
if ($biz_id && $this->session['mobile']) {//加标签
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$re_cus = $this->mdCustomers->get(['biz_id' => $biz_id, 'mobile' => $this->session['mobile']]);
|
||||
if ($re_cus) {
|
||||
$this->addTag(['c_id' => $re_cus['id'], 'brand_id' => $re['brand_id']]);
|
||||
}
|
||||
}
|
||||
$sign_up = $this->session['mobile'] ? 0 : 1;
|
||||
$data = array(
|
||||
'title' => $title . '_车型介绍',
|
||||
'title' => '车型介绍',
|
||||
"video" => $re['video'] ? build_qiniu_image_url($re['video'], 0, 0, 'video') : '',
|
||||
'content' => $re['content'],
|
||||
'sign_up' => $sign_up,
|
||||
@@ -68,7 +67,6 @@ class Auto extends Wxapp
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
|
||||
if (!$re || empty($re)) {
|
||||
throw new Exception('车型介绍不存在', API_CODE_SUCCESS);
|
||||
@@ -98,19 +96,32 @@ class Auto extends Wxapp
|
||||
if (!$id) {
|
||||
throw new Exception('预约报名失败!', API_CODE_SUCCESS);
|
||||
}
|
||||
$re_b = $this->mdAutoBrand->get(['id' => $re['brand_id']]);
|
||||
$this->addTag(['c_id' => $id, 'brand_id' => $re['brand_id']]);
|
||||
throw new Exception('报名成功!', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加标签
|
||||
* Created on: 2022/3/23 15:07
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
*/
|
||||
private function addTag($params)
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$re_b = $this->mdAutoBrand->get(['id' => $params['brand_id']]);
|
||||
if ($re_b['name']) {
|
||||
$this->load->model('receiver/receiver_customer_tag_model', 'mdCustomerTag');
|
||||
$this->load->model('receiver/receiver_customer_tagdata_model', 'mdCustomerTagdata');
|
||||
$re_tag = $this->mdCustomerTag->get(['pid' => 1, 'name' => $re_b['name']]);
|
||||
if ($re_tag) {
|
||||
$re_tag_data = $this->mdCustomerTagdata->get(['c_id' => $id, 't_id' => $re_tag['id']]);
|
||||
$re_tag_data = $this->mdCustomerTagdata->get(['c_id' => $params['c_id'], 't_id' => $re_tag['id']]);
|
||||
if (!$re_tag_data) {//添加客户标签
|
||||
$this->mdCustomerTagdata->add(['c_id' => $id, 't_id' => $re_tag['id'], 'c_time' => time()]);
|
||||
$this->mdCustomerTagdata->add(['c_id' => $params['c_id'], 't_id' => $re_tag['id'], 'c_time' => time()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Exception('报名成功!', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user