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

defined('IN_UQ') or exit('Access Denied'); class shop_uqcms extends control { function __construct() { $this->spid = $_SESSION['shop']['id']; parent::__construct(); } public function base_save() { if($_POST){ $uq0['main_seller'] = $_POST['main_seller']; $uq0['mobile'] = P('mobile', '电话不能为空'); $uq0['email'] = P('email'); $uq0['qq'] = P('qq'); $uq0['ww'] = P('ww'); $uq0['contact'] = P('contact'); $uq0['notice'] = P('notice'); $uq0['intro'] = P('intro'); $uq1 = P('name', '店铺名称不能为空'); $uq0['name'] = $uq1; $uq2 = $this->db->update(table('shop'),$uq0,'id = '.$this->spid); if($uq2){ $_SESSION['shop']['name'] = $uq1; right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } } public function map_save() { $uq0['prov'] = P('prov', '省份不能为空'); $uq0['city'] = P('city', '城市不能为空'); $uq0['dist'] = P('dist', '县区不能为空'); $uq0['address'] = P('address'); $uq0['lng'] = P('lng', '经度不能为空'); $uq0['lat'] = P('lat', '纬度不能为空'); $uq2 = $this->db->update(table('shop'), $uq0, 'id = '.$this->spid); if($uq2){ right_json(); }else{ error_json('保存失败'); } } function return_address_save() { if($_POST){ $uq3['name'] = P('name', '姓名不能为空'); $uq3['mobile'] = P('mobile', '电话不能为空'); $uq4 = P('prov', '省份不能为空'); $uq5 = P('city', '城市不能为空'); $uq6 = P('dist', '县区不能为空'); $uq3['prov'] = $uq4; $uq3['city'] = $uq5; $uq3['dist'] = $uq6; $uq7['prov'] = $uq4; $uq7['city'] = $uq5; $uq7['dist'] = $uq6; $uq8 = $this->module('area')->get_cn($uq7); $uq3['prov_cn'] = $uq8['prov_cn']; $uq3['city_cn'] = $uq8['city_cn']; $uq3['dist_cn'] = $uq8['dist_cn']; $uq3['address'] = P('address', '详细地址不能为空'); $uq3['zip'] = P('zip'); $uq3['explain'] = P('explain'); $uq9 = $this->db->get_one("select id,spid from ".table('shop_address')." where spid = ".$this->spid); if($uq9['id']){ $uq2 = $this->db->update(table('shop_address'), $uq3, 'spid ='.$this->spid); }else{ $uq3['spid'] = $this->spid; $uq3['addtime'] = time(); $uq2 = $this->db->add(table('shop_address'), $uq3); } if($uq2){ right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } } public function service_time_save() { if($_POST){ $uq10 = $this->spid; $uq2 = $this->db->delete(table('shop_service_time'), 'shop_id = '.$uq10); $uq11 = isset($_POST['time'])?$_POST['time']:''; $uq12 = ''; foreach($uq11 as $uq13=>$uq14){ $uq7['shop_id'] = $uq10; if(($uq14['t1'] != '' && $uq14['t2'] != '') || ($uq14['t3'] != '' && $uq14['t4'] != '')){ $t1 = $this->wktime(strtotime($uq14['t1'])); $t2 = $this->wktime(strtotime($uq14['t2'])); $t3 = $this->wktime(strtotime($uq14['t3'])); $t4 = $this->wktime(strtotime($uq14['t4'])); $uq12 .= "(".$uq10.", ".$uq13.", ".$t1.", ".$t2.", ".$t3.", ".$t4."),"; } } if(!empty($uq12)){ $uq12 = rtrim($uq12, ','); $query2 = $this->db->query("insert into ".table("shop_service_time")." (`shop_id`,`week`,`time1`,`time2`,`time3`,`time4`) values ".$uq12.";"); if($uq2 && $query2){ right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } }else{ error_json('提交错误'); } } private function wktime($uq11) { return $uq11 - strtotime(date('Ymd')); } private function daytime($uq16) { $uq11 = strtotime(date('Ymd')); $uq17 = $uq11 + $uq16; return date("H:i", $uq17); } } 