diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 72017f7b9..e7ecffde9 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -7,6 +7,7 @@ use app\common\{logic\BaseLogic, model\system_store\SystemStore, model\user\User, model\user\UserRecharge, + model\user\UserShip, service\wechat\WeChatMnpService}; /** @@ -60,12 +61,20 @@ class UserLogic extends BaseLogic public static function info($uid) { $data = User::where('id',$uid) - ->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money') + ->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money,total_recharge_amount,user_ship') ->find(); //判断是不是员工 if($data){ $data = $data->toArray(); + $all =UserShip::field('id,title,limit')->select()->toArray(); + $new = self::getNextArrayByID($all,$data['user_ship']); + $data['next_level'] = ''; + $data['next_limit'] = 0; + if($new){ + $data['next_level'] = $new['title']; + $data['next_limit'] = $new['limit'] - $data['total_recharge_amount']; + } $data['is_staff'] = 0; $data['store_id'] = 0; if(isset($data['mobile']) && $data['mobile']){ @@ -91,4 +100,22 @@ class UserLogic extends BaseLogic } + public static function getNextArrayByID($arr, $id) { + // 遍历数组 + foreach ($arr as $key => $value) { + // 检查当前数组的id是否与传入的id匹配 + if ($value['id'] == $id) { + // 如果当前数组不是最后一个,则返回下一个数组 + if ($key + 1 < count($arr)) { + return $arr[$key + 1]; + } + // 如果当前数组是最后一个,则返回null或空数组 + return null; + } + } + // 如果没有找到匹配的id,则返回null或空数组 + return null; + } + + } \ No newline at end of file diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 124ece936..0bcec9da2 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -34,7 +34,7 @@ class PaymentLogic extends BaseLogic { // 支付编号-仅为微信支付预置(同一商户号下不同客户端支付需使用唯一订单号) $paySn = $order['order_id']; - if ($order['pay_price'] == 0) { + if ($order['pay_price'] === 0) { PayNotifyLogic::handle($from, $order['order_id']); return ['pay_way' => PayEnum::BALANCE_PAY]; }