From 010a973365522ab9c3b38750e77374c582e13354 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E4=B8=80=E5=B3=B0?= <1feng.0595@gmail.com>
Date: Tue, 7 Nov 2017 00:07:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Http/Controllers/Api/UserController.php | 2 +-
app/Http/Controllers/Weixin/UserController.php | 2 +-
app/Http/Model/User.php | 11 +++++++++--
resources/views/weixin/common/footer.blade.php | 2 +-
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php
index 6157a5d..6842058 100644
--- a/app/Http/Controllers/Api/UserController.php
+++ b/app/Http/Controllers/Api/UserController.php
@@ -134,7 +134,7 @@ class UserController extends CommonController
$data['password'] = $request->input('password','');
$data['openid'] = $request->input('openid','');
- if (($data['user_name']=='' && $data['password']=='') || $data['openid']=='')
+ if (($data['user_name']=='' || $data['password']=='') && $data['openid']=='')
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php
index 46072b3..2024182 100644
--- a/app/Http/Controllers/Weixin/UserController.php
+++ b/app/Http/Controllers/Weixin/UserController.php
@@ -323,7 +323,7 @@ class UserController extends CommonController
$res = curl_request($url,$postdata,'POST');
if($res['code'] != ReturnCode::SUCCESS_CODE){$this->error_jump('系统错误');}
- dd($res);
+
$_SESSION['weixin_user_info'] = $res['data'];
header('Location: '.route('weixin_user'));exit;
diff --git a/app/Http/Model/User.php b/app/Http/Model/User.php
index 451c316..9457459 100644
--- a/app/Http/Model/User.php
+++ b/app/Http/Model/User.php
@@ -199,9 +199,16 @@ class User extends BaseModel
{
extract($param); //参数
- $user = self::where(array('mobile'=>$user_name,'password'=>$password))->orWhere(array('user_name'=>$user_name,'password'=>$password))->orWhere(array('openid'=>$openid))->first();
+ if(isset($openid))
+ {
+ $user = self::where(array('openid'=>$openid))->first();
+ }
+ else
+ {
+ $user = self::where(array('mobile'=>$user_name,'password'=>$password))->orWhere(array('user_name'=>$user_name,'password'=>$password))->first();
+ }
- if(!$user){return false;}
+ if(!isset($user)){return false;}
$res = self::getUserInfo($user->id);
$token = Token::getToken(Token::TYPE_WEIXIN, $user->id);
diff --git a/resources/views/weixin/common/footer.blade.php b/resources/views/weixin/common/footer.blade.php
index 1bc2fc2..ad9b862 100644
--- a/resources/views/weixin/common/footer.blade.php
+++ b/resources/views/weixin/common/footer.blade.php
@@ -5,7 +5,7 @@
current(); ?>
>首页
分类
- 购物车
+ 购物车
>个人中心