public function login($userData, $vcode = false, &$msg, $type = 'b2c') { $userData = utils::_filter_input($userData); //过滤xss攻击 //快速登录不用验证码 if ($vcode != 'quick') { if (!$vcode || !base_vcode::verify('passport', $vcode)) { $msg = '验证码错误'; return false; } } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = vmc::singleton('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $model = 'members'; $id = 'member_id'; if ($type == 'sellers') { $model = 'sellers'; $id = 'seller_id'; } $account = app::get('pam')->model($model)->getList($id . ',password_account,login_password,createtime', $filter); if (!$account) { $msg = '不存在的用户'; return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account'])); if ($account[0]['login_password'] != $login_password) { $msg = '登录密码错误'; return false; } return $account[0][$id]; }
/** * 认证用户名密码以及验证码等 * * @param array $usrdata 认证提示信息 * * @return bool|int返回认证成功与否 */ public function login($data) { $data = utils::_filter_input($data); $accountId = $this->__verifyLogin($data['uname'], $data['password']); pamAccount::setSession($accountId, trim($data['uname'])); return $rows['account_id']; }
public function seller_login($userData, $vcode = false, &$msg) { $userData = utils::_filter_input($userData); //过滤xss攻击 if (!$vcode || !base_vcode::verify('passport', $vcode)) { $msg = '验证码错误'; return false; } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = vmc::singleton('seller_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']); } $filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']); $account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter); if (!$account) { $msg = '不存在的用户'; return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name'])); if ($account[0]['login_password'] != $login_password) { $msg = '登录密码错误'; return false; } return $account[0]['member_id']; }
public function post_login() { $login_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_passport', 'act' => 'login')); //_POST过滤 $params = utils::_filter_input($_POST); unset($_POST); $account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']); if (empty($params['vcode'])) { $this->splash('error', $login_url, '请输入验证码'); } //尝试登陆 $member_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg); if (!$member_id) { $this->splash('error', $login_url, $msg); } $mdl_members = $this->app->model('members'); $member_data = $mdl_members->getRow('member_lv_id,experience', array('member_id' => $member_id)); if (!$member_data) { $this->splash('error', $login_url, '会员数据异常!'); } $member_data['order_num'] = $this->app->model('orders')->count(array('member_id' => $member_id)); //更新会员数据 $mdl_members->update($member_data, array('member_id' => $member_id)); //设置session $this->user_obj->set_member_session($member_id); //设置客户端cookie $this->bind_member($member_id); $forward = $params['forward']; if (!$forward) { $forward = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_member', 'act' => 'index')); } $this->splash('success', $forward, '登录成功'); }
public function login($userData, $vcode = false, &$msg) { $userData = utils::_filter_input($userData); //过滤xss攻击 if ($vcode && !$this->vcode_verify($vcode)) { $msg = app::get('pam')->_('验证码错误'); return false; } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = kernel::single('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter); if (!$account) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account'])); if ($account[0]['login_password'] != $login_password) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } return $account[0]['member_id']; }
public function post_login() { $login_url = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_passport', 'act' => 'login')); //_POST过滤 $params = utils::_filter_input($_POST); unset($_POST); $account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']); if (empty($params['vcode'])) { $this->splash('error', $login_url, '请输入验证码'); } //尝试登陆 $seller_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg, 'sellers'); if (!$seller_id) { $this->splash('error', $login_url, $msg); } //设置session $this->user_obj->set_seller_session($seller_id); //设置客户端cookie $this->bind_seller($seller_id); $forward = $params['forward']; if (!$forward) { $forward = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_seller', 'act' => 'index')); } $this->splash('success', $forward, '登录成功'); }
public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null) { $request_params = $this->_request->get_params(); $request_params = utils::_filter_input($request_params); $urlFilter = utils::_filter_input($urlFilter); $urlFilter = htmlspecialchars(urldecode($urlFilter)); $_GET['scontent'] = htmlspecialchars($_GET['scontent']); if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) { $urlFilter .= '_' . $_GET['scontent']; } else { $urlFilter = $_GET['scontent']; } if (empty($cat_id) && empty($urlFilter)) { $url = $this->gen_url(array('app' => 'wap', 'ctl' => 'default', 'act' => 'index')); $this->_response->set_redirect($url)->send_headers(); } $oSearch = $this->app->model('search'); $tmp_filter = $oSearch->decode($urlFilter); if ($request_params[5] || $_GET['virtual_cat_id']) { $virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']); } $params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id); $page = $params['page'] ? $params['page'] : $page; $this->pagedata['filter'] = $params['params']; $goodsData = $this->get_goods($params['filter'], $page, $params['orderby']); $screen = $this->screen($cat_id, $params['params']); $this->pagedata['screen'] = $screen['screen']; $this->pagedata['active_filter'] = $screen['active_filter']; $this->pagedata['orderby_sql'] = $params['orderby']; $this->pagedata['showtype'] = $params['showtype']; $this->pagedata['is_store'] = $params['is_store']; $this->pagedata['goodsData'] = $goodsData; if ($tmp_filter['search_keywords'][0]) { $tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]); } //面包屑 $GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id); //搜索关键字 if (isset($tmp_filter['search_keywords'][0])) { $keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]); $this->set_cookie('S[SEARCH_KEY]', $keywords); } //setSeo $this->_set_seo($screen['seo_info']); if (in_array('gallery-index', $this->weixin_share_page)) { $this->pagedata['from_weixin'] = $this->from_weixin; $this->pagedata['weixin']['appid'] = $this->weixin_a_appid; $this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo')); $this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'wap_gallery', 'act' => 'index', 'arg0' => $cat_id, 'full' => 1)); $this->pagedata['weixin']['shareTitle'] = $this->title; $this->pagedata['weixin']['descContent'] = $this->description; } $this->set_tmpl('gallery'); $this->page('wap/gallery/index.html'); }
public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null) { $request_params = $this->_request->get_params(); $urlFilter = utils::_filter_input($urlFilter); $urlFilter = htmlspecialchars(urldecode($urlFilter)); $_GET['scontent'] = htmlspecialchars($_GET['scontent']); if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) { $urlFilter .= '_' . $_GET['scontent']; } else { $urlFilter = $_GET['scontent']; } if (empty($cat_id) && empty($urlFilter)) { $url = $this->gen_url(array('app' => 'site', 'ctl' => 'default', 'act' => 'index')); $this->_response->set_redirect($url)->send_headers(); } $oSearch = $this->app->model('search'); $tmp_filter = $oSearch->decode($urlFilter); if ($request_params[5] || $_GET['virtual_cat_id']) { $virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']); } $params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id); $page = $params['page'] ? $params['page'] : $page; $this->pagedata['filter'] = $params['params']; $goodsData = $this->get_goods($params['filter'], $page, $params['orderby']); $screen = $this->screen($cat_id, $params['params']); $this->pagedata['screen'] = $screen['screen']; $this->pagedata['active_filter'] = $screen['active_filter']; $this->pagedata['orderby_sql'] = $params['orderby']; $this->pagedata['showtype'] = $params['showtype']; $this->pagedata['is_store'] = $params['is_store']; $goodsData = $this->get_marketable($goodsData); $this->pagedata['goodsData'] = $goodsData; // echo $goodsData[0][products][spec_desc][spec_value_id][0]; // exit; if ($tmp_filter['search_keywords'][0]) { $tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]); } //面包屑 $GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id); //搜索关键字 if (isset($tmp_filter['search_keywords'][0])) { $keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]); $this->set_cookie('S[SEARCH_KEY]', $keywords); } //setSeo $this->_set_seo($screen['seo_info']); //设置模板 if ($this->goods_cat_setting['gallery_template']) { $this->set_tmpl_file($this->goods_cat_setting['gallery_template']); //添加模板 } $this->set_tmpl('gallery'); $this->page('site/gallery/index.html'); }
public function up($params) { $params = utils::_filter_input($params); $shopId = $this->__checkAuth($params); $filter['disabled'] = 0; $filter['target_id'] = $shopId; $filter['target_type'] = 'shop'; $filter['url'] = $params['url']; $resultData = app::get('image')->model('images')->update(['image_name' => $params['image_name']], $filter); return $resultData; }
private function arrContentReplace($array) { if (is_array($array)) { foreach ($array as $key => $v) { $array[$key] = $this->arrContentReplace($array[$key]); } } else { $array = strip_tags($array); $array = utils::_filter_input($array); //过滤xss攻击 } return $array; }
public function saveSelfUser() { $postdata = utils::_filter_input(input::get('seller')); $objSeller = kernel::single('sysshop_data_seller'); try { $this->adminlog("添加自营用户[{$postdata['login_account']}]", 1); $objSeller->saveSelf($postdata); } catch (Exception $e) { $this->adminlog("添加自营用户[{$postdata['login_account']}]", 0); $msg = $e->getMessage(); return $this->splash('error', null, $msg); } return $this->splash('success', null, "自营用户添加成功"); }
public function index($fix_brand = false) { $params = utils::_filter_input($_GET); $query_str = $this->_query_str($params); $this->pagedata['query'] = $this->_query_str($params, 0); $params = $this->_params_decode($params); $filter = $params['filter']; if (!$fix_brand && $filter['cat_id']) { $mdl_cat = $this->app->model('goods_cat'); $cat_info = $mdl_cat->dump($filter['cat_id']); if ($cat_info['gallery_setting']['mobile_template']) { $this->set_tmpl_file($cat_info['gallery_setting']['mobile_template']); //设置模板文件 } $this->_info = $cat_info['seo_info']; $this->pagedata['cat_path'] = $mdl_cat->getPath($filter['cat_id']); } elseif ($fix_brand) { $filter['brand_id'] = $fix_brand; } $goods_list = $this->_list($filter, $params['page'], $params['orderby']); $this->pagedata['data_list'] = $goods_list['data']; $this->pagedata['count'] = $goods_list['count']; $this->pagedata['all_count'] = $goods_list['all_count']; $this->pagedata['pager'] = $goods_list['page_info']; $this->pagedata['pager']['token'] = time(); $this->pagedata['pager']['link'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_list', 'act' => 'index', 'full' => 1)) . '?page=' . $this->pagedata['pager']['token'] . ($query_str ? '&' . $query_str : ''); if (!$fix_brand) { $this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_cat($filter['cat_id']); } else { $brand = app::get('b2c')->model('brand')->dump($fix_brand); $this->pagedata['brand'] = $brand; $this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_brand($fix_brand); $this->set_tmpl('brandlist'); //锁定品牌型列表模板 $brand_setting = $brand['brand_setting']; if ($brand_setting['mobile_template']) { $this->set_tmpl_file($brand_setting['mobile_template']); } } if ($this->_request->is_ajax()) { //ajax 请求不经过模板机制 $this->display('mobile/list/index.html'); } else { $this->page('mobile/list/index.html'); } }
public function login_webpos($userData, $vcode = false, &$msg, $post_date = '') { $userData = utils::_filter_input($userData); //过滤xss攻击 //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = kernel::single('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter); if (!$account) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } if (isset($_SESSION['local_store']) && $_SESSION['local_store']['branch_id'] > 0) { $obj_local_store = app::get('ome')->model('branch'); $local_store_list = $obj_local_store->getList('*', array('branch_id' => intval($_SESSION['local_store']['branch_id'])), 0, 1); //$local_store = $obj_local_store->dump(); $local_store = $local_store_list[0]; if ($local_store) { $_SESSION['local_store'] = $local_store; } $obj_member_addrs = app::get('b2c')->model('member_addrs'); $member_addrs = $obj_member_addrs->getList('*', array('member_id' => $account[0]['member_id'], 'local_id' => $local_store['branch_id']), 0, 1); $in_addr_data = $local_store; $in_addr_data['member_id'] = $account[0]['member_id']; unset($in_addr_data['name']); if ($member_addrs[0]) { $in_addr_data['addr_id'] = $member_addrs[0]['addr_id']; } $in_addr_data['addr'] = $in_addr_data['address']; $in_addr_data['name'] = $account[0]['password_account']; $in_addr_data['local_id'] = $in_addr_data['branch_id']; $in_addr_data['tel'] = $in_addr_data['phone']; $in_addr_data['time'] = time(); // print_r($in_addr_data);exit; kernel::single('b2c_member_addrs')->purchase_save_addr($in_addr_data, $in_addr_data['member_id'], $msg); } return $account[0]['member_id']; }
public function doSave($params) { $objMdlFeedback = app::get('sysrate')->model('feedback'); $data['name'] = $params['name']; $data['email'] = $params['email']; $data['tel'] = $params['tel']; $data['question'] = $params['question']; if ($params['oauth']['auth_type'] == 'shop') { $data['seller_id'] = $params['oauth']['account_id']; } if (!$data['seller_id']) { throw new \LogicException('无操作权限,请重新登录'); } $data['shop_id'] = app::get('sysrate')->rpcCall('shop.get.loginId', array('seller_id' => $data['seller_id']), 'seller'); try { //检查数据安全 $data = utils::_filter_input($data); $objMdlFeedback->save($data); } catch (Exception $e) { throw new \LogicException($e->getMessage()); } return true; }
/** * 登录调用的方法. * * @param array $params 认证传递的参数,包含认证类型,跳转地址等 */ public function login($params) { $params['module'] = utils::_filter_input($params['module']); //过滤xss攻击 $auth = pam_auth::instance($params['type']); $auth->set_appid($params['appid']); if (!class_exists($params['module'])) { vmc::singleton('site_router')->http_status(500); } if ($params['module']) { if (class_exists($params['module']) && ($passport_module = vmc::singleton($params['module']))) { if ($passport_module instanceof pam_interface_passport) { $module_uid = $passport_module->login($auth, $auth_data); if ($module_uid) { $auth_data['account_type'] = $params['type']; $auth->account()->update($params['module'], $module_uid, $auth_data); } $log = array('event_time' => time(), 'event_type' => $auth->type, 'event_data' => base_request::get_remote_addr() . ':' . $auth_data['log_data'] . ':' . $_SERVER['HTTP_REFERER']); app::get('pam')->model('log_desktop')->insert($log); if (!$module_uid) { $_SESSION['last_error'] = $auth_data['log_data']; } $_SESSION['type'] = $auth->type; $_SESSION['login_time'] = time(); $params['member_id'] = $_SESSION['account'][$params['type']]; $params['uname'] = $_POST['uname']; foreach (vmc::servicelist('pam_login_listener') as $service) { $service->listener_login($params); } if ($params['redirect'] && $module_uid) { $service = vmc::service('callback_infomation'); if (is_object($service)) { if (method_exists($service, 'get_callback_infomation') && $module_uid) { $data = $service->get_callback_infomation($module_uid, $params['type']); if (!$data) { $url = ''; } else { $url = '?' . utils::http_build_query($data); } } } } if ($_COOKIE['autologin'] > 0) { vmc::singleton('base_session')->set_cookie_expires($_COOKIE['autologin']); //如果自动登录,设置cookie过期时间,单位:分 } if ($_COOKIE['S']['SIGN']['AUTO'] > 0) { $minutes = 10 * 24 * 60; vmc::singleton('base_session')->set_cookie_expires($minutes); } if ($_SESSION['callback'] && !$module_uid) { $callback_url = $_SESSION['callback']; unset($_SESSION['callback']); header('Location:' . urldecode($callback_url)); exit; } else { $url = base64_decode(str_replace('%2F', '/', urldecode($params['redirect']))) . $url; if (!$url) { foreach (vmc::$url_app_map as $key => $value) { $app = current($value); if ($app == 'desktop') { $url = $key; } } } header('Location: ' . $url); exit; } } } else { } } }
/** * @brief 后台企业重置密码 * * @param int $sellerId 重置密码的seller_id * @param string $password 重置的新密码 * * @return bool */ public function resetPwd($sellerId, $data) { $data = utils::_filter_input($data); $accountShopModel = app::get('sysshop')->model('account'); $filter = array('seller_id' => $sellerId); $account = $accountShopModel->getRow('seller_id,login_password', $filter); if (!$account) { throw new \LogicException(app::get('sysshop')->_('修改失败')); } //检查密码合法,是否一致 $this->checkPassport($data['login_password'], $data['psw_confirm']); $pamShopData['login_password'] = pam_encrypt::make(trim($data['login_password'])); $pamShopData['seller_id'] = $sellerId; $pamShopData['modified_time'] = time(); if (!($sellerId = $accountShopModel->save($pamShopData))) { throw new \LogicException(app::get('sysshop')->_('修改失败')); } return true; }
public function save_ecgroup() { if ($_POST) { $params = utils::_filter_input($_POST); unset($_POST); } $mdl_company_extra = app::get('base')->model('company_extra'); $params['ec_group_employees']['uid'] = $this->seller['seller_id']; $params['ec_group_employees']['from'] = '1'; if (!($params['ec_group_employees']['content_id'] = $mdl_company_extra->insert($params['ec_group_employees']))) { $this->splash('error', '', '操作失败'); } $this->splash('success', '', $params['ec_group_employees']); }
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); }
public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null) { $request_params = $this->_request->get_params(); $request_params = utils::_filter_input($request_params); $urlFilter = utils::_filter_input($urlFilter); $urlFilter = htmlspecialchars(urldecode($urlFilter)); $_GET['scontent'] = htmlspecialchars($_GET['scontent']); if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) { $urlFilter .= '_' . $_GET['scontent']; } else { $urlFilter = $_GET['scontent']; } if (empty($cat_id) && empty($urlFilter)) { //$url = $this->gen_url(array('app'=>'wap', 'ctl'=>'default', 'act'=>'index')); //$this->_response->set_redirect($url)->send_headers(); } $oSearch = $this->app->model('search'); $tmp_filter = $oSearch->decode($urlFilter); if ($request_params[5] || $_GET['virtual_cat_id']) { $virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']); } //var_dump($_GET); $params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id); $page = $params['page'] ? $params['page'] : $page; $this->pagedata['filter'] = $params['params']; $goodsData = $this->get_goods($params['filter'], $page, $params['orderby']); $screen = $this->screen($cat_id, $params['params']); $this->pagedata['screen'] = $screen['screen']; $this->pagedata['active_filter'] = $screen['active_filter']; $this->pagedata['orderby_sql'] = $params['orderby']; $this->pagedata['showtype'] = $params['showtype']; $this->pagedata['is_store'] = $params['is_store']; $this->pagedata['goodsData'] = $goodsData; $this->pagedata['cat_id'] = $cat_id; $this->pagedata['scontent'] = $_GET['scontent']; $objCat = app::get('b2c')->model('goods_cat'); $this->pagedata['cur_cat'] = empty($cat_id) ? empty($_GET['scontent']) ? array('cat_name' => '全部商品') : array('cat_name' => str_replace('n,', '', $_GET['scontent'])) : $objCat->getRow('*', array('cat_id' => $cat_id)); if ($tmp_filter['search_keywords'][0]) { $tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]); } //面包屑 $GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id); //搜索关键字 if (isset($tmp_filter['search_keywords'][0])) { $keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]); $this->set_cookie('S[SEARCH_KEY]', $keywords); } $this->goods_cat = $this->pagedata['cur_cat']['cat_name']; //setSeo $this->_set_seo($screen['seo_info']); if (in_array('gallery-index', $this->weixin_share_page)) { $this->pagedata['from_weixin'] = $this->from_weixin; $this->pagedata['weixin']['appid'] = $this->weixin_a_appid; $this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo')); $this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'wap_gallery', 'act' => 'index', 'arg0' => $cat_id, 'full' => 1)); $this->pagedata['weixin']['shareTitle'] = $this->title; $this->pagedata['weixin']['descContent'] = $this->description; } $this->pagedata['catlist'] = $objCat->getList('*', array('parent_id' => 0), $offset = 0, $limit = -1, 'p_order ASC'); //购物车 是否有商品 $oCart = $this->app->model("cart_objects"); $arr = array(); $aData = $oCart->setCartNum($arr); $this->pagedata['cartCount'] = $aData['CART_COUNT']; $cookie = str_replace('n,', '', $_REQUEST['scontent']); if ($cookie) { $search_arr = $_COOKIE['pz_search_history']; $search_arr = json_decode($search_arr); $search_arr[] = $cookie; $search_arr = array_unique($search_arr); $_search_history = json_encode($search_arr); setcookie('pz_search_history', $_search_history, 0, kernel::base_url() . '/'); } if (!$goodsData && $_GET['scontent']) { $url = '/wap/simplesearch.html?find=no'; $this->_response->set_redirect($url)->send_headers(); } else { $this->page('wap/gallery/index.html'); } }
public function findPwdFour() { $postData = utils::_filter_input(input::get()); $userId = $postData['userid']; $account = $postData['account']; $vcodeData = userVcode::getVcode($account, 'forgot'); $key = userVcode::getVcodeKey($account, 'forgot'); if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) { $msg = app::get('topc')->_('页面已过期,请重新找回密码'); return $this->splash('failed', null, $msg, true); } $validator = validator::make(['password' => $postData['password'], 'password_confirmation' => $postData['confirmpwd']], ['password' => 'min:6|max:20|confirmed'], ['password' => '密码长度不能小于6位!|密码长度不能大于20位!|输入的密码不一致!']); if ($validator->fails()) { $messages = $validator->messagesInfo(); foreach ($messages as $error) { throw new LogicException($error[0]); } } $data['type'] = 'reset'; $data['new_pwd'] = $postData['password']; $data['user_id'] = $postData['userid']; $data['confirm_pwd'] = $postData['confirmpwd']; try { app::get('topc')->rpcCall('user.pwd.update', $data, 'buyer'); } catch (Exception $e) { $msg = $e->getMessage(); $url = url::action('topc_ctl_passport@findPwd'); return $this->splash('error', $url, $msg, true); } return view::make('topc/passport/forgot/four.html'); }
public function checkout() { $postData = utils::_filter_input(input::get()); $cartFilter['mode'] = $postData['mode'] ? $postData['mode'] : 'cart'; $pagedata['mode'] = $postData['mode']; /*获取收货地址 start*/ $params['user_id'] = userAuth::id(); $userAddrList = app::get('topc')->rpcCall('user.address.list', $params); $userAddrList = $userAddrList['list']; foreach ($userAddrList as &$addr) { list($regions, $region_id) = explode(':', $addr['area']); $addr['region_id'] = str_replace('/', ',', $region_id); } $pagedata['userAddrList'] = $userAddrList; $params['def_addr'] = 1; $userDefAddr = app::get('topc')->rpcCall('user.address.info', $params); $pagedata['userDefAddr'] = $userDefAddr; /*收货地址 end*/ // 商品信息 $cartFilter['needInvalid'] = false; $cartFilter['platform'] = 'pc'; $cartFilter['user_id'] = userAuth::id(); $cartInfo = app::get('topc')->rpcCall('trade.cart.getCartInfo', $cartFilter, 'buyer'); if (!$cartInfo) { return $this->splash('error', null, app::get('topc')->_('没有勾选购买商品或者商品数据已经失效')); } $isSelfShop = true; foreach ($cartInfo['resultCartData'] as $key => $val) { if ($val['shop_type'] != "self") { $isSelfShop = false; } else { $isSelfShopArr[] = $val['shop_id']; } } $pagedata['isSelfShop'] = $isSelfShop; $pagedata['cartInfo'] = $cartInfo; //用户验证购物车数据是否发生变化 $md5CartInfo = md5(serialize(utils::array_ksort_recursive(app::get('topc')->rpcCall('trade.cart.getBasicCartInfo', $cartFilter, 'buyer'), SORT_STRING))); $pagedata['md5_cart_info'] = $md5CartInfo; $shop_ids = array_keys($pagedata['cartInfo']['resultCartData']); if ($isSelfShop) { $pagedata['dtyList'] = $this->__getDtyList($shop_ids, $isSelfShopArr); } else { $pagedata['dtyList'] = $this->__getDtyList($shop_ids, $isSelfShop); } // 刷新结算页则失效前面选则的优惠券 foreach ($shop_ids as $sid) { $apiParams = array('coupon_code' => '-1', 'shop_id' => $sid); app::get('topc')->rpcCall('trade.cart.cartCouponCancel', $apiParams, 'buyer'); } return $this->page('topc/checkout/index.html', $pagedata); }
/** * 修改密码,需要使用旧密码进行修改,新密码和确认密码需要一致 * * @param int $userId 修改密码的user_id * @param array $data * * @return bool */ public function modifyPwd($data) { $data = utils::_filter_input($data); $pamUserModel = app::get('sysuser')->model('account'); $account = $pamUserModel->getRow('modified_time,createtime,login_password,login_account', array('user_id' => $data['user_id'])); if (!$account) { throw new \LogicException(app::get('sysuser')->_('会员信息有误')); } if ($data['type'] == "update" && $data['old_pwd']) { if (!pam_encrypt::check($data['old_pwd'], $account['login_password'])) { throw new \LogicException(app::get('sysuser')->_('原密码错误')); } } //检查密码合法,是否一致 $this->checkPwd($data['new_pwd'], $data['confirm_pwd']); $pamUserData['login_password'] = pam_encrypt::make($data['new_pwd']); if ($data['uname']) { $type = kernel::single('pam_tools')->checkLoginNameType($data['uname']); $this->checkSignupAccount(trim($data['uname']), $type); $pamUserData['login_account'] = $data['uname']; $pamUserData['login_type'] = 'common'; } $pamUserData['user_id'] = $data['user_id']; $pamUserData['modified_time'] = time(); if (!($userId = $pamUserModel->save($pamUserData))) { throw new \LogicException(app::get('sysuser')->_('修改失败')); } return true; }
public function findPwdFour() { $postData = utils::_filter_input(input::get()); $userId = $postData['userid']; $account = $postData['account']; $vcodeData = userVcode::getVcode($account, 'forgot'); $key = userVcode::getVcodeKey($account, 'forgot'); if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) { $msg = app::get('topm')->_('页面已过期,请重新找回密码'); return $this->splash('failed', null, $msg, true); } $data['type'] = 'reset'; $data['new_pwd'] = $postData['password']; $data['user_id'] = $postData['userid']; $data['confirm_pwd'] = $postData['confirmpwd']; try { app::get('topm')->rpcCall('user.pwd.update', $data, 'buyer'); } catch (Exception $e) { $msg = $e->getMessage(); $url = url::action('topm_ctl_passport@findPwd'); return $this->splash('error', $url, $msg, true); } $msg = "修改成功"; $url = url::action('topm_ctl_passport@login'); return $this->splash('success', $url, $msg, true); }
/** * @brief 加入购物车 * * @param array $params 加入购物车参数 * * @return bool */ public function addCart($params) { $params = utils::_filter_input($params); //检查加入购物的商品是否有效 if (empty($params['sku_id'])) { throw new \LogicException(app::get('systrade')->_("加入购物车的商品不存在")); } $skuData = $this->objLibItemInfo->getSkuInfo($params['sku_id']); $items['item_id'] = $skuData['item_id']; $itemData = $this->objLibItemInfo->getItemInfo($items); //检查加入购物的商品是否有效 if (!$this->__checkItemValid($itemData, $skuData)) { throw new \LogicException(app::get('systrade')->_("无效商品,加入购物车失败")); } //如果加入购物车的商品,在购物车中已存在则合并 $filter['sku_id'] = intval($params['sku_id']); $filter['obj_type'] = $params['obj_type']; $cartBasicData = $this->getBasicCart($filter); $mergeParams = $this->__mergeAddCartData($cartBasicData[0], $params); //检查商品是否能加入购物车 $this->__check($mergeParams, $itemData, $skuData); $data = $this->__preAddCartData($mergeParams, $itemData, $skuData); if ($params['mode'] == 'fastbuy') { return $this->fastBuyStore($data); } $result = $this->objMdlCart->save($data); return $result ? $data : false; }
/** * @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($fastbuy = false) { $member_id = $this->app->member_id; //parent method //$member_info = $this->get_member_info($member_id); $this->logger->set_operator(array('ident' => $member_id, 'name' => '会员', 'model' => 'members')); $params = utils::_filter_input($_POST); //新订单标准数据 $order_sdf = array('member_id' => $member_id, 'memo' => $params['memo'], 'pay_app' => $params['payapp_id'], 'dlytype_id' => $params['dlytype_id'], 'createtime' => time(), 'need_shipping' => $params['need_shipping'], 'need_invoice' => $params['need_invoice'], 'invoice_title' => $params['invoice_title'], 'platform' => 'mobile'); $redirect_cart = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_cart'), true); $redirect_checkout = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_checkout', 'args' => array($fastbuy)), true); if ($fastbuy) { $filter['is_fastbuy'] = 'true'; } if ($order_sdf['need_shipping'] != 'N') { if ($order_sdf['need_shipping'] != 'N' && !$order_sdf['dlytype_id']) { $this->logger->fail('create', '未知配送方式', $params); $this->splash('error', $redirect_checkout, '未知配送方式'); } //COD FIX if ($order_sdf['pay_app'] == '-1' || $order_sdf['pay_app'] == 'cod') { $order_sdf['is_cod'] = 'Y'; } else { $dlytype = app::get('b2c')->model('dlytype')->dump($params['dlytype_id']); if ($dlytype['has_cod'] == 'true') { $order_sdf['pay_app'] = 'cod'; $order_sdf['is_cod'] = 'Y'; } } if (!$params['addr_id']) { $this->logger->fail('create', '无收货人信息', $params); $this->splash('error', $redirect_checkout, '无收货人信息'); } else { $consignee = app::get('b2c')->model('member_addrs')->getRow('name,area,addr,zip,tel,mobile,email', array('member_id' => $member_id, 'addr_id' => $params['addr_id'])); $order_sdf['consignee'] = $consignee; } } if (!$order_sdf['pay_app']) { $this->logger->fail('create', '未知支付方式', $params); $this->splash('error', $redirect_checkout, '未知支付方式'); } //购物车数据 $cart_result = $this->cart_stage->result($filter); if ($this->cart_stage->is_empty($cart_result)) { $this->logger->fail('create', '没有可结算商品', $params); $this->splash('error', $redirect_cart, '没有可结算商品'); } if ($params['cart_md5'] != utils::array_md5($cart_result)) { $this->logger->fail('create', '购物车发生变化', $params); $this->splash('error', $redirect_cart, '购物车发生变化'); } $db = vmc::database(); //开启事务 $this->transaction_status = $db->beginTransaction(); $order_create_service = vmc::singleton('b2c_order_create'); //&$order_sdf、&$msg if (!$order_create_service->generate($order_sdf, $cart_result, $msg)) { $db->rollback(); //事务回滚 $msg = $msg ? $msg : '数据组织失败'; $this->logger->fail('create', $msg, $params); $this->splash('error', $redirect_cart, $msg); } if (!$order_create_service->save($order_sdf, $msg)) { $db->rollback(); //事务回滚 $msg = $msg ? $msg : '数据保存失败'; $this->logger->fail('create', $msg, $order_sdf); $this->splash('error', $redirect_cart, $msg); } $db->commit($this->transaction_status); //事务提交 $this->logger->set_order_id($order_sdf['order_id']); $this->logger->success('create', '订单创建成功', $params); /* * 优惠券冻结,优惠券使用记录 * 未使用成功in_use!="true"的优惠券不做冻结处理,不做记录 * @see /Applications/b2c/lib/postfilter/promotion.php line 200 */ foreach ($cart_result['objects']['coupon'] as $coupon) { if ($coupon['params']['in_use'] != 'true') { continue; } $couponlog_data = array('member_id' => $member_id, 'order_id' => $order_sdf['order_id'], 'cpns_id' => $coupon['params']['cpns_id'], 'memc_code' => $coupon['params']['code'], 'cpns_name' => $coupon['params']['name'], 'coupon_save' => $coupon['params']['save'], 'order_total' => $order_sdf['order_total']); vmc::singleton('b2c_coupon_stage')->couponlog($couponlog_data, $msg); if ($coupon['params']['cpns_type'] == '1') { //需冻结会员账户内的相关B类券 vmc::singleton('b2c_coupon_stage')->freeze_member_coupon($member_id, $coupon['params']['code'], $msg); } } //清理购物车 $this->cart_stage->clean($cart_result, $fastbuy); //只删除勾选结算项,对于优惠券,只删除触发促销的项 $redirect_payment = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_checkout', 'act' => 'payment', 'args' => array($order_sdf['order_id'], '1')), true); $this->splash('success', $redirect_payment, '订单提交成功'); }
public function index($fix_brand = false) { $params = utils::_filter_input($_GET); //顶部搜索框显示 $this->pagedata['search_type'] = $params['type']; $this->pagedata['search_keywords'] = $params['keywords']; $this->pagedata['search_having'] = $params['having']; //>> if ($params['type'] == 'goods') { $params['keywords'] = $params['keywords']; } else { if ($params['search_type'] == 'store') { //按店铺搜索 } } $this->handle_params($params); $datasetting = vmc::singleton('b2c_view_datasetting'); $cat_setting = $datasetting->goods_list_cat(); $params['cat_id'] = $params['cat_id'] ? $params['cat_id'] : 0; $cat_title = '一级分类'; foreach ($cat_setting as $key => $value) { if ($value['parent_id'] == $params['cat_id']) { if ($value['cat_lv'] == 2) { $cat_title = '二级分类'; $cat_id = $params['cat_id']; } $this->pagedata['cat_title'] = $cat_title; break; } } foreach ($cat_setting as $key => $value) { if ($value['id'] == $params['cat_id']) { foreach ($cat_setting as $k => $v) { if ($value['parent_id'] == $v['id']) { $search_info['cat'][] = array('id' => $v['id'], 'name' => $v['name']); break; } } $search_info['cat'][] = array('id' => $value['id'], 'name' => $value['name']); break; } } $datasetting->list_search($search_info, $params); $this->pagedata['search_info'] = $search_info; $this->pagedata['cat'] = $cat_setting; $this->pagedata['params'] = $params; $query_str = $this->_query_str($params); $this->pagedata['query'] = $this->_query_str($params, 0); $this->pagedata['selector'] = array('cat' => '分类', 'brand' => '品牌', 'price' => '价格', 'origin' => '产地', 'weight' => '重量'); $params = $this->_params_decode($params); $filter = $params['filter']; if ($cat_id) { $filter['parent_id'] = $cat_id; unset($filter['cat_id']); //一级分类下显示所属子分类的全部商品 } // if (!$fix_brand && $filter['cat_id']) { // $mdl_cat = $this->app->model('goods_cat'); // $cat_info = $mdl_cat->dump($filter['cat_id']); // if ($cat_info['gallery_setting']['site_template']) { // $this->set_tmpl_file($cat_info['gallery_setting']['site_template']); //设置模板文件 // } // $this->seo_info = $cat_info['seo_info']; // $this->pagedata['cat_path'] = $mdl_cat->getPath($filter['cat_id']); // } elseif($fix_brand) { // $filter['brand_id'] = $fix_brand; // } $goods_list = $this->_list($filter, $params['page'], $params['orderby'], $params['keywords']); $store_obj = vmc::singleton('store_store_object'); foreach ($goods_list['data'] as $key => $value) { $goods_list['data'][$key]['store_info'] = $store_obj->store_info($value['store_id']); } $this->pagedata['data_list'] = $goods_list['data']; $this->pagedata['count'] = $goods_list['count']; $this->pagedata['all_count'] = $goods_list['all_count']; // $this->pagedata['pager'] = $goods_list['page_info']; // $this->pagedata['pager']['token'] = time(); // $this->pagedata['pager']['link'] = $this->gen_url(array( // 'app' => 'b2c', // 'ctl' => 'site_list', // 'act' => 'index', // 'full' => 1, // )).'?page='.$this->pagedata['pager']['token'].($query_str ? '&'.$query_str : ''); // if (!$fix_brand) { // $this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_cat($filter['cat_id']); // } else { // $brand = app::get('b2c')->model('brand')->dump($fix_brand); // $this->pagedata['brand'] = $brand; // $this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_brand($fix_brand); // $this->set_tmpl('brandlist'); //锁定品牌型列表模板 // $brand_setting = $brand['brand_setting']; // if ($brand_setting['site_template']) { // $this->set_tmpl_file($brand_setting['site_template']); // } // } // //seo // $this->generate_seo_data(); $this->page('site/list/index.html'); }
public function post_login() { //_POST过滤 $post = utils::_filter_input($_POST); $post_date = $_POST; unset($_POST); $userData = array('login_account' => $post['uname'], 'login_password' => $post['password']); //hack by Jason 将登陆密码验证改正 $staff = app::get('b2c')->model('local_staff')->getRow('*', array('login_name' => $userData['login_account'])); if (!$staff) { $this->splash('failed', $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_storepassport', 'act' => 'index')), app::get('b2c')->_('员工账号不存在'), true); } $account = app::get('pam')->model('members')->getList('*', array('member_id' => $staff['member_id'], 'login_type' => 'local')); $use_pass_data['login_name'] = $userData['login_account']; $use_pass_data['createtime'] = $account[0]['createtime']; $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', $use_pass_data); $local_store_listData = app::get('b2c')->model('local_staff')->getRow('*', array('login_name' => $post['uname'], 'login_password' => $login_password)); //hack by Jason 将登陆密码验证改正 if ($local_store_listData['staff_id'] > 0 && isset($local_store_listData['staff_id'])) { if (isset($post_date['store']) && $post_date['store'] > 0) { $obj_local_store = app::get('ome')->model('branch'); $local_store_list = $obj_local_store->getList('*', array('branch_id' => $post_date['store']), 0, 1); $local_store = $local_store_list[0]; if ($local_store) { $_SESSION['local_store'] = $local_store; } $in_addr_data = $local_store; $in_addr_data['member_id'] = $account[0]['member_id']; } } else { $this->splash('failed', $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_storepassport', 'act' => 'index')), app::get('b2c')->_('员工账号或密码错误'), true); } if ($local_store_listData['branch_id'] != $post['store']) { $this->splash('failed', $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_storepassport', 'act' => 'index')), app::get('b2c')->_('会员没有权限登录该门店!'), true); } //hack by Jason 门店店员登陆后自动登陆成会员店员绑定的会员账号begin $iniuser = array('login_account' => $account[0]['password_account']); $member_id = kernel::single('pam_passport_site_basic')->login_webpos($iniuser, '', $msg); if (!$member_id) { $msg = app::get('b2c')->_('登陆账号错误'); $this->splash('failed', null, $msg, true); exit; } $b2c_members_model = $this->app->model('members'); $member_point_model = $this->app->model('member_point'); $member_data = $b2c_members_model->getList('member_lv_id,experience,point', array('member_id' => $member_id)); $member_data = $member_data[0]; $member_data['order_num'] = $this->app->model('orders')->count(array('member_id' => $member_id)); if ($this->app->getConf('site.level_switch') == 1) { $member_data['member_lv_id'] = $b2c_members_model->member_lv_chk($member_data['member_lv_id'], $member_data['experience']); } if ($this->app->getConf('site.level_switch') == 0) { $member_data['member_lv_id'] = $member_point_model->member_lv_chk($member_id, $member_data['member_lv_id'], $member_data['point']); } $b2c_members_model->update($member_data, array('member_id' => $member_id)); $this->userObject->set_member_session($member_id); $this->bind_member($member_id); //hack by Jason 门店店员登陆后自动登陆成会员店员绑定的会员账号end $this->userObject->set_member_session_webpos($local_store_listData); $this->set_cookie('loginName', $post['uname'], time() + 31536000); //用于记住密码 $this->set_cookie('loginStaff', $post['uname'], time() + 31536000); //hack by Jason 门店店员名写入cookie $this->set_cookie('loginType', 'store', $this->cookie_expires); //hack by Jason 门店登录的标志写入cookie中 $this->app->model('cart_objects')->setCartNum(); app::get('b2c')->model('local_staff')->update(array('logintime' => time()), array('staff_id' => $_SESSION['account']['staff'])); $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_cart')) . "?type=x"; $this->splash('success', $url, app::get('b2c')->_('登录成功'), true); }
/** * @brief 发送短信验证码 * * @return html */ public function sendVcode() { $postData = utils::_filter_input(input::get()); if ($postData['verifyType'] == "email") { $validator = validator::make([$postData['uname']], ['required|email'], ['您的邮箱号不能为空!|邮箱号格式不对!']); if ($validator->fails()) { $messages = $validator->messagesInfo(); foreach ($messages as $error) { return $this->splash('error', null, $error[0]); } } } if ($postData['verifyType'] == "mobile") { $validator = validator::make([$postData['uname']], ['required|mobile'], ['您的手机号不能为空!|手机号格式不对!']); if ($validator->fails()) { $messages = $validator->messagesInfo(); foreach ($messages as $error) { return $this->splash('error', null, $error[0]); } } } try { $this->passport->sendVcode($postData['uname'], $postData['type']); } catch (Exception $e) { $msg = $e->getMessage(); return $this->splash('error', null, $msg); } if ($accountType == "email") { return $this->splash('success', null, "邮箱验证链接已经发送至邮箱,请登录邮箱验证"); } else { return $this->splash('success', null, "验证码发送成功"); } }
/** * 找回密码2,验证码验证 */ public function lost_verify_vcode($params, &$service) { $params = utils::_filter_input($params); //过滤xss攻击 $userVcode = kernel::single('b2c_user_vcode'); $vcodeData = $userVcode->verify($params['vcode'], $params['mobile'], 'forgot'); if (!$vcodeData) { $msg = app::get('b2c')->_('短信验证错误'); $error['status'] = 'false'; $error['message'] = $msg; return $error; } $pamMembersModel = app::get('pam')->model('members'); $members = $pamMembersModel->getRow('member_id', array('login_account' => $params['mobile'])); $return['status'] = 'true'; $return['message'] = '短信验证成功'; $lost_token = $this->set_accesstoken($params['mobile']); $_SESSION['token'] = $members['member_id']; $return['member_id'] = $members['member_id']; $return['lost_token'] = $lost_token; return $return; }