Esempio n. 1
0
 /**
  * 资讯保存
  **/
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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')->_('您已提交申请,请等待!'));
     }
 }
Esempio n. 5
0
 /**
  * @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')->_('店铺收藏删除成功'));
     }
 }
Esempio n. 6
0
 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...
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 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);
 }
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
 public function inreqsupp()
 {
     $userInfo = userAuth::getUserInfo();
     $userId = userAuth::id();
     try {
         $sql = "select seo.user_id,seo.reqsupp_id,seo.ifrequire,ssf.cat_id,ssf.cat_name,\n                    ssf.variety_name,ssf.name,ssf.tel,ssf.email,ssf.effective_time,'供应' listtype \n                    from sysspfb_enquireinfo seo join sysspfb_supplyInfo ssf on seo.reqsupp_id=ssf.supply_id and ifrequire=1 \n                    where seo.user_id=" . $userId . " \n                    union \n                    select seo.user_id,seo.reqsupp_id,seo.ifrequire,srf.cat_id,srf.cat_name,\n                    srf.variety_name,srf.name,srf.tel,srf.email,srf.effective_time,'求购' listtype \n                    from sysspfb_enquireinfo seo join sysspfb_requireInfo srf on seo.reqsupp_id=srf.require_id and ifrequire=2 \n                    where seo.user_id=" . $userId;
         $reqsupplist = app::get("base")->database()->executeQuery($sql)->fetchAll();
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     } catch (\LogicException $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $pagedata['reqsupplist'] = $reqsupplist;
     // $pagedata['enquireCounts'] = $count;
     // $pagedata['infoName'] = $infoName[0]['login_account'];
     // $pagedata['action'] = 'topc_ctl_member_enquireinfo@enquire';
     $this->action_view = "enquire/inreqsuppinfo.html";
     return $this->output($pagedata);
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
 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);
 }
Esempio n. 14
0
 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;
 }
Esempio n. 15
0
 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);
     }
 }
Esempio n. 16
0
 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);
 }
Esempio n. 17
0
 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);
 }
Esempio n. 18
0
 /**
  * @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);
 }
Esempio n. 19
0
 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);
 }
Esempio n. 20
0
 public function getZitiList()
 {
     $postData = input::get();
     $params['user_id'] = userAuth::id();
     $params['addr_id'] = $postData['addr_id'];
     $params['fields'] = "area";
     $addrInfo = app::get('topc')->rpcCall('user.address.info', $params);
     $area = explode(':', $addrInfo['area']);
     $area = implode(',', explode('/', $area[1]));
     $pagedata['data'] = app::get('topc')->rpcCall('logistics.ziti.list', array('area_id' => $area));
     $pagedata['ziti_id'] = $postData['ziti_id'];
     return view::make('topc/checkout/ziti.html', $pagedata)->render();
 }
Esempio n. 21
0
 public function SaveRequireGoods()
 {
     $userId = userAuth::id();
     $postData = utils::_filter_input(input::get());
     if ($postData['price_method'] == null || $postData['price_method'] === "") {
         return $this->splash('error', "", "请填写价格方式");
     }
     if ($postData['cat_id'] == null || $postData['cat_id'] === "" || $postData['cat_id'] === "null") {
         return $this->splash('error', "", "请把所有类别填写完整");
     }
     if ($postData['countnum'] == null || $postData['countnum'] === "") {
         unset($postData['countnum']);
     }
     $postData['user_id'] = $userId;
     $postData['create_time'] = time();
     $postData['approve_stats'] = false;
     $postData['show_stats'] = false;
     $postData['product_intro'] = $_POST["product_intro"];
     $listimage = $postData['list_image'];
     $images = "";
     if (count($listimage) > 0) {
         $postData['image_default_id'] = $listimage[0];
     }
     foreach ($listimage as $key => $value) {
         $images .= $value . ",";
     }
     $postData['list_image'] = $images;
     try {
         $userMdlAddr = app::get('sysspfb')->model('requireInfo');
         $count = $userMdlAddr->count(array('user_id' => $userId));
         $params["user_id"] = $userId;
         $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer');
         if ($count >= $shopInfo["qiugou_count"]) {
             $url = url::action('topc_ctl_member_supplyman@wantgoods');
             $msg = app::get('topc')->_('您发布的求购数量已近超过平台方的规定额度,请联系平台方增加最大发布限额!');
             return $this->splash('error', $url, $msg);
         }
         $userMdlAddr->save($postData);
         $params["user_id"] = $userId;
         $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer');
     } 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_supplyman@wantgoods');
     $msg = app::get('topc')->_('添加成功');
     return $this->splash('success', $url, $msg);
 }
Esempio n. 22
0
 public function standardList()
 {
     $data = input::get('page');
     $data -= 1;
     $data *= 10;
     $sprodrelease = app::get('sysshoppubt')->model('sprodrelease');
     $tradeorder = app::get('sysshoppubt')->model('tradeorder');
     $params["user_id"] = userAuth::id();
     $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer');
     $standard = $sprodrelease->getList('*', array('shop_id' => $shopInfo['shop_id']), $data, 10);
     $countnum = $sprodrelease->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;
     $pagedata['allorder'] = $standard;
     $pagedata['action'] = 'topc_ctl_member_shoppubt@standardList';
     $this->action_view = "shoppubt/standardList.html";
     return $this->output($pagedata);
 }
Esempio n. 23
0
 public function dopayment()
 {
     $postdata = input::get();
     $payment = $postdata['payment'];
     if (!$payment['pay_app_id']) {
         echo '<meta charset="utf-8"><script>alert("请选择支付方式"); window.close();</script>';
         exit;
     }
     $payment['user_id'] = userAuth::id();
     $payment['platform'] = "wap";
     try {
         app::get('topm')->rpcCall('payment.trade.pay', $payment);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         echo '<meta charset="utf-8"><script>alert("' . $msg . '"); window.close();</script>';
         exit;
     }
     $url = url::action('topm_ctl_paycenter@finish', array('payment_id' => $payment['payment_id']));
     return $this->splash('success', $url, null, true);
 }
Esempio n. 24
0
 /**
  * 设置评价匿名
  */
 public function setAnony()
 {
     $params['rate_id'] = input::get('rate_id');
     try {
         $params['user_id'] = userAuth::id();
         $result = app::get('topc')->rpcCall('rate.set.anony', $params);
     } catch (\LogicException $e) {
         $result = false;
         $msg = $e->getMessage();
     }
     if (!$result) {
         return $this->splash('error', $url, $msg, true);
     }
     $url = url::action('topc_ctl_member_rate@index');
     $msg = '设置成功';
     return $this->splash('success', $url, $msg, true);
 }
Esempio n. 25
0
 public function wish()
 {
     $data = input::get();
     $userid = userAuth::id();
     $shop = app::get('sysshop')->model('shop');
     $shopinfo = $shop->getRow('*', array('shop_id' => $data['shop_id']));
     $params["user_id"] = $userid;
     $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer');
     if ($shopInfoGet['shop_id'] != $data['shop_id']) {
         $arr['bidding_id'] = $data['bidding_id'];
         $arr['user_id'] = $shopInfoGet['shop_id'];
         $arr['user_name'] = $shopInfoGet['shop_name'];
         $arr['shop_id'] = $data['shop_id'];
         $arr['shop_name'] = $shopinfo['shop_name'];
         $arr['state'] = 3;
         $arr['create_time'] = time();
         $arr['title'] = $data['title'];
         $tradeorder = app::get('sysshoppubt')->model('tradeorder');
         try {
             $tradeorder->save($arr);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             return $msg;
         }
     }
     return 1;
 }
Esempio n. 26
0
 public function aftersalesDetail()
 {
     $this->setLayoutFlag('order_detail');
     $params['aftersales_bn'] = input::get('id');
     $params['user_id'] = userAuth::id();
     $tradeFields = 'trade.status,trade.shop_id,trade.receiver_name,trade.user_id,trade.receiver_state,trade.receiver_city,trade.receiver_district,trade.receiver_address,trade.receiver_mobile,trade.receiver_phone';
     $params['fields'] = 'aftersales_bn,aftersales_type,reason,sendback_data,sendconfirm_data,description,shop_explanation,admin_explanation,evidence_pic,created_time,oid,tid,num,progress,status,sku,' . $tradeFields;
     $result = app::get('topm')->rpcCall('aftersales.get', $params);
     $result['evidence_pic'] = $result['evidence_pic'] ? explode(',', $result['evidence_pic']) : null;
     $result['sendback_data'] = $result['sendback_data'] ? unserialize($result['sendback_data']) : null;
     $result['sendconfirm_data'] = $result['sendconfirm_data'] ? unserialize($result['sendconfirm_data']) : null;
     if ($result['sendback_data']['corp_code'] && $result['sendback_data']['corp_code'] != "other") {
         $logiData = explode('-', $result['sendback_data']['corp_code']);
         $result['sendback_data']['corp_code'] = $logiData[0];
         $result['sendback_data']['logi_name'] = $logiData[1];
         if ($result['sendback_data']['logi_no'] && $result['sendback_data']['corp_code']) {
             try {
                 $tracker = app::get('topm')->rpcCall('logistics.tracking.get.hqepay', array('logi_no' => $result['sendback_data']['logi_no'], 'corp_code' => $result['sendback_data']['corp_code']));
             } catch (Exception $e) {
             }
             rsort($tracker);
             $pagedata['tracker'] = $tracker;
         }
     }
     if ($result['sendconfirm_data']['corp_code'] && $result['sendconfirm_data']['corp_code'] != "other") {
         $logiData = explode('-', $result['sendconfirm_data']['corp_code']);
         $result['sendconfirm_data']['corp_code'] = $logiData[0];
         $result['sendconfirm_data']['logi_name'] = $logiData[1];
         if ($result['sendconfirm_data']['logi_no'] && $result['sendconfirm_data']['corp_code']) {
             try {
                 $tracker = app::get('topm')->rpcCall('logistics.tracking.get.hqepay', array('logi_no' => $result['sendconfirm_data']['logi_no'], 'corp_code' => $result['sendconfirm_data']['corp_code']));
             } catch (Exception $e) {
             }
             rsort($tracker);
             $pagedata['sendTracker'] = $tracker;
         }
     }
     $pagedata['info'] = $result;
     if ($result['progress'] == '1') {
         //快递公司代码
         $params['fields'] = "corp_code,corp_name";
         $corpData = app::get('topm')->rpcCall('logistics.dlycorp.get.list', $params);
         $pagedata['corpData'] = $corpData['data'];
         $pagedata['aftersales_bn'] = $params['aftersales_bn'];
     }
     $pagedata['title'] = "售后详情";
     return $this->page('topm/member/aftersales/detail.html', $pagedata);
 }
Esempio n. 27
0
 public function checkmoney()
 {
     $data = input::get();
     $userid = userAuth::id();
     if (!$userid) {
         return 4;
     }
     $params["user_id"] = userAuth::id();
     $shopInfo = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer');
     $recoder = app::get('sysshoppubt')->model('moneyrecoder');
     $user = app::get('sysuser')->model('user');
     $tenderenter = app::get('sysshoppubt')->model('tenderenter');
     $tenders = app::get('sysshoppubt')->model('tender');
     $tenderall = $tenders->getRow('*', array('tender_id' => $data['tender_id']));
     if ($tenderall['start_time'] > time()) {
         return 6;
     } elseif ($tenderall['stop_time'] < time()) {
         return 7;
     }
     if ($tenderall['shop_id'] == $shopInfo['shop_id']) {
         return 3;
     } else {
         $checks = $tenderenter->getList('*', array('tender_man_id' => $shopInfo['shop_id'], 'tender_id' => $data['tender_id']));
         if (!$checks) {
             $recomoney = $recoder->getRow('*', array('shop_id' => $data['shop_id'], 'type' => 0, 'item_id' => $data['tender_id'], 'user_id' => $shopInfo["shop_id"]));
             if ($recomoney) {
                 return 5;
             }
             $usermoney = $user->getRow('hjadvance', array('user_id' => $userid));
             $ensurence = $tenders->getRow('ensurence', array('tender_id' => $data['tender_id']));
             if (floatval($usermoney['hjadvance']) >= floatval($ensurence['ensurence'])) {
                 return 1;
             } else {
                 return 0;
             }
         } else {
             return 2;
         }
     }
 }
Esempio n. 28
0
 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;
 }
Esempio n. 29
0
 /**
  * 信任登陆用户名密码设置
  */
 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);
 }
Esempio n. 30
0
 /**
  * @brief 商品咨询提交
  *
  * @return
  */
 public function commitConsultation()
 {
     $sa = kernel::single('desktop_user');
     $consave = app::get('sysshoppubt')->model('consultation');
     $post = input::get('gask');
     $post['modified_time'] = intval($post['modified_time']);
     $post['is_anonymity'] = intval($post['is_anonymity']);
     $post['created_time'] = time();
     $post['author'] = $sa->get_login_name();
     $post['author_id'] = $sa->get_id();
     $post['is_reply'] = intval($post['is_reply']);
     $post['is_anonymity'] = $post['is_anonymity'] ? $post['is_anonymity'] : 0;
     if (userAuth::id()) {
         $post['user_name'] = userAuth::getLoginName();
         $post['be_reply_id'] = userAuth::id();
     } else {
         if (!$post['contack']) {
             return $this->splash('error', $url, "由于您没有登录,咨询请填写联系方式", true);
         }
         $post['user_name'] = '游客';
         $post['be_reply_id'] = "0";
     }
     try {
         if ($post['contack']) {
             $type = kernel::single('pam_tools')->checkLoginNameType($params['contack']);
             if ($type != "login_account") {
                 throw new \LogicException('请填写正确的联系方式(手机号或邮箱)');
             }
         }
         $consave->save($post);
         $result = true;
     } catch (\Exception $e) {
         $result = false;
         $msg = $e->getMessage();
     }
     if (!$result) {
         return $this->splash('error', null, $msg);
     } else {
         $msg = '咨询提交成功,请耐心等待企业审核、回复';
         return $this->splash('success', null, $msg);
     }
 }