分润功能log
This commit is contained in:
parent
34d1914849
commit
75c65fd0f1
|
@ -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)];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue