无效客户举报图文
This commit is contained in:
@@ -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 (empty($param['remark']) && empty($param['img'])) {
|
||||
return $this->error('举报理由不能为空');
|
||||
}
|
||||
|
||||
$param['user_id'] = $request->user->uid;
|
||||
$param['corp_abbr'] = $request->basic_data['corp_abbr'];
|
||||
|
||||
@@ -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,14 @@ class CustomerService
|
||||
return false;
|
||||
}
|
||||
|
||||
CustomerAudit::create([
|
||||
'customer_id' => $id,
|
||||
'report_user_id' => $userId,
|
||||
'remark' => $params['remark'],
|
||||
'status' => 1,
|
||||
'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
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,7 @@ class CustomerLogic
|
||||
$customer->restore();
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,10 @@ 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();
|
||||
if (!empty($item['audit'])&&!empty($item['audit']['img'])) {
|
||||
$item['audit']['img'] = explode(',', $item['audit']['img']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,9 +292,14 @@ class CustomerService
|
||||
$id = $params['id'];
|
||||
|
||||
$logic = new CustomerLogic();
|
||||
$audit = CustomerAudit::where('customer_id', $id)->orderBy('id', 'desc')->first();
|
||||
if ($params['scene'] == 'delete') {
|
||||
$audit->status = 3;
|
||||
$audit->save();
|
||||
return $logic->forceDelete($params['id']);
|
||||
} else {
|
||||
$audit->status = 2;
|
||||
$audit->save();
|
||||
return $logic->status($params['id'], 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user