/** * 小店通 */ public function showAction() { //http://amazeui.org/ $type = $this->param('t', ''); if (!$type) { exit('小店通主页不存在'); } switch ($type) { case '1': $sid = intval($this->param('s', 0)); $store = ShopData::getStore($sid); if (!$store) { exit('小店通主页不存在'); } //print_r($store); $cates = ShopData::getStoreCates($store['id']); if ($cates) { foreach ($cates as $cate) { $tmp[$cate['id']] = $cate; } $cates = $tmp; } $goods = ShopData::getStoreGoods($store['id']); if ($goods) { foreach ($goods as $good) { $cates[$good['store_cate_id']]['goods'][] = $good; } } $qr = $this->qrCode($store, 's'); $this->assign('qr', $qr); $this->assign('cates', $cates); $this->assign('info', $store); $tpl = 'Page/store.html'; break; case '2': break; default: break; } $this->display(); }
/** * 定制名片 */ public function orderCardAction() { $currUser = $this->getCurrentUser(); if (ComTool::isAjax()) { if (isset($_POST['captcha'])) { $captcha = trim($this->post('captcha')); if (!ComTool::checkCaptcha($captcha)) { ComTool::ajax(100001, '验证码错误'); } } $nums = intval($this->post('nums', 0)); ComTool::checkEmpty($nums, '请填写您要定制的名片数量'); $name = trim($this->post('name')); ComTool::checkMinMaxLen($name, 1, 16, '收件人姓名1-16字'); $mobile = trim($this->post('mobile')); ComTool::checkEmpty($mobile, '请填写手机号'); if (!ComTool::isMobile($mobile)) { ComTool::ajax(100001, '请填写正确的手机号'); } $addr = trim($this->post('addr')); ComTool::checkMinMaxLen($addr, 1, 64, '收件地址1-64字'); $message = trim($this->post('message')); ComTool::checkMaxLen($message, 100, '留言最多100字'); $data = array('store_id' => $currUser['id'], 'user_name' => $name, 'user_tel' => $mobile, 'user_addr' => $addr, 'nums' => $nums, 'message' => $message, 'total_cost' => '0', 'update_time' => time(), 'create_time' => time(), 'status' => '1'); $res = ShopData::orderCard($data); if ($res === false) { ComTool::ajax(100001, '服务器忙,请刷新重试'); } ComTool::ajax(100000, '操作成功'); } }