mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update RebateCurrentService.php
This commit is contained in:
parent
2956e152a0
commit
e4fd18191c
@ -107,6 +107,9 @@ class RebateCurrentService extends Service
|
||||
$map = ['order_no' => $orderNo, 'payment_status' => 1];
|
||||
$this->order = $this->app->db->name('ShopOrder')->where($map)->find();
|
||||
if (empty($this->order)) throw new Exception('订单不存在');
|
||||
// 同步订单用户余额
|
||||
if ($this->order['reward_balance'] > 0) $this->_balance();
|
||||
// 检查订单参与返利
|
||||
if ($this->order['amount_total'] <= 0) throw new Exception('订单金额为零');
|
||||
if ($this->order['rebate_amount'] <= 0) throw new Exception('订单返利为零');
|
||||
// 获取用户数据
|
||||
@ -135,6 +138,25 @@ class RebateCurrentService extends Service
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 来自订单余额充值
|
||||
* @return array [total, count]
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
private function _balance(): array
|
||||
{
|
||||
data_save('DataUserBalance', [
|
||||
'uid' => $this->order['uid'],
|
||||
'code' => $this->order['order_no'],
|
||||
'name' => "订单余额充值",
|
||||
'remark' => "来自订单{$this->order['order_no']}的余额充值",
|
||||
'amount' => $this->order['reward_balance'],
|
||||
], 'code');
|
||||
return UserUpgradeService::instance()->balance($this->order['uid']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首推奖励
|
||||
* @return boolean
|
||||
|
Loading…
x
Reference in New Issue
Block a user