~~~
//充值接口
public function addbalance(){
$post = input('post.');
if(!$post){
$this->error('参数错误!');
}
if(!$post['pay_type'] || !$post['bpprice']){
return WPreturn('参数错误!',-1);
}
if($post['bpprice'] < getconf('userpay_min') || $post['bpprice'] > getconf('userpay_max')){
return WPreturn('单笔入金金额在'.getconf('userpay_min').'-'.getconf('userpay_max').'之间',-1);
}
$uid = $this->uid;
$user = $this->user;
$nowtime = time();
//插入充值数据
$data['bptype'] = 3;
$data['bptime'] = $nowtime;
$data['bpprice'] = $post['bpprice'];
$data['remarks'] = '会员充值';
$data['uid'] = $uid;
$data['isverified'] = 0;
$data['btime'] = $nowtime;
$data['reg_par'] = 0;
$data['balance_sn'] = $uid.$nowtime.rand(111111,999999);
$data['pay_type'] = $post['pay_type'];
$data['bpbalance'] = $user['usermoney'];
$ids = db('balance')->insertGetId($data);
if(!$ids){
return WPreturn('网络异常!',-1);
}
$data['bpid'] = $ids;
$Pay = controller('Pay');
if($data['pay_type']=='paywx'){
return "/api/gupay/index?money=".$post['bpprice']."&bpid=".$data['bpid'];
}
}
~~~