审核原因

This commit is contained in:
2025-08-14 20:59:20 +08:00
parent 2e94a17d11
commit 646b39dec8
5 changed files with 63 additions and 1 deletions
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace app\common\model;
use support\Model;
class CustomerAudit extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'crm_customer_audit';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'customer_id', 'remark', 'img', 'audit', 'report_user_id', 'audit_user_id', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -239,6 +239,9 @@ class CustomerController extends BaseController
if (Util::isEmpty($param['id'])) {
return $this->error(trans('id_empty'));
}
if (Util::isEmpty($param['remark'])) {
return $this->error('举报理由不能为空');
}
$param['user_id'] = $request->user->uid;
$param['corp_abbr'] = $request->basic_data['corp_abbr'];
+8
View File
@@ -3,6 +3,7 @@
namespace app\crm\service;
use app\common\model\Corp;
use app\common\model\CustomerAudit;
use app\common\model\User;
use app\common\traits\crud\CrudServiceTrait;
use app\crm\logic\CustomerLogic;
@@ -195,6 +196,13 @@ class CustomerService
return false;
}
CustomerAudit::create([
'customer_id' => $id,
'report_user_id' => $userId,
'remark' => $params['remark'],
'img' => implode(',', $params['img']),
]);
CustomerHis::create([
'customer_id' => $id,
'user_his' => $userId,
@@ -85,7 +85,7 @@ class CustomerController extends BaseController
}
/**
* 客户列表
* 审核客户
* @param Request $request
* @return \support\Response
*/
+2
View File
@@ -2,6 +2,7 @@
namespace app\crmAdmin\service;
use app\common\model\CustomerAudit;
use app\common\model\InquiryLog;
use app\common\model\User;
use app\common\service\OssService;
@@ -139,6 +140,7 @@ class CustomerService
if ($scene == 'audit') { //审核时查询举报人姓名
$customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']);
$item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name');
$item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']);
}
}
}