diff --git a/app/api/controller/ShopCallController.php b/app/api/controller/ShopCallController.php index c24d3be3..24d95092 100644 --- a/app/api/controller/ShopCallController.php +++ b/app/api/controller/ShopCallController.php @@ -5,6 +5,7 @@ namespace app\api\controller; use app\adminapi\logic\user\UserLogic; use app\common\logic\ShopRequestLogic; use think\exception\ValidateException; +use think\facade\Log; /** * 商城主动调用接口类 @@ -20,8 +21,8 @@ class ShopCallController extends BaseApiController $this->apiSecret = config('project.shop_api_secret'); } /** - * 用户首单分润 - * 队 村 镇三级分润 + * 用户直推首单分润 + * */ public function user_first_order_share_profit() { @@ -33,7 +34,7 @@ class ShopCallController extends BaseApiController $iv = substr(md5($this->apiSecret.$timestamp), 5, 16); // $secretData = encrypt($params['data'], $this->apiSecret, $iv); halt($secretData); $requestDatas = decrypt($params['data'], $this->apiSecret, $iv); - + Log::info('首单分润请求参数:'.json_encode($requestDatas)); if (null === $requestDatas) { return $this->fail('非法访问,解析失败'); } @@ -45,7 +46,7 @@ class ShopCallController extends BaseApiController // 推广人 $userSelf = UserLogic::getUserByInviteCode($inviteCode); - if (empty($userSelf)) { + if ($userSelf->isEmpty()) { return $this->fail('推广人不存在'); } $proportion = 0.03; @@ -73,7 +74,7 @@ class ShopCallController extends BaseApiController $iv1 = substr(md5($this->apiSecret.$timestamp), 5, 16); $encryptStr = encrypt($request, $this->apiSecret, $iv1); $res = ShopRequestLogic::userProfitNotice(['data' => $encryptStr, 'timestamp' => $timestamp]); - + Log::info('首单分润通知商城返回:'.json_encode($res)); return $this->success('成功'); // 推广人角色 - 小队/小区队长 @@ -180,6 +181,7 @@ class ShopCallController extends BaseApiController $timestamp = $params['timestamp']; $iv = substr(md5($this->apiSecret.$timestamp), 5, 16); $requestDatas = decrypt($params['data'], $this->apiSecret, $iv); + Log::info('镇合伙人,配送员分润请求参数:'.json_encode($requestDatas)); if (null === $requestDatas) { return $this->fail('非法访问,解析失败'); } @@ -215,7 +217,7 @@ class ShopCallController extends BaseApiController $iv1 = substr(md5($this->apiSecret.$timestamp), 5, 16); $encryptStr = encrypt($request, $this->apiSecret, $iv1); $res = ShopRequestLogic::userProfitNotice(['data' => $encryptStr, 'timestamp' => $timestamp]); - + Log::info('镇合伙人,配送员分润通知商城返回:'.json_encode($res)); return $this->success('成功', ['user_id' => $userSelf['id'], 'account' => $userSelf['account'], 'user_profit' => bcmul($orderMoney, $proportion, 2)]); } } \ No newline at end of file