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

defined('IN_UQ') or exit('Access Denied'); class express_uqcms extends control { function __construct() { $this->spid = @$_SESSION['shop']['id']; parent::__construct(); } public function save() { if($_POST){ $uq0['spid'] = $this->spid; $uq0['name'] = P('name', '模板名称不能为空'); $uq1 = P('price_type', '0'); $uq0['type'] = $uq1; $uq0['vtype'] = P('vtype', '1'); if($uq1 == '1'){ $uq0['one_num'] = P('default_one_num', '0'); $uq0['one_price'] = P('default_one_price', '0'); $uq0['other_num'] = P('default_other_num', '0'); $uq0['other_price'] = P('default_other_price', '0'); } $uq0['status'] = P('status', '', '0'); $uq2 = P('id', false); if($uq2){ $uq3 = $this->db->update(table('shop_express_tpl'), $uq0, 'id = '.$uq2); }else{ $uq0['addtime'] = time(); $uq3 = $this->db->add(table('shop_express_tpl'), $uq0); $uq2 = $this->db->insert_id(); } if($uq1 == '1'){ $this->db->delete(table('shop_express_price'), 'tid = '.$uq2); $this->db->delete(table('shop_express_area'), 'tid = '.$uq2); $uq4 = P('addr_id', 0); $uq5 = P('one_num', 0); $uq6 = P('one_price', 0); $uq7 = P('other_num', 0); $uq8 = P('other_price', 0); foreach($uq4 as $uq9=>$uq10){ if($uq4[$uq9] != ''){ $uq11['spid'] = $this->spid; $uq11['tid'] = $uq2; $uq11['one_num'] = $uq5[$uq9]?:'1'; $uq11['one_price'] = $uq6[$uq9]?:'0'; $uq11['other_num'] = $uq7[$uq9]?:'2'; $uq11['other_price'] = $uq8[$uq9]?:'0'; $uq11['status'] = '1'; $uq11['addtime'] = time(); $this->db->add(table('shop_express_price'), $uq11); $uq12 = $this->db->insert_id(); unset($uq11); $uq13 = explode(',', $uq4[$uq9]); if($uq13){ foreach($uq13 as $uq10){ $uq14['spid'] = $this->spid; $uq14['tid'] = $uq2; $uq14['eid'] = $uq12; $uq14['area_id'] = $uq10; $this->db->add(table('shop_express_area'), $uq14); unset($uq14); } } } } right_json(); } right_json(); }else{ error_json('保存失败'); } } public function del() { $uq2 = $_POST['id']??error_json('提交错误'); $this->db->autocommit(); $q1 = $this->db->delete(table('shop_express'), 'shop_id = '.$this->spid.' and id = '.$uq2); $q2 = $this->db->delete(table('shop_express_area'), 'shop_id = '.$this->spid.' and pid = '.$uq2); if($q1 && $q2){ $this->db->commit(); right_json(); }else{ $this->db->rollback(); error_json('删除失败'); } } public function get_pro() { $uq16 = $_GET['code']??error_json('快递号不能为空'); $uq17 = $_GET['nu']??error_json('订单号不能为空'); $uq18 = $this->module('express')->get_express_pro($uq16, $uq17); if($uq18){ foreach($uq18 as $uq9=>$uq10){ $uq19[] = array( 'msg'=>$uq10->msg, 'time'=>$uq10->time ); } $this->assign('data',$uq19); } $this->display(); } } 