From 75c65fd0f1dc0bff206ae90f5d39a1aa59f4b6eb Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 26 Jan 2024 11:59:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=B6=A6=E5=8A=9F=E8=83=BDlog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/ShopCallController.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/api/controller/ShopCallController.php b/app/api/controller/ShopCallController.php index bb80620b..05104c8a 100644 --- a/app/api/controller/ShopCallController.php +++ b/app/api/controller/ShopCallController.php @@ -4,6 +4,7 @@ namespace app\api\controller; use app\adminapi\logic\user\UserLogic; use app\common\logic\ShopRequestLogic; +use app\common\model\user\User; use think\exception\ValidateException; use think\facade\Log; @@ -185,27 +186,35 @@ class ShopCallController extends BaseApiController if (null === $requestDatas) { return $this->fail('非法访问,解析失败'); } - $streetCode = $requestDatas['data']['street_code']; // 镇街地区码 + $streetCode = $requestDatas['data']['street_code']??''; // 镇街地区码 $orderMoney = $requestDatas['data']['order_money']; // 订单金额 分 $orderNo = $requestDatas['data']['order_sn']; // 订单金额 $orderId = $requestDatas['data']['order_id']; // 订单id - $courierPhone = $requestDatas['data']['courier_phone']; // 配送员账号 + $courierPhone = $requestDatas['data']['courier_phone']??''; // 配送员账号 // 镇合伙人 - $userSelf = UserLogic::getUser(['street'=>$streetCode, 'group_id'=>15]); + $userSelf = new User(); + if (!empty($streetCode)) { + $userSelf = UserLogic::getUser(['street'=>$streetCode, 'group_id'=>15]); + } + // 配送员 - $courier = UserLogic::getUser(['account'=>$courierPhone]); + $courier = new User(); + if (!empty($courierPhone)) { + $courier = UserLogic::getUser(['account'=>$courierPhone]); + } + $proportion = 0.01; // 比例 $noticeUser = []; // 计算分润 - if (!empty($userSelf)) { + if (!$userSelf->isEmpty()) { UserLogic::userProfit($userSelf, $orderMoney, $proportion, $orderNo); $noticeUser[] = ['type' => 3, 'account' => $userSelf['account'], 'user_profit' => bcmul($orderMoney, 0.01, 2)]; } - if (!empty($courier)) { + if (!$courier->isEmpty()) { UserLogic::userProfit($courier, $orderMoney, $proportion, $orderNo); $noticeUser[] = ['type' => 4, 'account' => $courier['account'], 'user_profit' => bcmul($orderMoney, 0.01, 2)]; }