<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */

defined('IN_UQ') or exit('Access Denied'); class account_uqcms extends control { function __construct() { $this->uid = @$_SESSION['user']['uid']; parent::__construct(); } public function del() { $uq0 = P('id/i', '提交错误'); $uq1 = $this->db->delete(table('member_bill'), 'id = '.$uq0.' and uid = '.$this->uid); if($uq1){ right_json(); }else{ error_json('删除失败'); } } public function rechargepay() { $uq2 = P('price/f', '请填写充值金额'); if($uq2 > 0){ $uq2 = _price($uq2); $uq3 = build_order_no(); $uq4 = build_order_no(); $uq5['uid'] = $this->uid; $uq5['pay_type'] = '2'; $uq5['trade_no'] = $uq3; $uq5['order_no'] = $uq4; $uq5['title'] = '账户充值'.$uq2.'元'; $uq5['pay_price'] = $uq2; $uq5['addtime'] = time(); $this->db->add(table('admin_pay'), $uq5); $uq6['uid'] = $this->uid; $uq6['name'] = '充值金额：'.$uq2.''; $uq6['type'] = '2'; $uq6['price'] = $uq2; $uq6['order_no'] = $uq4; $uq6['addtime'] = time(); $this->db->add(table('member_bill'), $uq6); $uq7 = [ 'error'=>'0', 'trade_no'=>$uq3 ]; echo json_encode($uq7); }else{ error_json('充值金额不能小于0'); } } function withdraw_apply_save() { if($_POST){ $uq0 = P('id/i', false); if($uq0){ $uq8 = $this->db->get_one("select * from ".table("member_withdraw")." where uid = ".$this->uid." and id = ".$uq0); if($uq8['id']){ if($uq8['status'] == '1'){ error_json('已经提现成功'); }else{ $uq9 = $this->module('common')->category(['name'=>'bank']); $uq10 = P('type/c', '请选择支付地址'); $uq5['bank'] = $uq9[$uq10]??error_json('不存在银行名称'); $uq5['account'] = P('account', '收款账号不能为空'); $uq5['name'] = P('name', '收款姓名不能为空'); $uq5['status'] = '0'; $uq1 = $this->db->update(table('member_withdraw'), $uq5, "id = ".$uq0); if($uq1){ right_json(); }else{ error_json('提交错误'); } } }else{ error_json('已经提交申请'); } }else{ $uq11 = $this->db->get_one("select uid,price from ".table('member')." where uid = ".$this->uid); $uq2 = P('price/f', '提现金额不能为空'); if($uq2 > '0'){ if(($uq11['price'] - $uq2) >= '0'){ $uq9 = $this->module('common')->category(['name'=>'bank']); $uq10 = P('type/c', '支付银行不能为空'); $uq5['uid'] = $this->uid; $uq5['spid'] = '0'; $uq5['price'] = $uq2; $uq5['surplus'] = $uq11['price'] - $uq2; $uq5['bank'] = $uq9[$uq10]??error_json('不存在银行名称'); $uq5['account'] = P('account', '收款账号不能为空'); $uq5['name'] = P('name', '收款姓名不能为空'); $uq5['remark'] = P('remark'); $uq5['status'] = '0'; $uq5['addtime'] = time(); $this->db->autocommit(); $q1 = $this->db->add(table('member_withdraw'), $uq5); $q2 = $this->db->query("update ".table('member')." SET price = price - ".$uq2." WHERE uid = ".$this->uid); if($q1 && $q2){ $this->db->commit(); right_json(); }else{ $this->db->rollback(); error_json('申请失败'); } }else{ error_json('账户余额不足'); } }else{ error_json('提取金额不能小于0'); } } }else{ error_json('提交错误'); } } } 