客户转让

This commit is contained in:
2025-07-24 15:41:25 +08:00
parent c04f60c7e4
commit 1c1b1dab23
3 changed files with 13 additions and 15 deletions
+9 -13
View File
@@ -393,25 +393,21 @@ class CustomerController
public function cede(Request $request)
{
$customerId = Util::getParam($request, 'customer_id');
$user_sn = Util::getParam($request, 'user_sn');
$userId = $request->user['id'];
if (Util::isEmpty($user_sn)) {
return Util::fail([], 'ID'.trans('not_null'));
$userId = Util::getParam($request, 'user_id');
$selfId = $request->user['id'];
if (Util::isEmpty($userId)) {
return Util::fail([], 'user_id'.trans('not_null'));
}
if (Util::isEmpty($customerId)) {
return Util::fail([], 'customer_id'.trans('not_null'));
}
$user = User::where(['sn' => $user_sn])->first();
$user = User::where(['id' => $userId])->first();
if (Util::isEmpty($user)) {
return Util::fail(null, trans('user_none'));
}
if(Util::isEmpty($customerId)){
$data = [
'user_id' => $userId
];
$query= Customer::where($data);
}else{
$query= Customer::whereIn('id',explode(',',$customerId));
}
$query= Customer::where('user_id',$selfId)->whereIn('id',$customerId);
$customer = $query->get();
foreach ($customer as $item) {