From 0eabe82253335cefa45372eda3aa38e8bfa2b450 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: Fri, 13 Oct 2017 00:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=BC=B9=E5=87=BA=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/UserController.php | 2 +- app/Http/Model/User.php | 13 ++++- resources/views/weixin/404.blade.php | 55 ++++++++++++------- resources/views/weixin/user/index.blade.php | 2 +- .../views/weixin/user/userAccount.blade.php | 15 ++++- 5 files changed, 64 insertions(+), 23 deletions(-) diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index f2cc784..7c51d99 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -17,7 +17,7 @@ class UserController extends CommonController //用户信息 public function userInfo(Request $request) { - if ($user = User::getOne(Token::$uid)) + if ($user = User::getUserInfo(Token::$uid)) { return ReturnData::create(ReturnData::SUCCESS, $user); } diff --git a/app/Http/Model/User.php b/app/Http/Model/User.php index 9b29505..afb762d 100644 --- a/app/Http/Model/User.php +++ b/app/Http/Model/User.php @@ -77,7 +77,7 @@ class User extends BaseModel return $res; } - //用户信息 + //获取一条用户信息 public static function getOne($id) { $user = self::where('id', $id)->first(); @@ -117,4 +117,15 @@ class User extends BaseModel return true; } + + //获取用户信息 + public static function getUserInfo($user_id) + { + $user = self::where('id', $user_id)->first(); + if(!$user){return false;} + $user['reciever_address'] = UserAddress::getOne($user->address_id); + $user['collect_goods_count'] = CollectGoods::where('user_id', $user_id)->count(); + + return $user; + } } \ No newline at end of file diff --git a/resources/views/weixin/404.blade.php b/resources/views/weixin/404.blade.php index 2deecc9..b49ba5f 100644 --- a/resources/views/weixin/404.blade.php +++ b/resources/views/weixin/404.blade.php @@ -1,22 +1,39 @@ - -
- -