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

defined('IN_UQ') or exit('Access Denied'); class express_mod extends module { function __construct() { $this->spid = @$_SESSION['shop']['id']; parent::__construct(); } function tpl_list($uq0) { $uq1 = ' spid = '.$this->spid.' and '; if(!empty($uq1)){ $uq1 = ' where '.rtrim($uq1,' and '); } $uq2 = $this->db->get_all("select * from ".table('shop_express_tpl').$uq1." order by id desc ".$this->limit()); if($uq2){ foreach($uq2 as $uq3){ $uq3['addtime'] = _date($uq3['addtime']); $uq4[] = $uq3; } $uq5['list'] = $uq4; $uq6 = $this->db->get_one("select count(id) as total from ".table('shop_express_tpl').$uq1); $uq5['page'] = $this->page(['total'=>$uq6['total']]); return $uq5; }else{ return false; } } function tpl_one($uq0) { $uq7 = $uq0['id']??false; $uq8 = $this->db->get_all("select * from ".table('area')." where pid = 0"); if($uq8){ foreach($uq8 as $uq3){ $uq9[$uq3['id']] = $uq3; $uq10[] = $uq3; } } if($uq7){ $uq11 = $this->db->get_one("select * from ".table('shop_express_tpl')." where spid = ".$this->spid." and id = ".$uq7); if($uq11['id']){ $uq12 = $this->db->get_all("select * from ".table('shop_express_area')." where tid = ".$uq7); if($uq12){ foreach($uq12 as $uq3){ $uq3['cn'] = $uq9[$uq3['area_id']]['name']; $uq13[$uq3['eid']][] = $uq3; $uq14[$uq3['area_id']] = $uq3['eid']; } } if(isset($uq13)){ foreach($uq13 as $uq15=>$uq3){ foreach($uq3 as $uq16){ $uq17[] = $uq16['area_id']; $uq18[] = $uq16['cn']; } $uq19[$uq15]['id'] = implode(',', $uq17); $uq19[$uq15]['cn'] = implode('、', $uq18); unset($uq17); unset($uq18); } } $uq20 = $this->db->get_all("select * from ".table('shop_express_price')." where tid = ".$uq7); if($uq20){ foreach($uq20 as $uq3){ $uq3['addr'] = $uq13[$uq3['id']]; $uq3['addr_cn'] = $uq19[$uq3['id']]['cn']; $uq3['addr_id'] = $uq19[$uq3['id']]['id']; $uq21[] = $uq3; } } $uq11['plist'] = $uq21; unset($uq10); foreach($uq8 as $uq3){ if(isset($uq14[$uq3['id']])){ $uq3['eid'] = $uq14[$uq3['id']]; } $uq10[] = $uq3; } $uq5['row'] = $uq11; } } $uq5['area'] = $uq10; return $uq5; } function area_list($uq0) { $uq22 = $uq0['pid']??'0'; $uq23 = $this->db->get_all("select * from ".table('shop_express_area')." where shop_id = ".$this->spid); if($uq23){ foreach($uq23 as $uq3){ if($uq22 == $uq3['pid']){ $uq24[$uq3['area_id']] = $uq3['id']; }else{ $uq25[$uq3['area_id']] = $uq3['id']; } } } $uq26 = $this->db->get_all("select * from ".table('area')." where pid = 0"); if($uq26){ foreach($uq26 as $uq3){ if(!isset($uq25[$uq3['id']])){ if(isset($uq24[$uq3['id']])){ $uq3['is_ch'] = '1'; }else{ $uq3['is_ch'] = '0'; } $uq27[] = $uq3; } } $uq4['list'] = $uq27; foreach($uq26 as $uq3){ if(isset($uq24[$uq3['id']])){ $uq28[] = $uq3; } } $uq4['ch_list'] = $uq28; return $uq4; }else{ return false; } } } 