审核
This commit is contained in:
@@ -195,6 +195,29 @@ class CustomerController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户恢复
|
||||
* @param Request $request
|
||||
* @return \support\Response
|
||||
*/
|
||||
public function report(Request $request)
|
||||
{
|
||||
$param = $request->all();
|
||||
if (Util::isEmpty($param['id'])) {
|
||||
return $this->error(trans('id_empty'));
|
||||
}
|
||||
|
||||
$param['user_id'] = $request->user->uid;
|
||||
$param['corp_abbr'] = $request->basic_data['corp_abbr'];
|
||||
$res = (new CustomerService())->report($param);
|
||||
|
||||
if($res){
|
||||
return $this->success($res, trans('success'));
|
||||
}else{
|
||||
return $this->error(trans('fail'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户详情
|
||||
@@ -337,8 +360,10 @@ class CustomerController extends BaseController
|
||||
return $this->error( trans('fail'));
|
||||
}
|
||||
if($force == 'force'){
|
||||
//强制删除
|
||||
$res = $customer->forceDelete();
|
||||
}else{
|
||||
//软删除
|
||||
$res = $customer->delete();
|
||||
}
|
||||
if ($res) {
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace app\crm\service;
|
||||
|
||||
use app\crm\logic\CustomerLogic;
|
||||
use app\crmAdmin\logic\CustomerLogic;
|
||||
use app\crm\model\CarType;
|
||||
use app\crm\model\Channel;
|
||||
use app\crm\model\Country;
|
||||
use app\crm\model\Customer;
|
||||
use app\crm\model\CustomerHis;
|
||||
use app\crm\model\Follow;
|
||||
use app\crm\utils\Util;
|
||||
use config\constants\Constants;
|
||||
@@ -35,6 +36,7 @@ class CustomerService
|
||||
}else{
|
||||
$where[] = ['user_id', $user_id];
|
||||
}
|
||||
$where[] = ['status', 1];
|
||||
|
||||
|
||||
$grade = [];
|
||||
@@ -100,6 +102,34 @@ class CustomerService
|
||||
return $customer;
|
||||
}
|
||||
|
||||
public function report($params)
|
||||
{
|
||||
$id = $params['id'];
|
||||
$userId = $params['user_id'];
|
||||
|
||||
$where = [
|
||||
'id' => $id,
|
||||
'user_id' => $userId,
|
||||
];
|
||||
$customer = Customer::where($where)->withTrashed()->first();
|
||||
if(empty($customer)){
|
||||
return false;
|
||||
}
|
||||
|
||||
CustomerHis::create([
|
||||
'customer_id' => $id,
|
||||
'user_his' => $userId,
|
||||
'user_id' => 0,
|
||||
]);
|
||||
|
||||
$customer->status = 2;
|
||||
$res = $customer->save();
|
||||
|
||||
//软删除
|
||||
$customer->delete();
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
|
||||
Reference in New Issue
Block a user