offline order
This commit is contained in:
parent
fc7c6757f4
commit
bd6d91efdc
@ -6,6 +6,7 @@ use App\Facades\CommonService;
|
|||||||
use App\Facades\WechatService;
|
use App\Facades\WechatService;
|
||||||
use App\Http\Controllers\H5\OrderController;
|
use App\Http\Controllers\H5\OrderController;
|
||||||
use App\Jobs\UnfreezeCommission;
|
use App\Jobs\UnfreezeCommission;
|
||||||
|
use App\Models\DmaServiceUserRole;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
use App\Models\GroupUser;
|
use App\Models\GroupUser;
|
||||||
use App\Models\OfflineOrder;
|
use App\Models\OfflineOrder;
|
||||||
@ -243,6 +244,14 @@ class OfflineOrderService
|
|||||||
$this->joinServiceGroup($imChatId, $groupId, $orderId, $mainCoachRoleId, $mainCoachUserId);
|
$this->joinServiceGroup($imChatId, $groupId, $orderId, $mainCoachRoleId, $mainCoachUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 副教练
|
||||||
|
$coachRoleId = 2;
|
||||||
|
$coachUserId = $this->getOrderService($userId, $coachRoleId);
|
||||||
|
Log::info("副教练用户id:" . $coachUserId);
|
||||||
|
if ($coachUserId) {
|
||||||
|
$this->joinServiceGroup($imChatId, $groupId, $orderId, $coachRoleId, $coachUserId);
|
||||||
|
}
|
||||||
|
|
||||||
// 客服
|
// 客服
|
||||||
$customerRoleId = 3;
|
$customerRoleId = 3;
|
||||||
$customerUserId = $this->getOrderService($userId, $customerRoleId);
|
$customerUserId = $this->getOrderService($userId, $customerRoleId);
|
||||||
@ -307,24 +316,28 @@ class OfflineOrderService
|
|||||||
*/
|
*/
|
||||||
public function getOrderService($userId, $roleId): int
|
public function getOrderService($userId, $roleId): int
|
||||||
{
|
{
|
||||||
$userIds = [];
|
if ($userId == 3740 || $userId == 6) // 测试用户
|
||||||
switch ($roleId) {
|
|
||||||
case 1:
|
|
||||||
if ($userId == 3740 || $userId == 6)
|
|
||||||
return 1;
|
return 1;
|
||||||
// $userIds = [218, 178, 175, 176];
|
// $userIds = [];
|
||||||
$userIds = [218, 175, 176];
|
// switch ($roleId) {
|
||||||
// $userIds = [153, 152, 11043, 1]; // 测试
|
// case 1:
|
||||||
break;
|
// if ($userId == 3740 || $userId == 6)
|
||||||
case 3:
|
// return 1;
|
||||||
if ($userId == 3740 || $userId == 6)
|
// // $userIds = [218, 178, 175, 176];
|
||||||
return 7;
|
// $userIds = [218, 175, 176];
|
||||||
$userIds = [181, 177, 184];
|
// // $userIds = [153, 152, 11043, 1]; // 测试
|
||||||
// $userIds = [7, 3306]; // 测试
|
// break;
|
||||||
break;
|
// case 3:
|
||||||
}
|
// if ($userId == 3740 || $userId == 6)
|
||||||
|
// return 7;
|
||||||
|
// $userIds = [181, 177, 184];
|
||||||
|
// // $userIds = [7, 3306]; // 测试
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
$userIds = ServiceOrderStatus::whereIn("user_id", $userIds)->where("order_status", 1)->pluck("user_id")->toArray();
|
$userIds = DmaServiceUserRole::where("role", $roleId)->where("status", 1)->pluck("user_id")->toArray();
|
||||||
|
|
||||||
|
$userIds = ServiceOrderStatus::whereIn("user_id", $userIds)->where("order_status", 1)->orderByDesc("id")->pluck("user_id")->toArray();
|
||||||
$serviceUserId = $this->getLastServiceUserId($roleId, $userIds);
|
$serviceUserId = $this->getLastServiceUserId($roleId, $userIds);
|
||||||
return $serviceUserId;
|
return $serviceUserId;
|
||||||
}
|
}
|
||||||
@ -332,16 +345,17 @@ class OfflineOrderService
|
|||||||
public function getLastServiceUserId($roleId, $userIds): int
|
public function getLastServiceUserId($roleId, $userIds): int
|
||||||
{
|
{
|
||||||
$serviceUserId = 0;
|
$serviceUserId = 0;
|
||||||
if ($roleId != 1 && $roleId != 3)
|
// if ($roleId != 1 && $roleId != 3)
|
||||||
return $serviceUserId;
|
// return $serviceUserId;
|
||||||
|
|
||||||
|
|
||||||
if (count($userIds) == 0)
|
if (count($userIds) == 0)
|
||||||
return $serviceUserId;
|
return $serviceUserId;
|
||||||
|
|
||||||
|
// 上一个订单对应服务人员id
|
||||||
$serviceRoleOrder = ServiceRoleOrder::where("role_id", $roleId)->whereIn("user_id", $userIds)->orderByDesc("id")->first();
|
$serviceRoleOrder = ServiceRoleOrder::where("role_id", $roleId)->whereIn("user_id", $userIds)->orderByDesc("id")->first();
|
||||||
if (!$serviceRoleOrder)
|
if (!$serviceRoleOrder)
|
||||||
return $serviceUserId;
|
return $userIds[0];
|
||||||
|
|
||||||
$serviceUserId = $this->findIndex($userIds, $serviceRoleOrder->user_id);
|
$serviceUserId = $this->findIndex($userIds, $serviceRoleOrder->user_id);
|
||||||
return $serviceUserId;
|
return $serviceUserId;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user