0 && UserCouponModel::setIsUse($order['coupon_id'], false); } //判断是否已支付 if ($order['pay_status'] == PayStatus::SUCCESS) { if (!(new RefundService)->handle($order)) { try { throwError('执行订单退款失败'); } catch (BaseException $e) { return false; } } } //更新订单状态 $model = new \app\common\model\server\Order; $model->where(['order_id' => $order['order_id']])->save(['order_status' => ServerEnum::CANCELLED]); return true; } return false; } /** * @notes:派单 * @param array $order * @param int $dealerId * @return bool * @author: wanghousheng */ public static function dispatchOrders(array $order, int $dealerId): bool { //判断该订单是否可以指派 if (!empty($order) && $order['order_status'] == ServerEnum::APPLYDISPATCH) { //判断指派人员是否是分销工程师 $dealerInfo = DealerUserModel::detail($dealerId, []); if (!empty($dealerInfo)) { $dealerInfo = $dealerInfo->toArray(); if ($dealerInfo['type'] == DealerUserEnum::ENGINEER) { $model = new \app\common\model\server\Order; $up['dealer_id'] = $dealerId; $up['order_status'] = ServerEnum::APPLYSERVER; $model->where(['order_id' => $order['order_id']])->save($up); return true; } } } return false; } }