introduce_322_2
This commit is contained in:
@@ -129,6 +129,17 @@ class Main extends HD_Controller
|
||||
array('name' => '查看详情', 'url' => '/app/liche/order'),
|
||||
),
|
||||
);
|
||||
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$value = $this->mdAutoIntroduce->count(["status<>-1" => null]);
|
||||
$list[] = array(
|
||||
'title' => '车型介绍(条)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/auto/introduce'),
|
||||
),
|
||||
);
|
||||
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
@@ -61,14 +61,21 @@ class Auto extends Wxapp
|
||||
protected function put_introduce()
|
||||
{
|
||||
$biz_id = intval($this->input_param('biz_id'));
|
||||
if (!$biz_id || !$this->session['mobile']) {
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
$id = intval($this->input_param('id'));
|
||||
if (!$id || !$biz_id || !$this->session['mobile']) {
|
||||
throw new Exception('参数错误', API_CODE_SUCCESS);
|
||||
}
|
||||
$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);
|
||||
}
|
||||
$re_biz = $this->mdBiz->get(['id' => $biz_id, 'status' => 1]);
|
||||
if (!$re_biz) {
|
||||
throw new Exception('门店不存在!', API_CODE_FAIL);
|
||||
throw new Exception('门店不存在!', API_CODE_SUCCESS);
|
||||
}
|
||||
$of_id = 1;//自然进店
|
||||
$add_data = [
|
||||
@@ -89,7 +96,19 @@ class Auto extends Wxapp
|
||||
}
|
||||
$id = $this->mdCustomers->add($add_data);
|
||||
if (!$id) {
|
||||
throw new Exception('预约报名失败!', API_CODE_FAIL);
|
||||
throw new Exception('预约报名失败!', API_CODE_SUCCESS);
|
||||
}
|
||||
$re_b = $this->mdAutoBrand->get(['id' => $re['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']]);
|
||||
if (!$re_tag_data) {//添加客户标签
|
||||
$this->mdCustomerTagdata->add(['c_id' => $id, 't_id' => $re_tag['id'], 'c_time' => time()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Exception('报名成功!', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user