feat: 更新用户等级和余额核销逻辑

This commit is contained in:
mkm 2024-06-27 14:21:02 +08:00
parent b812b36e3e
commit 194db4c3df
4 changed files with 11 additions and 5 deletions

View File

@ -89,7 +89,6 @@ class UserLogic extends BaseLogic
'account' => $params['mobile'], 'account' => $params['mobile'],
'password' => $password, 'password' => $password,
'mobile' => $params['mobile'], 'mobile' => $params['mobile'],
'user_ship' => $params['user_ship']??0,
'label_id' => $params['label_id']??0, 'label_id' => $params['label_id']??0,
]; ];

View File

@ -83,7 +83,6 @@ class StoreController extends BaseApiController
$find=UserUserLogic::StoreAdd($params); $find=UserUserLogic::StoreAdd($params);
}else{ }else{
$find['real_name']=$params['real_name']; $find['real_name']=$params['real_name'];
$find['user_ship']=$params['user_ship']??0;
$find['label_id']=$params['label_id']??0; $find['label_id']=$params['label_id']??0;
$find->save(); $find->save();
} }

View File

@ -483,9 +483,14 @@ class PayNotifyLogic extends BaseLogic
bcscale(2); bcscale(2);
// $user->now_money = bcadd($user->now_money, $price, 2);//v.1 // $user->now_money = bcadd($user->now_money, $price, 2);//v.1
//更新等级 //更新等级
if ($price >= Config::where('name','recharge')->value('value')) { $limit_1=UserShip::where('id',1)->value('limit');
$limit_4=UserShip::where('id',4)->value('limit');
if ($price >= $limit_1 &&$price<$limit_4) {
$user->user_ship = 1; //v.1 $user->user_ship = 1; //v.1
} }
if ($price>$limit_4) {
$user->user_ship = 4;
}
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2); $user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
$user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2); $user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2);
$user->save(); $user->save();

View File

@ -130,9 +130,12 @@ class StoreFinanceFlowLogic extends BaseLogic
/** /**
* 核销后更新余额 * 核销后更新余额
*/ */
public function updateStatusUser($id,$uid,$money){ public function updateStatusUser($id,$uid,$money,$order_id){
StoreFinanceFlow::where('id', $id)->update(['status' => 1]); StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
User::where('id',$uid)->inc('now_money',$money)->update(); $find=User::where('id',$uid)->find();
$capitalFlowDao = new CapitalFlowLogic($find);
$capitalFlowDao->userIncome('system_balance_add', 'order', $order_id, $money);
$find->inc('now_money',$money)->update();
} }