Merge branch 'feature/user0812' into develop_bm
# Conflicts: # app/admin/service/UserService.php # config/route.php
This commit is contained in:
@@ -4,6 +4,7 @@ namespace app\crmAdmin\service;
|
||||
|
||||
use app\common\model\InquiryLog;
|
||||
use app\common\model\User;
|
||||
use app\common\service\OssService;
|
||||
use app\crm\model\CustomerHis;
|
||||
use app\crmAdmin\logic\CustomerLogic;
|
||||
use app\crm\model\CarType;
|
||||
@@ -315,7 +316,42 @@ class CustomerService
|
||||
}
|
||||
}
|
||||
}
|
||||
$res = $query->update(['user_id' => $userId]);
|
||||
$data = [
|
||||
'user_id' => $userId,
|
||||
'obtain' => time(),
|
||||
];
|
||||
$res = $query->update($data);
|
||||
|
||||
Db::commit();
|
||||
return $res;
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($params)
|
||||
{
|
||||
try {
|
||||
Db::beginTransaction();
|
||||
$customerId = $params['customer_id'];
|
||||
|
||||
$query= Customer::whereIn('id',explode(',',$customerId));
|
||||
$customer = $query->get();
|
||||
|
||||
foreach ($customer as $item) {
|
||||
//记录客户关系变化
|
||||
$his = CustomerHis::create([
|
||||
'customer_id' => $item->id,
|
||||
'user_his' => $item->user_id,
|
||||
'user_id' => 0,
|
||||
]);
|
||||
}
|
||||
$res = $query->update(['user_id' => 0]);
|
||||
|
||||
Db::commit();
|
||||
return $res;
|
||||
@@ -394,4 +430,19 @@ class CustomerService
|
||||
|
||||
return $customer;
|
||||
}
|
||||
|
||||
public function follow($params)
|
||||
{
|
||||
$id = $params['id'];
|
||||
$follow = Follow::
|
||||
where('customer_id', $id)
|
||||
->first();
|
||||
|
||||
$ossservice = new OssService();
|
||||
foreach ($follow as $item) {
|
||||
$item['picture_full'] = $item->picture??$ossservice->generatePrivateUrl($item->picture);
|
||||
}
|
||||
|
||||
return $follow;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user