customers wxgrimg about

This commit is contained in:
qianhy
2023-03-20 15:09:37 +08:00
parent e34e9115a7
commit 123c89d495
+54 -1
View File
@@ -83,6 +83,8 @@ class Customers extends Wxapp
'level' => $row['level'],
'tags' => $tags,
'wxgr' => $row['wxgr'],
'wxgrimg' => $row['wxgrimg'],
'wxgrimg_url' => $row['wxgrimg'] ? build_qiniu_image_url($row['wxgrimg']) : '',
];
return $data;
} else {
@@ -108,6 +110,8 @@ class Customers extends Wxapp
'of_id' => ['value' => $of_title, 'of_id' => intval($row['of_id']), 'of2_id' => intval($row['of2_id']), 'cn' => '线索来源'],
'buy_time' => ['value' => $row['buy_time'], 'cn' => '预计购车时间'],
'wxgr' => $row['wxgr'],
'wxgrimg' => $row['wxgrimg'],
'wxgrimg_url' => $row['wxgrimg'] ? build_qiniu_image_url($row['wxgrimg']) : '',
];
return $data;
}
@@ -205,10 +209,14 @@ class Customers extends Wxapp
$city_id = $this->input_param('city_id'); //城市id
$county_id = $this->input_param('county_id'); //区id
$wxgr = $this->input_param('wxgr'); //是否加个微
$wxgrimg = $this->input_param('wxgrimg'); //个微截图
$row = $this->customers_model->get(['id' => $id]);
if (!$row) {
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
if ($wxgr && !$wxgrimg && !$row['wxgrimg']){
throw new Exception('请上传‘添加个微’截图!', ERR_PARAMS_ERROR);
}
$update = [];
if ($row['cf_title'] != '平台分配') {
if ($mobile) {
@@ -227,6 +235,7 @@ class Customers extends Wxapp
$city_id && $update['city_id'] = $city_id;
$county_id && $update['county_id'] = $county_id;
$wxgr && $update['wxgr'] = intval($wxgr) ? 1 : 0;
$wxgrimg && $wxgrimg != $row['wxgrimg'] && $update['wxgrimg'] = $wxgrimg;
if ($buy_time) {
$this->load->library('receiver/customers_entity');
$update['level'] = $this->customers_entity->cal_level($buy_time);
@@ -259,6 +268,24 @@ class Customers extends Wxapp
$uname = $this->session['uname'];
$this->load->library('receiver/customers_entity');
$this->customers_entity->add_log($id, $this->session['uid'], $uname, "修改用户基本信息");
if ($wxgr){
$uid = $this->session['uid'];
$res = $this->customer_oplogs_model->get(['customer_id' => $id, 'uid'=> $uid, 'type' => 10]);
if ($res){
if ($wxgrimg && $wxgrimg != $row['wxgrimg'] || $wxgrimg && !$res['imgs']){
$imgs = $res['imgs'] ? json_decode($res['imgs'], true) : [];
$imgs[] = $wxgrimg;
$this->customer_oplogs_model->update(array('imgs' => json_encode($imgs, JSON_UNESCAPED_UNICODE)), array('id'=>$res['id']));
}
}
else{
$imgs = [];
$wxgrimg && $imgs[]= $wxgrimg;
$this->customers_entity->add_log($id, $uid, $uname, '加个微', 10, 'wxapp', $imgs);
}
}
throw new Exception('保存成功', API_CODE_SUCCESS);
}
@@ -275,10 +302,14 @@ class Customers extends Wxapp
$city_id = $this->input_param('city_id'); //城市id
$county_id = $this->input_param('county_id'); //区id
$wxgr = $this->input_param('wxgr'); //是否加个微
$wxgrimg = $this->input_param('wxgrimg'); //个微截图
if (!mobile_valid($mobile)) throw new Exception('请输入正确的手机号码', ERR_PARAMS_ERROR);
if (!$city_id || !$county_id) {
throw new Exception('请选择城市与行政区', API_CODE_FAIL);
}
if ($wxgr && !$wxgrimg){
throw new Exception('请上传‘添加个微’截图!', ERR_PARAMS_ERROR);
}
$is_exit = $this->customers_model->get(['biz_id' => $this->biz_id, 'mobile' => $mobile],'id,sales_id');
if ($is_exit) {
if($is_exit['sales_id']!=$this->session['uid']){
@@ -309,6 +340,7 @@ class Customers extends Wxapp
'city_id' => $city_id,
'county_id' => $county_id,
'wxgr' => intval($wxgr) ? 1 : 0,
'wxgrimg' => $wxgrimg ? $wxgrimg : '',
'c_time' => time()
];
if ($biz_row['type'] == 5) {//异业店
@@ -355,6 +387,11 @@ class Customers extends Wxapp
if ($status == 1) {//到店客户加日志
$this->customers_entity->add_log($id, $uid, $uname, "客户到店", 4);
}
if ($wxgr){
$imgs = [];
$wxgrimg && $imgs[]= $wxgrimg;
$this->customers_entity->add_log($id, $uid, $uname, '加个微', 10, 'wxapp', $imgs);
}
throw new Exception('创建成功', API_CODE_SUCCESS);
} else {
throw new Exception('创建失败', ERR_PARAMS_ERROR);
@@ -400,6 +437,7 @@ class Customers extends Wxapp
$t_num = $this->input_param('t_num');
$a_num = $this->input_param('a_num');
$wxgr = $this->input_param('wxgr');
$wxgrimg = $this->input_param('wxgrimg');
$is_top = $this->input_param('is_top');
$defeat_reason = $this->input_param('defeat_reason');//申请战败内容
$level = $this->input_param('level');//客户等级
@@ -417,6 +455,9 @@ class Customers extends Wxapp
if (!$row) {
throw new Exception('数据不存在!', ERR_PARAMS_ERROR);
}
if ($wxgr && !$wxgrimg && !$row['wxgrimg']){
throw new Exception('请上传‘添加个微’截图!', ERR_PARAMS_ERROR);
}
$check_admin_id = true;//检查销售
if ($this->session['group_id'] == 2 || $this->session['group_id'] == 3) {//店长、老板可以操作其他人的客户
$check_admin_id = false;
@@ -523,6 +564,7 @@ class Customers extends Wxapp
$a_num && $up_data['a_num = a_num+1'] = null;
$t_num && $up_data['t_num = t_num+1'] = null;
$wxgr && $up_data['wxgr'] = 1;
$wxgrimg && $wxgrimg != $row['wxgrimg'] && $up_data['wxgrimg'] = $wxgrimg;
$visit_time && $up_data['visit_time'] = $visit_time;
if ($level && $level != $row['level']) {
$up_data['level'] = $level;//更改客户等级
@@ -554,7 +596,18 @@ class Customers extends Wxapp
}
if ($wxgr){
$res = $this->customer_oplogs_model->get(['customer_id' => $id, 'uid'=> $uid, 'type' => 10]);
!$res && $this->customers_entity->add_log($id, $uid, $uname, '加个微', 10);
if ($res){
if ($wxgrimg && $wxgrimg != $row['wxgrimg'] || $wxgrimg && !$res['imgs']){
$imgs = $res['imgs'] ? json_decode($res['imgs'], true) : [];
$imgs[] = $wxgrimg;
$this->customer_oplogs_model->update(array('imgs' => json_encode($imgs, JSON_UNESCAPED_UNICODE)), array('id'=>$res['id']));
}
}
else{
$imgs = [];
$wxgrimg && $imgs[]= $wxgrimg;
$this->customers_entity->add_log($id, $uid, $uname, '加个微', 10, 'wxapp', $imgs);
}
}
if ($log_0) {//小记
$this->customers_entity->add_log($id, $uid, $uname, $log_0, 0);