小组佣金同步

This commit is contained in:
monanxiao 2023-03-15 16:42:18 +08:00
parent a111c728cf
commit d3d8919654
2 changed files with 8 additions and 8 deletions

View File

@ -105,11 +105,11 @@ class UserExtractRepository extends BaseRepository
event('user.extract.before',compact('user','data'));
$userExtract = Db::transaction(function()use($user,$data,$source){
if($user['supply_brokerage_price'] < (systemConfig('user_extract_min')))
if($user['brokerage_price'] < (systemConfig('user_extract_min')))
throw new ValidateException('可提现金额不足');
if($data['extract_price'] < (systemConfig('user_extract_min')))
throw new ValidateException('提现金额不得小于最低额度');
if($user['supply_brokerage_price'] < $data['extract_price'])
if($user['brokerage_price'] < $data['extract_price'])
throw new ValidateException('提现金额不足');
if($data['extract_type'] == 3) {
$make = app()->make(WechatUserRepository::class);
@ -119,13 +119,13 @@ class UserExtractRepository extends BaseRepository
if(!$openid) throw new ValidateException('openID获取失败,请确认是微信用户');
}
}
$supply_brokerage_price = bcsub($user['supply_brokerage_price'],$data['extract_price'],2);
$user->supply_brokerage_price = $supply_brokerage_price;
$brokerage_price = bcsub($user['brokerage_price'],$data['extract_price'],2);
$user->brokerage_price = $brokerage_price;
$user->save();
$data['extract_sn'] = $this->createSn();
$data['uid'] = $user['uid'];
$data['balance'] = $supply_brokerage_price;
$data['balance'] = $brokerage_price;
$data['source'] = $source;
return $this->dao->create($data);

View File

@ -97,7 +97,7 @@ class User extends BaseController
]);
$data = [
'total_brokerage_price' => $this->totalBrokeragePrice($user['uid'], $source, $user['supply_brokerage_price']),
'total_brokerage_price' => $this->totalBrokeragePrice($user['uid'], $source, $user['brokerage_price']),
'lock_brokerage' => $this->lockBrokerage($user['uid'], 0, $source), // 冻结 待确定
'yesterday_brokerage' => $this->yesterdayBrokerage($user['uid'], $source),
'total_extract' => $this->userTotalExtract($user['uid'], $source),
@ -129,9 +129,9 @@ class User extends BaseController
return app('json')->success($data);
}
public function totalBrokeragePrice($uid, $source, $supply_brokerage_price)
public function totalBrokeragePrice($uid, $source, $brokerage_price)
{
return bcadd($this->lockBrokerage($uid, 0, $source), $supply_brokerage_price, 2);
return bcadd($this->lockBrokerage($uid, 0, $source), $brokerage_price, 2);
}
// 计算佣金