|
@@ -15,17 +15,25 @@ class Money extends Api
|
|
|
|
|
|
//配置
|
|
|
public function withdraw_config(){
|
|
|
- //部分提现,下单收益+直推返佣
|
|
|
- $map = [
|
|
|
+ //部分提现,直推返佣+下单收益
|
|
|
+ $map1 = [
|
|
|
'user_id' => $this->auth->id,
|
|
|
'log_type' => 3,
|
|
|
'withdraw_id' => 0,
|
|
|
];
|
|
|
- $bufenscore = Db::name('user_score_log')->where($map)->sum('change_value');
|
|
|
+ $zhitui = Db::name('user_score_log')->where($map1)->sum('change_value');
|
|
|
+
|
|
|
+ $map2 = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'log_type' => 5,
|
|
|
+ 'withdraw_id' => 0,
|
|
|
+ ];
|
|
|
+ $shouyi = Db::name('user_score_log')->where($map2)->sum('shouyi');
|
|
|
+
|
|
|
|
|
|
$data = [
|
|
|
'score' => model('wallet')->getWallet($this->auth->id,'score'),
|
|
|
- 'score_bufen' => $bufenscore,
|
|
|
+ 'score_bufen' => bcadd($zhitui,$shouyi),
|
|
|
'min_withdrawal_money' => config('site.min_withdrawal_money'),
|
|
|
'max_withdrawal_money' => config('site.max_withdrawal_money'),
|
|
|
'type_1' => Db::name('user_withdraw')->where('user_id',$this->auth->id)->where('type',1)->where('status',1)->field('realname,banknumber,bankname')->find(),
|
|
@@ -57,20 +65,36 @@ class Money extends Api
|
|
|
if($from == 'all'){
|
|
|
$user_money = model('wallet')->getWallet($this->auth->id,'score');
|
|
|
}else{
|
|
|
- $map = [
|
|
|
+
|
|
|
+ //部分提现,直推返佣+下单收益
|
|
|
+ $map1 = [
|
|
|
'user_id' => $this->auth->id,
|
|
|
'log_type' => 3,
|
|
|
'withdraw_id' => 0,
|
|
|
];
|
|
|
- $user_money = Db::name('user_score_log')->where($map)->sum('change_value');
|
|
|
+ $zhitui = Db::name('user_score_log')->where($map1)->sum('change_value');
|
|
|
+
|
|
|
+ $map2 = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'log_type' => 5,
|
|
|
+ 'withdraw_id' => 0,
|
|
|
+ ];
|
|
|
+ $shouyi = Db::name('user_score_log')->where($map2)->sum('shouyi');
|
|
|
+
|
|
|
+ $user_money = bcadd($zhitui,$shouyi);
|
|
|
+
|
|
|
//记录id,等会修改状态
|
|
|
- $user_score_log_ids = Db::name('user_score_log')->where($map)->column('id');
|
|
|
+ $user_score_log_ids_1 = Db::name('user_score_log')->where($map1)->column('id');
|
|
|
+ $user_score_log_ids_2 = Db::name('user_score_log')->where($map2)->column('id');
|
|
|
+
|
|
|
+ $user_score_log_ids = array_merge($user_score_log_ids_1,$user_score_log_ids_2);
|
|
|
}
|
|
|
|
|
|
if ($user_money <= 0) {
|
|
|
$this->error('积分不足');
|
|
|
}
|
|
|
|
|
|
+ $data = [];
|
|
|
$data['order_no'] = createUniqueNo('T',$this->auth->id);
|
|
|
$data['user_id'] = $this->auth->id;
|
|
|
$data['score'] = $user_money;
|
|
@@ -80,6 +104,7 @@ class Money extends Api
|
|
|
$data['bankname'] = input('bankname','');
|
|
|
$data['createtime'] = time();
|
|
|
$data['status'] = 0;
|
|
|
+ $data['from'] = ($from == 'all') ? 1 : 2; //all=1,bufen=2
|
|
|
|
|
|
|
|
|
//开启事务
|