增加同步crm

This commit is contained in:
mzl
2025-07-23 18:41:47 +08:00
parent 36288fa64d
commit d55b6bd4d9
6 changed files with 171 additions and 9 deletions
+25 -3
View File
@@ -7,6 +7,7 @@ use app\common\traits\crud\CrudServiceTrait;
use app\common\model\InquiryLog;
use support\exception\BusinessException;
use support\Request;
use Webman\RedisQueue\Redis as RedisQueueRedis;
class InquiryLogService
{
@@ -39,7 +40,7 @@ class InquiryLogService
$data = $this->preProcess('Release', $data, $request);
$config = $this->buildQueryConfig($request, 'release');
$updated = $this->logicUpdateBy($config, $data);
return $this->postProcess('Release', $updated);
return $this->postProcess('Release', $data);
}
/**
@@ -50,7 +51,7 @@ class InquiryLogService
$data = $this->preProcess('Allocation', $data, $request);
$config = $this->buildQueryConfig($request, 'allocation');
$updated = $this->logicUpdateBy($config, $data);
return $this->postProcess('Allocation', $updated);
return $this->postProcess('Allocation', $data);
}
/**
@@ -139,7 +140,7 @@ class InquiryLogService
throw new BusinessException('数据不存在');
}
if ($info->status != 0) {
throw new BusinessException('询单已发布');
throw new BusinessException('询单已被发布');
}
$data['r_time'] = time();
$data['status'] = 1;
@@ -158,8 +159,29 @@ class InquiryLogService
if ($info->status == 2) {
throw new BusinessException('询单已被分配');
}
if ($info->status == 0) {
$data['r_time'] = time();
}
$data['t_time'] = time();
$data['status'] = 2;
return $data;
}
/**
* 发布后置处理
*/
protected function afterServiceRelease($res)
{
RedisQueueRedis::send('inquiry-to-crm', $res);
return $res;
}
/**
* 分配后置处理
*/
protected function afterServiceAllocation($res)
{
RedisQueueRedis::send('inquiry-to-crm', $res);
return $res;
}
}