<?php
/**
 * [UQcms System] Copyright uqcms.com
 * QQ: 2200631718
 * Author: gj.name
 * This is NOT a freeware
*/
defined('IN_UQ') or exit('Access Denied'); class express_uqcms extends control { public function index(){ $page = isset($_GET['page'])?$_GET['page']:'1'; $page_size = isset($_GET['page_size'])?$_GET['page_size']:'20'; $wsql = ''; $pay_status = isset($_GET['pay_status'])?$_GET['pay_status']:''; if($pay_status){ $wsql = ' pay_status = '.$pay_status.' and '; }elseif($pay_status == '0'){ $wsql = ' pay_status = 0 and '; } $key = isset($_GET['key'])?$_GET['key']:''; if(!empty($key)){ $wsql = " id =  '".$key."'"; } if(!empty($wsql)){ $wsql = ' where '.rtrim($wsql,' and '); } $rall = $this->db->get_all("select * from ".table('express').$wsql." order by id desc  limit ".($page-1)*$page_size.",".$page_size); if($rall){ foreach($rall as $v){ $v['addtime'] = _date($v['addtime']); $list[] = $v; } $data['list'] = $list; $total = $this->db->get_one("select count(id) as total from ".table('express').$wsql); if($total['total'] > $page_size){ $data['page'] = $this->uqcms_page(array('page'=>$page,'page_size'=>$page_size,'total'=>$total['total'])); } $this->assign('data', $data); } $this->display(); } function edit(){ $this->display(); } function save(){ if($_POST){ $setarr['shop_id'] = P('shop_id', '', '0'); $setarr['sender_name'] = P('sender_name'); $setarr['sender_mobile'] = P('sender_mobile'); $setarr['sender_address'] = P('sender_address'); $setarr['receiver_name'] = P('receiver_name'); $setarr['receiver_mobile'] = P('receiver_mobile'); $setarr['receiver_address'] = P('receiver_address'); $setarr['pay_price'] = P('pay_price','','0'); $setarr['order_status'] = P('order_status','','1'); $setarr['status'] = '1'; $setarr['addtime'] = time(); $query = $this->db->add(table('express'), $setarr); if($query){ right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } } function del(){ $id = P('id', '提交错误'); $query = $this->db->delete(table('express'), 'id in ('.$id.')'); if($query){ right_json(); }else{ error_json('删除失败'); } } }