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); }
/** * @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); }
public function sendPrice() { # code... $postdata = $_POST; $biddingId = $postdata["bidding_id"]; $shop_id = $postdata["shop_id"]; $zybidding = app::get("sysshoppubt")->model("biddings"); $shopInfo = app::get("sysshop")->model("shop")->getRow("*", array("shop_id" => $shop_id)); $biddingInfo = $zybidding->getRow("*", array("bidding_id" => $biddingId)); $postdata["title"] = $biddingInfo["trading_title"]; $postdata["shop_name"] = $shopInfo["shop_name"]; $userId = userAuth::id(); if (!$userId) { return $this->splash('error', null, "请先登录"); } if ($biddingInfo['is_through'] != 1) { return $this->splash('error', null, "该交易暂未通过审核,出价无效"); } if ($biddingInfo['start_time'] > time()) { return $this->splash('error', null, "竞价暂未开始"); } elseif ($biddingInfo['stop_time'] < time()) { return $this->splash('error', null, "竞价已经结束"); } $params["user_id"] = $userId; $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); if (!$shopInfoGet) { return $this->splash('error', null, "您的账号类型为普通会员,请使用企业账号参与交易!"); } $postdata["user_id"] = $shopInfoGet["shop_id"]; if ($shop_id == $shopInfoGet["shop_id"]) { return $this->splash('error', null, "不可参与自己发布的竞价"); } else { $check = app::get("sysshoppubt")->model("tradeorder")->getRow('*', array('state' => 1, 'bidding_id' => $biddingId)); if (!$check) { $postdata["user_name"] = $shopInfoGet["shop_name"]; $postdata["fixed_price"] = $biddingInfo["fixed_price"]; $postdata["type"] = 1; $postdata["create_time"] = time(); $ensurence = $postdata["ensurence"]; $userInfo = app::get("sysuser")->model("user")->getRow("*", array("user_id" => $userId)); $hjadvance = $userInfo["hjadvance"]; try { $moneyrecoder = app::get("sysshoppubt")->model("moneyrecoder"); $moneyrecoders = $moneyrecoder->getRow('*', array('user_id' => $shopInfoGet['shop_id'], 'item_id' => $biddingId, 'type' => 1)); if (!$moneyrecoders) { if (floatval($hjadvance) >= floatval($ensurence)) { $result = floatval($hjadvance) - floatval($ensurence); $sql = "UPDATE sysuser_user set hjadvance=" . $result . " where user_id=" . $userId; app::get('sysuser')->database()->executeUpdate($sql); $moneyreco = array("user_id" => $userId, "changemoney" => $ensurence, "name" => $shopInfoGet["shop_name"], "types" => 0, "username" => userAuth::getLoginName(), "pay" => 2, "bidding_id" => $biddingId, "create_time" => time()); app::get("sysuser")->model("moneyreco")->save($moneyreco); $str = array("item_id" => $biddingId, "shop_id" => $biddingInfo['shop_id'], "shop_name" => $biddingInfo["shop_name"], "type" => 1, "user_id" => $shopInfoGet['shop_id'], "money" => $ensurence, "create_time" => time()); $moneyrecoder->save($str); } else { return $this->splash('error', null, "您的预存款不足"); } } } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } //存出价订单信息 $postdata['shop_id'] = $_POST["shop_id"]; $postdata["shop_name"] = $shopInfo["shop_name"]; $fixprice = app::get("sysshoppubt")->model("biddings")->getRow('fixed_price', array('bidding_id' => $biddingId)); if ($postdata["totalbid"] > $fixprice['fixed_price']) { $postdata["totalbid"] = $fixprice['fixed_price']; $postdata["state"] = 1; $getall = $zybidding->getRow('*', array('bidding_id' => $biddingId)); $getallold = $getall; $getall['isok'] = 1; try { $zybidding->update($getall, $getallold); } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } } try { app::get("sysshoppubt")->model("tradeorder")->save($postdata); } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } return $this->splash('success', null, "竞价完成"); } else { return $this->splash('error', null, "该项交易已经结束"); } } }
public function tender() { if (!userAuth::id()) { return 0; } $uniqid = input::get('uniqid'); $tender_id = input::get('tender_id'); $user = app::get('sysuser')->model('user'); $recorder = app::get('sysshoppubt')->model('moneyrecoder'); $tender = app::get('sysshoppubt')->model('tender'); $userinfo = $user->getRow('*', array('user_id' => userAuth::id())); $userinfoold = $userinfo; $ensurence = $tender->getRow('*', array('tender_id' => $tender_id)); $userinfo['hjadvance'] -= $ensurence['ensurence']; $params["user_id"] = userAuth::id(); $shopInfoGet = app::get('topc')->rpcCall('shop.get.shopInfo', $params, 'buyer'); $reco['item_id'] = $tender_id; $reco['type'] = 0; $reco['shop_id'] = $ensurence['shop_id']; $reco['shop_name'] = $ensurence['shop_name']; $reco['user_id'] = $shopInfoGet["shop_id"]; $reco['money'] = $ensurence['ensurence']; $reco['create_time'] = time(); $moneyreco = array("user_id" => userAuth::id(), "changemoney" => $ensurence['ensurence'], "name" => $shopInfoGet["shop_name"], "types" => 1, "username" => userAuth::getLoginName(), "pay" => 2, "tender_id" => $tender_id, "create_time" => time()); try { $result = $user->update($userinfo, $userinfoold); $recorder->save($reco); app::get("sysuser")->model("moneyreco")->save($moneyreco); } catch (Exception $e) { $msg = $e->getMessage(); return $msg; } return 1; }
/** * @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); } }
public function signupSuccess() { $loginName = userAuth::getLoginName(); $pagedata['loginname'] = $loginName; $pagedata['next_page'] = input::get('next_page'); return $this->page('topc/passport/signin/success.html', $pagedata); }
/** * 用于指示卖家操作者的标志 * @return array 买家登录用户信息 */ public function operator() { return array('account_type' => 'buyer', 'op_id' => userAuth::id(), 'op_account' => userAuth::getLoginName()); }
/** * @brief 验证登陆密码 * * @return html */ public function CheckSetInfo() { $this->setLayoutFlag('cart'); $userName = userAuth::getLoginName(); $postData = utils::_filter_input(input::get()); $validator = validator::make(['password' => $postData['password']], ['password' => 'required'], ['password' => '密码不能为空!']); if ($validator->fails()) { $messages = $validator->messagesInfo(); foreach ($messages as $error) { return $this->splash('error', null, $error[0]); } } $data['password'] = $postData['password']; try { app::get('topm')->rpcCall('user.login.pwd.check', $data, 'buyer'); } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } $verifyType = $postData['verifyType']; $type = $postData['type']; $url = url::action("topm_ctl_member@setUserInfoOne", array('verifyType' => $verifyType, 'type' => $type)); return $this->splash('success', $url, null); }