Merge branch 'feature/crmadmin0724' into develop
This commit is contained in:
@@ -198,6 +198,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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户详情
|
||||
@@ -341,8 +364,10 @@ class CustomerController extends BaseController
|
||||
return $this->error( trans('fail'));
|
||||
}
|
||||
if($force == 'force'){
|
||||
//强制删除
|
||||
$res = $customer->forceDelete();
|
||||
}else{
|
||||
//软删除
|
||||
$res = $customer->delete();
|
||||
}
|
||||
if ($res) {
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace app\crm\service;
|
||||
use app\common\model\Corp;
|
||||
use app\common\model\User;
|
||||
use app\crm\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;
|
||||
@@ -37,6 +37,7 @@ class CustomerService
|
||||
}else{
|
||||
$where[] = ['user_id', $user_id];
|
||||
}
|
||||
$where[] = ['status', 1];
|
||||
|
||||
|
||||
$grade = [];
|
||||
@@ -111,6 +112,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