|
@@ -30,11 +30,11 @@ class Money extends Api
|
|
|
//提现
|
|
|
public function scorewithdraw() {
|
|
|
$type = input('type', 0, 'intval'); //类型:1=支付宝,2=微信,3=银行
|
|
|
- $money = input('score', '', 'intval');
|
|
|
+ /*$money = input('score', '', 'intval');
|
|
|
|
|
|
if ($money <= 0) {
|
|
|
- $this->error('请输入正确兑换金额');
|
|
|
- }
|
|
|
+ $this->error('请输入正确兑换积分');
|
|
|
+ }*/
|
|
|
|
|
|
$check = Db::name('user_withdraw')->where('user_id',$this->auth->id)->where('status',0)->find();
|
|
|
if($check){
|
|
@@ -43,24 +43,28 @@ class Money extends Api
|
|
|
|
|
|
//余额查询
|
|
|
$user_money = model('wallet')->getWallet($this->auth->id,'score');
|
|
|
- if ($user_money < $money) {
|
|
|
+ /*if ($user_money < $money) {
|
|
|
$this->error('余额不足');
|
|
|
+ }*/
|
|
|
+ if ($user_money <= 0) {
|
|
|
+ $this->error('积分不足');
|
|
|
}
|
|
|
|
|
|
//查询最低最高提现金额
|
|
|
- $min_withdrawal_money = config('site.min_withdrawal_money') ? config('site.min_withdrawal_money') : 1;
|
|
|
+ /*$min_withdrawal_money = config('site.min_withdrawal_money') ? config('site.min_withdrawal_money') : 1;
|
|
|
$max_withdrawal_money = config('site.max_withdrawal_money') ? config('site.max_withdrawal_money') : 50000;
|
|
|
if ($money < $min_withdrawal_money) {
|
|
|
$this->error('最低提现金额' . $min_withdrawal_money . '元');
|
|
|
}
|
|
|
if ($money > $max_withdrawal_money) {
|
|
|
$this->error('最高提现金额' . $max_withdrawal_money . '元');
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
$data['order_no'] = createUniqueNo('T',$this->auth->id);
|
|
|
$data['user_id'] = $this->auth->id;
|
|
|
- $data['score'] = $money;
|
|
|
+// $data['score'] = $money;
|
|
|
+ $data['score'] = $user_money;
|
|
|
$data['type'] = $type;
|
|
|
$data['realname'] = input('realname','');
|
|
|
$data['banknumber'] = input('banknumber','');
|
|
@@ -78,7 +82,7 @@ class Money extends Api
|
|
|
$this->error('申请兑换失败');
|
|
|
}
|
|
|
|
|
|
- $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,'score',-$money,2,'积分兑换','user_withdraw',$log_id);
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,'score',-$data['score'],2,'积分兑换','user_withdraw',$log_id);
|
|
|
if ($rs_wallet['status'] == false) {
|
|
|
$this->error($rs_wallet['msg']);
|
|
|
Db::rollback();
|