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

defined('IN_UQ') or exit('Access Denied'); class express_uqcms extends control { function __construct() { $this->aid = $_SESSION['admin']['aid']; parent::__construct(); } function index() { $uq0 = $_GET['status']??''; $uq1 = ''; if($uq0){ $uq1 .= ' status = '.$uq0.' '; }elseif($uq0 == '0'){ $uq1 .= ' status = 0 '; } $uq2 = $_GET['spid']??''; if($uq2){ $uq1 .= ' spid = '.$uq2.' '; }elseif($uq2 == '0'){ $uq1 .= ' spid = 0 '; } if(!empty($uq1)){ $uq1 = ' where '.rtrim($uq1, ' and '); } $uq3 = $this->db->get_all("select * from ".table('shop_express_tpl').$uq1." order by addtime desc"); if($uq3){ foreach($uq3 as $uq4){ $uq5[] = $uq4['spid']; } $uq6 = implode(',', $uq5); $uq7 = $this->db->get_all("select * from ".table('shop')." where id in (".$uq6.")"); if($uq7){ foreach($uq7 as $uq4){ $uq8[$uq4['id']] = $uq4['name']; } } foreach($uq3 as $uq4){ if(isset($uq8[$uq4['spid']])){ $uq4['shop_name'] = $uq8[$uq4['spid']]; } $uq4['addtime'] = _date($uq4['addtime']); $uq9[] = $uq4; } $uq10['list'] = $uq9; $this->assign('data', $uq10); } $this->display(); } function status() { $uq11 = P('id', '提交错误'); $uq12 = $this->db->get_one("select id,status from ".table('shop_express_tpl')." where id = ".$uq11); if($uq12['id'] && ($uq12['status'] == '1')){ $uq3 = $this->db->update(table('shop_express_tpl'), ['status'=>'0'], 'id = '.$uq11); }elseif($uq12['id'] && ($uq12['status'] == '0')){ $uq3 = $this->db->update(table('shop_express_tpl'), ['status'=>'1'], 'id = '.$uq11); } if($uq3){ right_json(); }else{ error_json('设置失败'); } } function del() { $uq11 = P('id', '提交错误'); $uq12 = $this->db->get_one("select * from ".table('shop_express_tpl')." where id = ".$uq11); if($uq12['id']){ $this->db->autocommit(); $q1 = $this->db->delete(table('shop_express_tpl'), 'id = '.$uq12['id']); $q2 = $this->db->delete(table('shop_express_price'), 'tid = '.$uq12['id']); $q3 = $this->db->delete(table('shop_express_area'), 'tid = '.$uq12['id']); if($q1 && $q2 && $q3){ $this->db->commit(); right_json(); }else{ $this->db->rollback(); error_json('删除失败'); } } } public function express() { $uq10 = $this->db->get_all("select * from ".table('express_type')." order by id asc"); $this->assign('data',$uq10); $this->display(); } public function express_edit() { $uq11 = $_GET['id']??false; if($uq11){ $uq12 = $this->db->get_one("select * from ".table('express_type')." where id = ".$uq11." order by id desc"); if(!empty($uq12['param'])){ $uq12['param'] = explode(',',$uq12['param']); } $uq12['pcon'] = unserialize($uq12['pcon']); $this->assign('row',$uq12); } $this->display(); } public function express_save() { $uq14 = !empty($_POST['param'])?$_POST['param']:''; if(!empty($uq14)){ $uq15['pcon'] = serialize($uq14); } $uq15['name'] = P('name', '快递名称不能为空'); $uq15['alias'] = P('alias', '查询别名不能为空'); $uq15['code'] = P('code'); $uq15['desc'] = P('desc'); $uq15['status'] = P('status', '', '0'); $uq11 = P('id', false); if($uq11){ $uq3 = $this->db->update(table('express_type'), $uq15, 'id = '.$uq11); }else{ $uq3 = $this->db->add(table('express_type'), $uq15); } if($uq3){ cache::del('config/express_type'); right_json(); }else{ error_json('保存失败'); } } public function express_del() { $uq11 = P('id', '提交编号错误'); $uq3 = $this->db->delete(table('express_type'), 'id = '.$uq11); if($uq3){ cache::del('config/express_type'); right_json(); }else{ error_json(); } } } 