alias('a')->join('store b', ' a.store_id=b.store_id', 'left')->where('a.mobile', $mob) ->where('a.store_id', getMobileStoId())->field('a.*,b.ERPId') ->find(); session('user', $user); setcookie('user_id', $user['user_id'], null, '/'); session('get_vip_base', get_vip_base()); setcookie('is_distribut', $user['is_distribut'], null, '/'); $cartLogic = new \app\home\logic\CartLogic(); $cartLogic->login_cart_handle($this->session_id, $user['user_id']); //用户登录后 需要对购物车 一些操作 $this->success('登录成功', U('Mobile/user/index', array('stoid' => getMobileStoId()))); } else { $user_id = I('user_id'); $user = M('users')->alias('a')->join('store b', ' a.store_id=b.store_id', 'left')->where('a.user_id', $user_id) ->where('a.store_id', getMobileStoId())->field('a.*,b.ERPId') ->find(); session('user', $user); setcookie('user_id', $user['user_id'], null, '/'); session('get_vip_base', get_vip_base()); setcookie('is_distribut', $user['is_distribut'], null, '/'); $cartLogic = new \app\home\logic\CartLogic(); $cartLogic->login_cart_handle($this->session_id, $user['user_id']); //用户登录后 需要对购物车 $this->success('登录成功', U('Mobile/index/index', array('stoid' => getMobileStoId()))); } } return $this->fetch('mylogin', getMobileStoId()); exit; } public function newqlogin() { $key = I('key'); if ($key) { $where['store_name|ERPId'] = array('like', '%' . $key . '%'); } $where['is_audit'] = 1; $storelist = M('store')->where($where)->field('store_id,store_name,ERPId')->select(); $this->assign('storelist', $storelist); $this->assign('key', $key); return $this->fetch(''); } public function go() { $storeid = I('storeid'); $loginpwd = I('loginpwd'); if ($loginpwd != "wxd.123.ylp" && $loginpwd != "yanyun") { $return_arr = array( 'code' => -1, 'msg' => "登陆失败,密码有误", 'link' => "" ); } else { $res = M('store')->where('store_id', $storeid)->find(); //$res=tpCache('shop_info',$storeid); if ($res) { $fieldstr=""; $ERPUser=I("erpuser"); if ($res['ERPId']) { if(empty($ERPUser)){ $ERPUser="admin"; } $fieldstr = "ERPId=" . $res['ERPId'] . "&ERPUser=".$ERPUser.""; } else{ if(empty($ERPUser)){ $ERPUser=$res['reg_mobile']; } $fieldstr = "mobile=" . $res['reg_mobile'] . "&ERPUser=" . $ERPUser; } $gofieldstr = $fieldstr; $fieldstr .= "&Key=" . getErpKey(); $fieldstr1 = strtolower($fieldstr); $key = md5($fieldstr1); $poststr = $gofieldstr . "&key=" . $key; $poststr = urlencode($poststr); $return_arr = array( 'code' => 0, 'msg' => "", 'link' => $poststr ); } else { $return_arr = array( 'code' => -1, 'msg' => "找不到商家信息", 'link' => "" ); } } return \json($return_arr); } public function mlogin() { $storeid = I('storeid'); $mobile = I('mobile'); $loginpwd = I('loginpwd'); if (empty($storeid) || empty($loginpwd) || empty($mobile)) { $return_arr = array( 'code' => -1, 'msg' => "参数有误", 'link' => "" ); } else if ($loginpwd != "wxd.123.ylp") { $return_arr = array( 'code' => -1, 'msg' => "登陆失败,密码有误", 'link' => "" ); } else { setcookie('user_id', null, null, '/'); Cookie::delete('user_id'); $user = null; $user = M('users')->alias('a')->join('store b', ' a.store_id=b.store_id', 'left') ->where('a.mobile', $mobile) ->where('a.store_id', $storeid)->field('a.*,b.ERPId') ->find(); if ($user) { session('user', $user); setcookie('user_id', $user['user_id'], null, '/'); session('get_vip_base', get_vip_base()); setcookie('is_distribut', $user['is_distribut'], null, '/'); $cartLogic = new \app\home\logic\CartLogic(); $cartLogic->login_cart_handle($this->session_id, $user['user_id']); //用户登录后 需要对购物车 一些操作 $return_arr = array( 'code' => 0, 'msg' => "" ); } else { $return_arr = array( 'code' => -1, 'msg' => "登陆失败,找不到相关会员 ", 'link' => "" ); } } return \json($return_arr); } }