edit-api-post_clues

This commit is contained in:
lccsw
2022-03-24 15:40:17 +08:00
parent 4f47be9e5d
commit 199f6a20da
2 changed files with 55 additions and 4 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Tag extends Wxapp{
function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->login_white = array();//登录白名单
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg =array();//授权微信信息
$this->load->model('receiver/receiver_customer_tag_model');
$this->load->model('receiver/receiver_customer_tagdata_model');
}
//获取标签
protected function get(){
$page = $this->input_param('page');
$size = $this->input_param('size');
$pid = $this->input_param('pid');
!strlen($pid) && $pid = 0;
!$page && $page = 1;
!$size && $size = 20;
$where = [
'pid' => $pid,
'status' => 1
];
$count = $this->receiver_customer_tag_model->count($where);
$list = $this->receiver_customer_tag_model->select($where,'sort desc,id desc',$page,$size,'id,name');
$data = [
'list' => $list,
'total' => $count
];
return $data;
}
}
+16 -4
View File
@@ -24,6 +24,7 @@ class Clues extends Wxapp
$this->load->model('receiver/receiver_clue_oplogs_model');
$this->load->model('receiver/order/receiver_orders_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('receiver/receiver_customer_tagdata_model');
}
protected function get()
@@ -41,11 +42,11 @@ class Clues extends Wxapp
$cf_id = 8;
$name = $this->input_param('name');
$mobile = $this->input_param('mobile');
$brand_id = $this->input_param('brand_id');
$remark = $this->input_param('remark');
$intro_biz_id = intval($this->input_param('intro_biz_id'));
$intro_uid = intval($this->input_param('intro_uid'));
if (!$mobile || !$name || !$brand_id) {
$tag_ids = $this->input_param('tag_ids');
if (!$mobile || !$name) {
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
if (!mobile_valid($mobile)) {
@@ -59,7 +60,6 @@ class Clues extends Wxapp
'app_id' => $this->app_id,
'name' => $name,
'mobile' => $mobile,
'brand_id' => $brand_id,
'recommend_id' => $this->session['uid'],
'cf_uid' => $this->session['uid'],
'cf_platform' => 'wxapp',
@@ -99,7 +99,7 @@ class Clues extends Wxapp
'biz_id' => $re_biz['id'],
'city_id' => $re_biz['city_id'],
'county_id' => $re_biz['county_id'],
'brand_id' => $clues_row['brand_id'],
'brand_id' => 0,
's_id' => 0,
'if_driver' => 0,
'cf_title' => '自有资源',
@@ -111,6 +111,18 @@ class Clues extends Wxapp
];
$customers_id = $this->mdCustomers->add($add_data);
if ($customers_id) {
if($tag_ids){
$add_tag = [];
//查找已加入标签
foreach($tag_ids as $val){
$add_tag[] = [
'c_id' => $customers_id,
't_id' => $val,
'c_time' => time()
];
}
$this->receiver_customer_tagdata_model->add_batch($add_tag);
}
$content = "指定给【{$re_biz['biz_name']}】商家";
if ($intro_uid) {
$this->load->model('app/licheb/app_licheb_users_model', 'mdUsers');