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

defined('IN_UQ') or exit('Access Denied'); class bill_uqcms extends control { function __construct() { $this->aid = $_SESSION['admin']['aid']; parent::__construct(); } public function index() { $uq0 = ''; $uq1 = isset($_GET['pay_status'])?$_GET['pay_status']:''; if($uq1){ $uq0 = ' status = '.$uq1.' and '; }elseif($uq1 == '0'){ $uq0 = ' status = 0 and '; } $uq2 = isset($_GET['key'])?$_GET['key']:''; if(!empty($uq2)){ $uq0 = " trade_no =  '".$uq2."'"; } if(!empty($uq0)){ $uq0 = ' where '.rtrim($uq0,' and '); } $uq3 = $this->db->get_all("select * from ".table('admin_pay').$uq0." order by id desc ".$this->limit()); if($uq3){ foreach($uq3 as $uq4=>$uq5){ $uq5['settle_time'] = _date($uq5['settle_time']); $uq5['addtime'] = _date($uq5['addtime']); $uq6[] = $uq5; } $uq7['list'] = $uq6; $this->assign('data', $uq7); } $this->display(); } public function pay_detail() { $uq8 = $this->db->get_one("select count(id) as total from ".table("shop")); $this->assign("shop_num",$uq8['total']); $uq9 = $this->db->get_one("select count(id) as total from ".table('goods')); $this->assign("goods_num",$uq9['total']); $uq10 = $this->db->get_one("select count(id) as total from ".table('admin_pay')); $this->assign("admin_pay_num",$uq10['total']); $this->display(); } public function withdraw() { $uq11 = $_GET['status']??''; $uq0 = ''; if($uq11 == '0'){ $uq0 .= ' status = 0'; }elseif($uq11 == '1'){ $uq0 .= ' status = 1'; }elseif($uq11 == '2'){ $uq0 .= ' status = 2'; } if(!empty($uq0)){ $uq0 = ' where '.rtrim($uq0, ' and '); } $uq3 = $this->db->get_all("select * from ".table('member_withdraw').$uq0." order by id desc ".$this->limit()); if($uq3){ foreach($uq3 as $uq5){ if($uq5['uid'] != '0'){ $uq12[] = $uq5['uid']; }else{ $uq13[] = $uq5['spid']; } } if(isset($uq12)){ $uq14 = implode(',', $uq12); $uq15 = $this->db->get_all("select uid,mobile from ".table("member")." where uid in(".$uq14.")"); if($uq15){ foreach($uq15 as $uq5){ $uq16[$uq5['uid']] = $uq5['mobile']; } } } if(isset($uq13)){ $uq17 = implode(',', $uq13); $uq15 = $this->db->get_all("select id,name from ".table("shop")." where id in(".$uq17.")"); if($uq15){ foreach($uq15 as $uq5){ $uq18[$uq5['id']] = $uq5['name']; } } } foreach($uq3 as $uq4=>$uq5){ if($uq5['spid'] != '0'){ if(isset($uq18[$uq5['spid']])){ $uq5['username'] = $uq18[$uq5['spid']]; } }else{ if(isset($uq16[$uq5['uid']])){ $uq5['username'] = $uq16[$uq5['uid']]; } } $uq5['settle_time'] = _date($uq5['settle_time']); $uq5['addtime'] = _date($uq5['addtime']); $uq6[] = $uq5; } $uq7['list'] = $uq6; $this->assign('data',$uq7); } $this->display(); } public function withdraw_do() { $uq19 = $_GET['id']??false; if($uq19){ $uq20 = $this->db->get_one("select * from ".table('member_withdraw')." where id = ".$uq19); $this->assign('row',$uq20); if($uq20['uid']!='0'){ $uq21 = $this->db->get_one("select uid,mobile,nick from ".table('member')." where uid = ".$uq20['uid']); }else{ $uq21 = $this->db->get_one("select id,mobile,name from ".table('shop')." where id = ".$uq20['spid']); } $this->assign('urow', $uq21); } $this->display(); } function withdraw_save() { if($_POST){ $uq1 = P('status','','0'); if($uq1 == '1'){ $uq22['status'] = '1'; $uq22['settle_time'] = time(); $uq22['settle_code'] = P('pay_admin_code'); $uq22['settle_remark'] = P('pay_admin_remark'); }elseif($uq1 == '2'){ $uq22['status'] = '2'; $uq22['refuse_time'] = time(); $uq22['refuse_reason'] = P('refuse_reason'); }else{ error_json('提交错误'); } $uq19 = P('id', 0); if($uq19){ $uq23 = $this->db->update(table('member_withdraw'), $uq22, 'id = '.$uq19); if($uq23){ right_json(); }else{ error_json('操作失败'); } }else{ error_json('提交错误'); } }else{ error_json('提交错误'); } } function withdraw_del() { $uq19 = $_GET['id']??error_json('提交错误'); $uq23 = $this->db->delete(table('member_withdraw'), 'spid = '.$this->spid." and id = ".$uq19); if($uq23){ right_json(); }else{ error_json('删除错误'); } } } 