crm反改询单归属

This commit is contained in:
2025-08-26 15:50:29 +08:00
parent 61106b790c
commit 8ba5895810
4 changed files with 187 additions and 21 deletions
+33
View File
@@ -4,6 +4,7 @@ namespace app\crm\service;
use app\common\model\Corp;
use app\common\model\CustomerAudit;
use app\common\model\InquiryLog;
use app\common\model\User;
use app\common\traits\crud\CrudServiceTrait;
use app\crm\logic\CustomerLogic;
@@ -246,12 +247,44 @@ class CustomerService
$customer->status = 2;
$res = $customer->save();
self::inquiryUpdate($customer);
//软删除
$customer->delete();
return $res;
}
/**
* 询单修改
*/
public static function inquiryUpdate($customer,$userId = null)
{
if(empty($customer->sn) || $customer->type!=1){
return false;
}
$inquiryLog = InquiryLog::where('order_no', $customer->sn)->first();
if(empty($inquiryLog)){
return false;
}
$userId = $userId??$customer->user_id;
if ($userId == 0){
$inquiryLog->recipient = 0;
$inquiryLog->t_time = time();
$inquiryLog->status = 1;
$inquiryLog->r_time = time();
$inquiryLog->save();
}else {
$inquiryLog->recipient = $customer->user_id;
$inquiryLog->t_time = time();
$inquiryLog->save();
}
return true;
}
/**
* @param $customer
* @param $request