public function handle($request, Clousure $next) { if (!userAuth::check()) { return redirect::action('topm_ctl_passport@signin'); } return $next($request); }
public function handle($request, Clousure $next) { if (userAuth::check()) { return redirect::route('wap.home'); } return $next($request); }
/** * 资讯保存 **/ public function saveInfo() { $userId = userAuth::id(); //$postData =utils::_filter_input(input::get()); $postData = input::get(); $postData['user_id'] = $userId; $postData['modified'] = time(); $postData['pubtime'] = time(); $postData['ifpub'] = 0; $postData["platform"] = 'pc'; $userName = app::get('sysuser')->model('account'); $infoName = $userName->getList(login_account, array('user_id' => $userId)); $postData['source'] = $infoName[0]['login_account']; $postData["article_logo"] = $postData["article_logo"][0]; try { $userMdlAddr = app::get('sysinfo')->model('article'); $userMdlAddr->save($postData); } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } catch (\LogicException $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } $url = url::action('topc_ctl_member_info@publishInfo'); $msg = app::get('topc')->_('添加成功'); return $this->splash('success', $url, $msg); }
public function __commonData($filter) { //$filter = input::get(); $promotionInfo = app::get('topm')->rpcCall('promotion.promotion.get', array('promotion_id' => $filter['promotion_id'])); if ($promotionInfo['valid']) { if (!$filter['pages']) { $filter['pages'] = 1; } $pageSize = 20; $params = array('page_no' => $pageSize * ($filter['pages'] - 1), 'page_size' => $pageSize, 'fields' => 'item_id,shop_id,title,image_default_id,price'); //获取促销商品列表 $promotionItem = $this->__promotionItemList($promotionInfo, $params); $count = $promotionItem['total_found']; $promotionItemList = $promotionItem['list']; if (userAuth::check()) { $pagedata['nologin'] = 1; } //处理翻页数据 $current = $filter['pages'] ? $filter['pages'] : 1; $filter['pages'] = time(); if ($count > 0) { $total = ceil($count / $pageSize); } $pagedata['pagers'] = array('link' => url::action('topm_ctl_promotion@getPromotionItem', $filter), 'current' => $current, 'total' => $total, 'token' => $filter['pages']); $pagedata['promotionInfo'] = $promotionItem['promotionInfo']; $pagedata['promotionItemList'] = $promotionItemList; $pagedata['count'] = $count; $pagedata['title'] = $promotionItem['promotionInfo']['promotion_tag']; $pagedata['promotiontype'] = $promotionInfo['promotion_type']; } else { return abort(404); } return $pagedata; }
public function ajaxCouponData() { $filter = input::get(); if (!$filter['pages']) { $filter['pages'] = 1; } $pageSize = 10; $params = array('page_no' => $pageSize * ($filter['pages'] - 1), 'page_size' => $pageSize, 'fields' => '*', 'user_id' => userAuth::id()); $couponListData = app::get('topm')->rpcCall('user.coupon.list', $params, 'buyer'); $count = $couponListData['count']; $couponList = $couponListData['coupons']; //处理翻页数据 $current = $filter['pages'] ? $filter['pages'] : 1; $filter['pages'] = time(); if ($count > 0) { $total = ceil($count / $pageSize); } $pagedata['pagers'] = array('link' => url::action('topm_ctl_member_coupon@couponList', $filter), 'current' => $current, 'total' => $total, 'token' => $filter['pages']); $pagedata['couponList'] = $couponList; $pagedata['count'] = $count; $pagedata['action'] = 'topm_ctl_member_coupon@couponList'; if (input::get('json')) { $data['html'] = view::make('topm/member/coupon/list.html', $pagedata)->render(); $data['pagers'] = $pagedata['pagers']; $data['success'] = true; return response::json($data); exit; } return view::make('topm/member/coupon/list.html', $pagedata); }
public function index() { $userInfo = userAuth::getUserInfo(); $params["user_id"] = $userInfo["userId"]; $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $pagedata["shopInfo"] = $shopInfo; $pagedata['action'] = 'topc_ctl_member_configCenter@index'; $this->action_view = "configCenter/configCenter.html"; return $this->output($pagedata); }
public function index() { $userId = userAuth::id(); $params["user_id"] = $userId; $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $shopnotice = app::get("sysshop")->model("shop_notice")->getList("*", array("shop_id" => $shopInfoGet["shop_id"]), 0, -1, "is_read asc"); $pagedata['shopnotice'] = $shopnotice; $pagedata['action'] = 'topc_ctl_member_notice@index'; $this->action_view = "notice/index.html"; return $this->output($pagedata); }
public function testRequest() { $username = '******'; for ($i = 0; $i < 4000; $i++) { $userInfo['account'] = $username . $i; $userInfo['password'] = '******'; $userInfo['pwd_confirm'] = 'demo123'; $userId = userAuth::signUp($userInfo['account'], $userInfo['password'], $userInfo['pwd_confirm']); echo "注册{$userInfo['account']},成功!\n"; } }
public function save_sample() { $userId = userAuth::id(); $params["user_id"] = $userId; $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); if (!$userId) { $url = url::action('topc_ctl_passport@signin'); return $this->splash('error', $url); } $data = $_POST; /*if(strtotime($data['ceshi'])<strtotime($data['about_time'])){ return $this->splash('error',null, app::get('topc')->_('看样时间不可以大于截止时间')); }*/ $sysshoppubt_sample_model = app::get('sysshoppubt')->model('sample'); $stan = $sysshoppubt_sample_model->getList('seegoods_id', array('shop_id' => $data['shop_id'], 'user_id' => $shopInfoGet['shop_id'], 'standard_id' => $data['standard_id'])); $bid = $sysshoppubt_sample_model->getList('seegoods_id', array('shop_id' => $data['shop_id'], 'user_id' => $shopInfoGet['shop_id'], 'bidding_id' => $data['bidding_id'])); $tend = $sysshoppubt_sample_model->getList('seegoods_id', array('shop_id' => $data['shop_id'], 'user_id' => $shopInfoGet['shop_id'], 'tender_id' => $data['tender_id'])); if (!$stan && !$bid && !$tend) { /*$user = app::get('sysuser')->model('user'); $username = $user->getRow('user_name',array('user_id'=>$userId));*/ $data['user_name'] = $shopInfoGet['shop_name']; $data['user_id'] = $shopInfoGet['shop_id']; $data['create_time'] = time(); $data['about_time'] = strtotime($data['about_time']); $sysshoppubt_sample_model->save($data); if ($data['type'] == 0) { $total = $sysshoppubt_sample_model->count(array('standard_id' => $data['standard_id'])); $sql = "update sysshoppubt_sprodrelease set attendcount='" . $total . "' where standard_id=" . $data['standard_id']; $db = app::get('sysshoppubt')->database(); $db->exec($sql); return $this->splash('success', null, app::get('topc')->_('参加成功')); } elseif ($data['type'] == 2) { $total = $sysshoppubt_sample_model->count(array('tender_id' => $data['tender_id'])); $sql = "update sysshoppubt_tender set attendcount='" . $total . "' where tender_id=" . $data['tender_id']; $db = app::get('sysshoppubt')->database(); $db->exec($sql); return $this->splash('success', null, app::get('topc')->_('参加成功')); } elseif ($data['type'] == 1) { $total = $sysshoppubt_sample_model->count(array('bidding_id' => $data['bidding_id'])); $sql = "update sysshoppubt_biddings set attendcount='" . $total . "' where bidding_id=" . $data['bidding_id']; $db = app::get('sysshoppubt')->database(); $db->exec($sql); return $this->splash('success', null, app::get('topc')->_('参加成功')); } } else { return $this->splash('error', null, app::get('topc')->_('您已提交申请,请等待!')); } }
public function index() { $trandeid = intval(input::get('trande_id')); # code... $trandeItem = app::get("sysshoppubt")->model("tender")->getRow("*", array("trande_id" => $trandeid)); $trandeItemList = app::get("sysshoppubt")->model("standard_item")->getList("*", array("uniqid" => $trandeItem['uniqid'])); $pagedata["requireItem"] = $trandeItem; $pagedata["itemList"] = $trandeItemList; if (userAuth::check()) { $pagedata['nologin'] = 1; } $article_id = "122"; $artList = app::get("syscontent")->model("article")->getList("*", array('article_id' => $article_id)); $pagedata["tender"] = $artList[0]['content']; return $this->page('topc/trande/index.html', $pagedata); }
public function __construct(&$app) { parent::__construct(); kernel::single('base_session')->start(); if (!$this->action) { $this->action = 'index'; } $this->action_view = $this->action . ".html"; // 检测是否登录 if (!userAuth::check()) { redirect::action('topc_ctl_passport@signin')->send(); exit; } $this->limit = 20; $this->passport = kernel::single('topc_passport'); }
/** * @brief 删除店铺收藏 */ function ajaxFavshopDel() { $userId = userAuth::id(); if (!$userId) { return redirect::action('topm_ctl_passport@signin'); } $params['shop_id'] = $_POST['shop_id']; $params['user_id'] = $userId; if (!$params['shop_id']) { return $this->splash('error', null, app::get('topm')->_('店铺id不能为空!')); } if (!app::get('topm')->rpcCall('user.shopcollect.del', $params)) { return $this->splash('error', null, app::get('topm')->_('店铺收藏删除失败!')); } else { return $this->splash('success', null, app::get('topm')->_('店铺收藏删除成功')); } }
public function list_index() { $user_id = userAuth::id(); $pagedata["user_id"] = $user_id; $params["user_id"] = $user_id; $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); if (!$shopInfo) { $pagedata["msg"] = "请先完成企业入住"; $pagedata["success"] = false; } else { $pagedata["msg"] = ""; $pagedata["success"] = true; } // $pagedata['src'] = url::action('topshop_ctl_item@list_index'); $this->action_view = "frame/item_list_frame.html"; return $this->output($pagedata); # code... }
public function mytrade() { $data = input::get('page'); $data -= 1; $data *= 10; $tradeorder = app::get('sysshoppubt')->model('tradeorder'); $tenderenter = app::get('sysshoppubt')->model('tenderenter'); $user_id = userAuth::id(); $params["user_id"] = $user_id; $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $countnum1 = $tradeorder->count(array('user_id' => $shopInfoGet['shop_id'])); $countnum2 = $tenderenter->count(array('tender_man_id' => $shopInfoGet['shop_id'])); $data1 = $data - 10; if ($countnum1 >= $data) { $otherorder = $tradeorder->getList('*', array('user_id' => $shopInfoGet["shop_id"]), $data, 10); } elseif ($countnum1 <= $data && $countnum1 > $data1) { $cha = intval($data) - intval($countnum1); $getcha = intval($countnum1) + 10 - intval($data); $otherorder = $tradeorder->getList('*', array('user_id' => $shopInfoGet["shop_id"]), $data, $getcha); $tenderorder = $tenderenter->getList('*', array('tender_man_id' => $shopInfoGet["shop_id"]), 0, $cha); } elseif ($countnum1 < $data) { $cha = $data - $countnum1; $cha = $cha / 10; $cha = intval($cha) * 10; $tenderorder = $tenderenter->getList('*', array('tender_man_id' => $shopInfoGet["shop_id"]), $cha, 10); } $countarr = array(); $countnum = intval($countnum1) + intval($countnum2); if ($countnum % 10 != 0) { $countnum = $countnum / 10; $countnum = intval($countnum) + 1; } else { $countnum = $countnum / 10; } for ($i = 0; $i < intval($countnum); $i++) { $countarr[$i] = $i + 1; } $pagedata['countnum'] = $countarr; $pagedata['tenderorder'] = $tenderorder; $pagedata['allorder'] = $otherorder; $pagedata['action'] = 'topc_ctl_member_mytrade@mytrade'; $this->action_view = "mytrade/mytrade.html"; return $this->output($pagedata); }
public function createRate() { $tid = input::get('tid'); $tradeFiltr = array('tid' => $tid, 'fields' => 'tid,user_id,buyer_rate,shop_id,status,created_time,end_time,orders.oid,anony,orders.user_id,orders.price,orders.item_id,orders.sku_id,orders.title,orders.pic_path,orders.num'); $tradeInfo = app::get('topm')->rpcCall('trade.get', $tradeFiltr); if ($tradeInfo['buyer_rate'] == '0') { $tradeInfo['is_buyer_rate'] = true; } else { redirect::action('topm_ctl_member@index')->send(); exit; } if ($tradeInfo['user_id'] != userAuth::id()) { redirect::action('topm_ctl_member@index')->send(); exit; } $pagedata['tradeInfo'] = $tradeInfo; $this->action_view = "topm/member/rate/add.html"; return $this->page($this->action_view, $pagedata); }
public function index() { $supplyId = intval(input::get('supply_id')); # code... $type = intval(input::get('type')); # code... if (empty($supplyId)) { return redirect::action('topc_ctl_default@index'); } if (userAuth::check()) { $pagedata['nologin'] = 1; } $supplyItem = app::get("sysspfb")->model("supplyInfo")->getRow("*", array("supply_id" => $supplyId)); $list_image2 = array(); //判断当前供求信息是否为当前登录人发布的 $userId = userAuth::id(); if ($userId == $supplyItem["user_id"]) { $pagedata['myreqsupp'] = 1; } $list_image = explode(",", $supplyItem["list_image"]); foreach ($list_image as $key => $value) { if ($key < count($list_image) - 1) { array_push($list_image2, $value); } } //var_dump($list_image2); $supplyItem['list_image'] = $list_image2; //企业信息 $userid = $supplyItem["user_id"]; $params["user_id"] = $userid; $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $pagedata["requireItem"] = $supplyItem; $pagedata["type"] = $type; $pagedata["shopinfo"] = $shopInfo; //查询是否有询价信息 $enquireinfolist = app::get("sysspfb")->model("enquireinfo")->getList("*", array("reqsupp_id" => $supplyId, "ifrequire" => 1, "user_id" => $userId)); $pagedata["enquireinfolist"] = $enquireinfolist; $this->setLayoutFlag('supply'); // var_dump( $type); return $this->page('topc/items/index.html', $pagedata); }
public function getItemRate() { $userid = userAuth::id(); $itemId = input::get(); if (empty($itemId)) { return ''; } foreach ($itemId as $key => $value) { if ($key == 'standard_id') { $type = 0; } elseif ($key == 'bidding_id') { $type = 1; } elseif ($key == 'tender_id') { $type = 2; } } $info = app::get('sysshoppubt')->model('sprodrelease'); $bid = app::get('sysshoppubt')->model('biddings'); $tend = app::get('sysshoppubt')->model('tender'); $comment = app::get('sysshoppubt')->model('comment'); if ($type == 0) { $infos = $info->getRow('*', array('standard_id' => $itemId['standard_id'])); $id = $itemId['standard_id']; $pagedata['type'] = 0; } elseif ($type == 1) { $infos = $bid->getRow('*', array('bidding_id' => $itemId['bidding_id'])); $pagedata['type'] = 1; $id = $itemId['bidding_id']; } elseif ($type == 2) { $infos = $tend->getRow('*', array('tender_id' => $itemId['tender_id'])); $pagedata['type'] = 2; $id = $itemId['tender_id']; } $pagedata['item_id'] = $id; $pagedata['rowinfo'] = $infos; $pagedata['user_id'] = $userid; $pagedata['user_name'] = userAuth::getLoginName(); $comm = $comment->getList('*', array('shop_id' => $infos['shop_id'], 'item_id' => $id, 'type' => $type, 'is_lock' => 0)); $pagedata['comm'] = $comm; return view::make('topc/comment/rate.html', $pagedata); }
public function doDelete() { if (!input::get('id')) { return $this->splash('error', $url, "没有要删除的内容", true); } $params['id'] = implode(',', input::get('id')); $params['user_id'] = userAuth::id(); try { $result = app::get('topc')->rpcCall('rate.gask.delete', $params, 'buyer'); $msg = '删除失败'; } catch (\LogicException $e) { $result = false; $msg = $e->getMessage(); } if (!$result) { return $this->splash('error', $url, $msg, true); } $url = url::action('topc_ctl_member_consultation@index'); $msg = '删除成功'; return $this->splash('success', $url, $msg, true); }
public function save() { if (!userAuth::id()) { $msg = app::get('topc')->_('请先登录'); return $this->splash('error', null, $msg); } $result = input::get(); $rule = app::get('sysshoppubt')->model('chrule'); $uniq = $rule->getList('uniqid,chrule_id', array('uniqid' => $result['uniqid'])); if ($uniq) { $rule->delete(array('uniqid' => $result['uniqid'])); } $tenderule = app::get('sysshoppubt')->model('tenderule'); $tendetail = app::get('sysshoppubt')->model('detail'); foreach ($result as $key => $value) { $kyeone = split('_', $key); if ($value == 'on') { $get = $tenderule->getRow('category,project,tenderrule_id,type', array('tenderrule_id' => $kyeone[0])); if ($get) { $get['detail'] = $kyeone[2]; $get['uniqid'] = $result['uniqid']; $get['create_time'] = time(); $rule->save($get); } } else { if ($value == 'check') { $get = $tenderule->getRow('category,project,tenderrule_id,type', array('tenderrule_id' => $key)); if ($get) { $get['score'] = $result["a" . $key]; $get['uniqid'] = $result['uniqid']; $get['create_time'] = time(); $rule->save($get); } } else { } } } $msg = app::get('topc')->_('添加成功'); return $this->splash('success', '', $msg); }
public function sendEmailVcode($sendType, $account) { $userId = userAuth::id(); switch ($sendType) { case 'activation': case 'reset': $content = url::action("topc_ctl_member@bindEmail", array('uname' => $account, 'type' => $sendType, 'verify' => md5($userId))); break; case 'forgot': case 'unreset': $content = url::action("topc_ctl_member@unVerifyEmail", array('uname' => $account, 'type' => $sendType, 'verify' => md5($userId))); break; case 'signup': //手机注册 $content = url::action("topc_ctl_passport@findPwdThree", array('uname' => $account, 'type' => $sendType)); break; } if (!userVcode::send_email($sendType, $account, $content)) { return false; } return true; }
public function detail() { if (userAuth::check()) { $pagedata['nologin'] = 1; } $this->setLayoutFlag('product'); $post = input::get(); $params['fields'] = "*"; $params['activity_id'] = $post['a']; $params['item_id'] = $post['g']; $groupItem = app::get('topm')->rpcCall('promotion.activity.item.info', $params); if ($groupItem['activity_info']['release_time'] > time()) { redirect::action('topm_ctl_item@index', array('item_id' => $params['item_id']))->send(); exit; } $pagedata['group_item'] = $groupItem; $pagedata['item'] = app::get('topm')->rpcCall('item.get', array('item_id' => $params['item_id'], 'fields' => 'item_count.sold_quantity,item_count.item_id')); $pagedata['shop'] = app::get('topm')->rpcCall('shop.get', array('shop_id' => $pagedata['group_item']['shop_id'], 'fields' => 'shop_name,shop_id')); $pagedata['now_time'] = time(); $pagedata['shopDsrData'] = $this->__getShopDsr($pagedata['shop']['shop_id']); return $this->page("topm/shop/promotion/activity_detail.html", $pagedata); }
public function save() { $userInfo = userAuth::getUserInfo(); $params["user_id"] = $userInfo["userId"]; $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $catid = $_POST["parentcat"]; $newcat = $_POST["lv3cat"]; $secsortcat = app::get("syscategory")->model('cat')->getRow("*", array("parent_id" => $catid, "cat_name" => "其他")); if ($secsortcat) { try { if ($this->check_cat($catid, $newcat, $shopInfo, $secsortcat)) { $this->saveconfig($catid, $newcat, $shopInfo, $secsortcat); } else { $url = url::action("topc_ctl_member_configcat@index"); return $this->splash('error', $url, app::get('topc')->_('您已经提交,请勿重复操作')); } } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } } else { $secodcat = array("parent_id" => $catid, "cat_name" => "其他", "cat_path" => "," . $catid . ",", "level" => "2", "is_leaf" => true, "disabled" => false, "order_sort" => 999, "modified_time" => time(), "belong" => $shopInfo["shop_id"]); app::get("syscategory")->model('cat')->save($secodcat); $secsortcat = app::get("syscategory")->model('cat')->getRow("*", array("parent_id" => $catid, "cat_name" => "其他")); try { if ($this->check_cat($catid, $newcat, $shopInfo, $secsortcat)) { $this->saveconfig($catid, $newcat, $shopInfo, $secsortcat); } else { $url = url::action("topc_ctl_member_configcat@index"); return $this->splash('error', $url, app::get('topc')->_('您已经提交,请勿重复操作')); } } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } } $url = url::action("topc_ctl_member_configcat@index"); return $this->splash('success', $url, app::get('topc')->_('保存成功')); }
public function bindSignupUser() { $params = input::get(); $verifyCode = $params['verifycode']; $verifyKey = $params['vcodekey']; $loginName = $params['pam_account']['login_name']; $password = $params['pam_account']['login_password']; $confirmedPassword = $params['pam_account']['psw_confirm']; if (!$verifyKey || empty($verifyCode) || !base_vcode::verify($verifyKey, $verifyCode)) { $msg = app::get('topc')->_('验证码填写错误'); return $this->splash('error', null, $msg, true); } try { $userId = userAuth::signUp($loginName, $password, $confirmedPassword); userAuth::login($userId, $loginName); kernel::single('pam_trust_user')->bind(userAuth::id()); $url = url::action('topc_ctl_default@index'); return $this->splash('success', $url, $msg, true); } catch (\Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg, true); } }
public function couponList() { $filter = input::get(); if (!$filter['pages']) { $filter['pages'] = 1; } $pageSize = 10; $params = array('page_no' => $pageSize * ($filter['pages'] - 1), 'page_size' => $pageSize, 'fields' => '*', 'user_id' => userAuth::id()); $couponListData = app::get('topc')->rpcCall('user.coupon.list', $params, 'buyer'); $count = $couponListData['count']; $couponList = $couponListData['coupons']; //处理翻页数据 $current = $filter['pages'] ? $filter['pages'] : 1; $filter['pages'] = time(); if ($count > 0) { $total = ceil($count / $pageSize); } $pagedata['pagers'] = array('link' => url::action('topc_ctl_member_coupon@couponList', $filter), 'current' => $current, 'total' => $total, 'token' => $filter['pages']); $pagedata['couponList'] = $couponList; $pagedata['count'] = $count; $pagedata['action'] = 'topc_ctl_member_coupon@couponList'; $this->action_view = "coupon/list.html"; return $this->output($pagedata); }
public function biddingList() { $data = input::get('page'); $data -= 1; $data *= 10; $biditem = app::get('sysshoppubt')->model('biddings'); $standarditem = app::get('sysshoppubt')->model('standard_item'); $params["user_id"] = userAuth::id(); $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $bidding = $biditem->getList('*', array('shop_id' => $shopInfo['shop_id']), $data, 10); $countnum = $biditem->count(array('shop_id' => $shopInfo['shop_id'])); $countarr = array(); if ($countnum % 10 != 0) { $countnum = $countnum / 10; $countnum = intval($countnum) + 1; } else { $countnum = $countnum / 10; } for ($i = 0; $i < intval($countnum); $i++) { $countarr[$i] = $i + 1; } $pagedata['countnum'] = $countarr; foreach ($bidding as $key => $value) { $advicesum = $standarditem->getList('*', array('uniqid' => $value['uniqid'])); foreach ($advicesum as $key1 => $value1) { $sums += intval($value1['advice']); } $bidding[$key]['advicesum'] = $sums; $bidding[$key]['bidgoods'] = $advicesum; $sums = 0; } $pagedata['bidding'] = $bidding; $pagedata['action'] = 'topc_ctl_member_biddings@biddingList'; $this->action_view = "biddings/biddinglist.html"; return $this->output($pagedata); }
/** * 信任登陆用户名密码设置 */ public function savePwdSet() { $postData = input::get(); $userId = userAuth::id(); //会员信息 $userInfo = userAuth::getUserInfo(); $url = url::action("topc_ctl_member@pwdSet"); if ($userInfo['login_type'] == 'trustlogin') { try { $this->__checkAccount($postData['username']); $data = array('new_pwd' => $postData['new_password'], 'confirm_pwd' => $postData['confirm_password'], 'old_pwd' => $postData['old_password'], 'uname' => $postData['username'], 'user_id' => $userId, 'type' => $userInfo['login_type'] == 'trustlogin' ? "reset" : "update"); app::get('topc')->rpcCall('user.pwd.update', $data, 'buyer'); } catch (\Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg, true); } } else { try { $this->__checkAccount($postData['username']); $data = array('user_name' => $postData['username'], 'user_id' => $userId); app::get('topc')->rpcCall('user.account.update', $data, 'buyer'); } catch (\Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg, true); } } return $this->splash('success', $url, app::get('topc')->_('修改成功'), true); }
private function __getTrade($postdata) { if (isset($postdata['s']) && $postdata['s']) { if ($postdata['s'] == 4) { $status = 'TRADE_FINISHED'; $params['buyer_rate'] = 0; } else { $status = $this->tradeStatus[$postdata['s']]; } } else { $postdata['s'] = 0; } $params['status'] = $status; $params['user_id'] = userAuth::id(); $params['page_no'] = $postdata['pages'] ? $postdata['pages'] : 1; $params['page_size'] = $this->limit; $params['order_by'] = 'created_time desc'; $params['fields'] = 'tid,shop_id,user_id,status,payment,total_fee,itemnum,post_fee,payed_fee,receiver_name,created_time,receiver_mobile,discount_fee,need_invoice,adjust_fee,order.title,order.price,order.num,order.pic_path,order.tid,order.oid,order.aftersales_status,buyer_rate,order.complaints_status,order.item_id,order.shop_id,order.status,activity'; $tradelist = app::get('topm')->rpcCall('trade.get.list', $params); $count = $tradelist['count']; $tradelist = $tradelist['list']; foreach ($tradelist as $key => $row) { $tradelist[$key]['is_buyer_rate'] = false; foreach ($row['order'] as $orderListData) { if (!$orderListData['aftersales_status'] && $row['buyer_rate'] == '0' && $row['status'] == 'TRADE_FINISHED') { $tradelist[$key]['is_buyer_rate'] = true; break; } } unset($tradelist[$key]['order']); $tradelist[$key]['order'][0] = $row['order']; if (!$tradelist[$key]['is_buyer_rate'] && $postdata['s'] == 4) { unset($tradelist[$key]); } } $pagedata['trades'] = $tradelist; $pagedata['pagers'] = $this->__pages($postdata['pages'], $postdata, $count); $pagedata['count'] = $count; $pagedata['title'] = "我的订单"; //标题 $pagedata['status'] = $postdata['s']; //状态 return $pagedata; }
/** * @brief 商品咨询提交 * * @return */ public function commitConsultation() { $post = input::get('gask'); $params['item_id'] = $post['item_id']; $params['content'] = $post['content']; $params['type'] = $post['type']; $params['is_anonymity'] = $post['is_anonymity'] ? $post['is_anonymity'] : 0; if (userAuth::id()) { $params['user_name'] = userAuth::getLoginName(); $params['user_id'] = userAuth::id(); } else { if (!$post['contack']) { return $this->splash('error', $url, "由于您没有登录,咨询请填写联系方式", true); } $params['contack'] = $post['contack']; $params['user_name'] = '游客'; $params['user_id'] = "0"; } try { if ($params['contack']) { $type = kernel::single('pam_tools')->checkLoginNameType($params['contack']); if ($type == "login_account") { throw new \LogicException('请填写正确的联系方式(手机号或邮箱)'); } } $params = utils::_filter_input($params); $result = app::get('topc')->rpcCall('rate.gask.create', $params); $msg = '咨询提交失败'; } catch (\Exception $e) { $result = false; $msg = $e->getMessage(); } if (!$result) { return $this->splash('error', $url, $msg, true); } $url = url::action('topc_ctl_item@index', array('item_id' => $postdata['item_id'])); $msg = '咨询提交成功,请耐心等待商家审核、回复'; return $this->splash('success', $url, $msg, true); }
public function create() { $postData = input::get(); $postData['mode'] = $postData['mode'] ? $postData['mode'] : 'cart'; $cartFilter['mode'] = $postData['mode']; $cartFilter['needInvalid'] = false; $cartFilter['platform'] = 'wap'; $cartInfo = app::get('topm')->rpcCall('trade.cart.getBasicCartInfo', $cartFilter, 'buyer'); // 校验购物车是否为空 if (!$cartInfo) { $msg = app::get('topm')->_("购物车信息为空或者未选择商品"); return $this->splash('false', '', $msg, true); } // 校验购物车是否发生变化 $md5CartInfo = md5(serialize(utils::array_ksort_recursive($cartInfo, SORT_STRING))); if ($postData['md5_cart_info'] != $md5CartInfo) { $msg = app::get('topm')->_("购物车数据发生变化,请刷新后确认提交"); return $this->splash('false', '', $msg, true); } unset($postData['md5_cart_info']); if (!$postData['addr_id']) { $msg .= app::get('topm')->_("请先确认收货地址"); return $this->splash('success', '', $msg, true); } else { $addr = app::get('topm')->rpcCall('user.address.info', array('addr_id' => $postData['addr_id'], 'user_id' => userAuth::id())); list($regions, $region_id) = explode(':', $addr['area']); list($state, $city, $district) = explode('/', $regions); if (!$state) { $msg .= app::get('topm')->_("收货地区不能为空!") . "<br />"; } if (!$addr['addr']) { $msg .= app::get('topm')->_("收货地址不能为空!") . "<br />"; } if (!$addr['name']) { $msg .= app::get('topm')->_("收货人姓名不能为空!") . "<br />"; } if (!$addr['mobile'] && !$addr['phone']) { $msg .= app::get('topm')->_("手机或电话必填其一!") . "<br />"; } if (strpos($msg, '<br />') !== false) { $msg = substr($msg, 0, strlen($msg) - 6); } if ($msg) { return $this->splash('false', '', $msg, true); } } if (!$postData['payment_type']) { $msg = app::get('topm')->_("请先确认支付类型"); return $this->splash('success', '', $msg, true); } else { $postData['payment_type'] = $postData['payment_type'] ? $postData['payment_type'] : 'online'; } //发票信息 if ($postData['invoice']) { foreach ($postData['invoice'] as $key => $val) { $postData[$key] = $val; } unset($postData['invoice']); } //店铺配送方式处理 $shipping = ""; if ($postData['shipping']) { foreach ($postData['shipping'] as $k => $v) { $shipping .= $k . ":" . $v['template_id'] . ";"; if ($v['template_id'] == 0) { if (!$postData['ziti'][$k]['ziti_addr']) { $msg = app::get('topc')->_("您已选择自提,请选择自提地址"); return $this->splash('error', '', $msg, true); } $zitiAddr = app::get('topc')->rpcCall('logistics.ziti.get', array('id' => $postData['ziti'][$k]['ziti_addr'])); $ziti .= $k . ":" . $zitiAddr['area'] . $zitiAddr['addr'] . ";"; } if ($v['template_id'] == '-1') { $msg = app::get('topc')->_("请选择店铺配送方式"); return $this->splash('error', '', $msg, true); } } unset($postData['shipping']); unset($postData['ziti']); } $postData['shipping'] = $shipping; if ($ziti) { $postData['ziti'] = $ziti; } $postData['source_from'] = 'wap'; $obj_filter = kernel::single('topm_site_filter'); $postData = $obj_filter->check_input($postData); $postData['user_id'] = userAuth::id(); $postData['user_name'] = userAuth::getLoginName(); try { $createFlag = app::get('topm')->rpcCall('trade.create', $postData, 'buyer'); } catch (Exception $e) { return $this->splash('error', null, $e->getMessage(), true); } try { if ($postData['payment_type'] == "online") { $params['tid'] = $createFlag; $params['user_id'] = userAuth::id(); $paymentId = kernel::single('topm_payment')->getPaymentId($params); $redirect_url = url::action('topm_ctl_paycenter@index', array('payment_id' => $paymentId, 'merge' => true)); } else { $redirect_url = url::action('topm_ctl_paycenter@index', array('tid' => implode(',', $createFlag))); } } catch (Exception $e) { $msg = $e->getMessage(); $url = url::action('topm_ctl_member_trade@tradeList'); return $this->splash('error', $url, $msg, true); } return $this->splash('success', $redirect_url, '订单创建成功', true); }
private function __getItems($postdata) { $objLibFilter = kernel::single('topm_item_filter'); $params = $objLibFilter->decode($postdata); $params['use_platform'] = '0,2'; //判断自营 自营是1,非自营是0 if ($params['is_selfshop'] == '1') { $pagedata['isself'] = '0'; } else { $pagedata['isself'] = '1'; } //如果不是从分类进入,并且没有关键字搜索则不能进入列表页 $params['search_keywords'] = trim($params['search_keywords']); if (empty($params['cat_id']) && empty($params['search_keywords'])) { return false; } //默认图片 $pagedata['image_default_id'] = app::get('image')->getConf('image.set'); //搜索或者筛选获取商品 $searchParams = $this->__preFilter($params); $searchParams['fields'] = 'item_id,title,image_default_id,price'; $itemsList = app::get('topm')->rpcCall('item.search', $searchParams); //检测是否有参加团购活动 if ($itemsList['list']) { $itemsList['list'] = array_bind_key($itemsList['list'], 'item_id'); $itemIds = array_keys($itemsList['list']); $activityParams['item_id'] = implode(',', $itemIds); $activityParams['status'] = 'agree'; $activityParams['end_time'] = 'bthan'; $activityParams['start_time'] = 'sthan'; $activityParams['fields'] = 'activity_id,item_id,activity_tag,price,activity_price'; $activityItemList = app::get('topc')->rpcCall('promotion.activity.item.list', $activityParams); if ($activityItemList['list']) { foreach ($activityItemList['list'] as $key => $value) { $itemsList['list'][$value['item_id']]['activity'] = $value; $itemsList['list'][$value['item_id']]['price'] = $value['activity_price']; } } } $pagedata['items'] = $itemsList['list']; //根据条件搜索出的商品 //根据条件搜索出最多商品的分类,进行显示渐进式筛选项 $filterItems = app::get('topm')->rpcCall('item.search.filterItems', $params); //渐进式筛选的数据 $pagedata['screen'] = $filterItems; $pagedata['count'] = $itemsList['total_found']; //根据条件搜索到的总数 //已有的搜索条件 $tmpFilter = $params; unset($tmpFilter['pages']); $pagedata['filter'] = $objLibFilter->encode($tmpFilter); //已选择的搜索条件 $pagedata['activeFilter'] = $params; //分页 $pagedata['pagers'] = $this->__pages($params['pages'], $pagedata['count'], $pagedata['filter']); if (userAuth::check()) { $pagedata['nologin'] = 1; } return $pagedata; }