等级和调用支付

This commit is contained in:
liu 2024-06-05 18:39:11 +08:00
parent 43d0168db0
commit 9a9c836f34
2 changed files with 29 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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];
}