From f05876d7e0cd0d5c12a1c5d2c09a1fcadb5afc75 Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Fri, 16 Jun 2017 23:25:13 +0800 Subject: [PATCH 1/6] bugfix --- app/Http/Controllers/ContentController.php | 2 +- public/js/good/good_list.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ContentController.php b/app/Http/Controllers/ContentController.php index b646999..0201240 100644 --- a/app/Http/Controllers/ContentController.php +++ b/app/Http/Controllers/ContentController.php @@ -22,7 +22,7 @@ class ContentController extends Controller $data['populargoods'] = GoodInfo::where('baned', false)->where('count', '>', 0)->where('fav_num', '>', 0)->orderby('fav_num', 'desc')->limit(8)->get(); $data['cats'] = GoodCat::orderby('cat_index', 'asc')->get(); foreach($data['cats'] as $cat){ - $data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->inRandomOrder()->limit(4)->get(); + $data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->where('count', '>', 0)->inRandomOrder()->limit(4)->get(); } $data['announces'] = Announcement::orderby('id', 'dsc')->limit(3)->get(); return View::make('welcome')->with($data); diff --git a/public/js/good/good_list.js b/public/js/good/good_list.js index 6b2371a..bb40e45 100644 --- a/public/js/good/good_list.js +++ b/public/js/good/good_list.js @@ -40,7 +40,7 @@ function setprice(){ location.href=hr; } function setc(ha){ - var hr="/good/?"; + var hr="/good?"; if($("#priceSet1").val()!=""){ hr=hr+"&start_price="+$("#priceSet1").val(); } @@ -61,6 +61,7 @@ function setc(ha){ } if(getUrlParam('cat_id')) hr = hr + '&cat_id=' + getUrlParam('cat_id'); + //alert(hr); location.href=hr; } From 20ebce97f4a873c98e46f715d2c8b564b8a20414 Mon Sep 17 00:00:00 2001 From: yuki Date: Sat, 17 Jun 2017 02:05:23 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=E9=A6=96=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=85=AC=E7=A4=BA=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AdminController.php | 3 + app/Http/Controllers/ContentController.php | 2 + app/Http/Controllers/MessageController.php | 20 ++-- app/Transaction.php | 1 + app/User.php | 10 ++ resources/views/admin/index.blade.php | 116 ++++++++++++++++++++- resources/views/welcome.blade.php | 90 +++++++++++++++- 7 files changed, 227 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 1ef9c76..23f68d5 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -11,6 +11,7 @@ use App\User; use App\Announcement; use App\Http\Controllers\Controller; use App\Ticket; +use App\Transaction; use Mews\Purifier\Purifier; class AdminController extends Controller @@ -29,6 +30,8 @@ class AdminController extends Controller $data['cats'] = GoodCat::orderby('cat_name', 'asc')->get(); $data['announcements'] = Announcement::orderby('id', 'dsc')->get(); $data['reports'] = Ticket::where('type', '2')->orderby('id', 'dsc')->paginate(16); + $data['users'] = User::orderby('id', 'asc')->paginate(16); + $data['trans'] = Transaction::orderby('id', 'asc')->paginate(16); return View::make('admin.index')->with($data); } diff --git a/app/Http/Controllers/ContentController.php b/app/Http/Controllers/ContentController.php index b646999..a8cf819 100644 --- a/app/Http/Controllers/ContentController.php +++ b/app/Http/Controllers/ContentController.php @@ -10,6 +10,7 @@ use App\Http\Controllers\Controller; use App\GoodInfo; use App\GoodCat; use App\Announcement; +use App\Transaction; class ContentController extends Controller { @@ -25,6 +26,7 @@ class ContentController extends Controller $data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->inRandomOrder()->limit(4)->get(); } $data['announces'] = Announcement::orderby('id', 'dsc')->limit(3)->get(); + $data['trans'] = Transaction::where('status', '>', 3)->orderby('id', 'dsc')->get(); return View::make('welcome')->with($data); } diff --git a/app/Http/Controllers/MessageController.php b/app/Http/Controllers/MessageController.php index f42ef1a..46fc9f8 100644 --- a/app/Http/Controllers/MessageController.php +++ b/app/Http/Controllers/MessageController.php @@ -23,16 +23,6 @@ class MessageController extends Controller { public function showMessageView(Request $request) { - $user_id = $request->session()->get('user_id'); - $post_data = 'user_id='.$user_id.''; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify'); - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - $output = curl_exec($ch); - curl_close($ch); return View::make('message.message'); } @@ -49,6 +39,16 @@ class MessageController extends Controller MessageContact::where('user_id', $user_id) ->where('contact_id', $contact_id) ->update(['unread_count' => 0]); + $user_id = $request->session()->get('user_id'); + $post_data = 'user_id='.$user_id.''; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify'); + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + $output = curl_exec($ch); + curl_close($ch); return json_encode($messages); } diff --git a/app/Transaction.php b/app/Transaction.php index 8f0ec3f..a8eacf8 100644 --- a/app/Transaction.php +++ b/app/Transaction.php @@ -32,4 +32,5 @@ class Transaction extends Model { return $this->hasOne('App\Ticket', 'trans_id'); } + } diff --git a/app/User.php b/app/User.php index 870749b..71698f7 100644 --- a/app/User.php +++ b/app/User.php @@ -34,4 +34,14 @@ class User extends Model return $this->nickname != "" ? $this->nickname : "一位先锋市场用户"; } + public function getcoding() + { + $len=strlen($this->stuid); + $ans = ""; + $ans = $ans . ($this->stuid)[0]; + for($i=1; $i<($len-1); $i++) $ans = $ans . '*'; + $ans = $ans . ($this->stuid)[$len-1]; + return $ans; + } + } diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index 945ca51..a45492e 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -7,7 +7,9 @@
@@ -91,6 +93,7 @@ # 举报者ID 被举报者ID + 举报理由 受理管理员ID 状态 @@ -98,9 +101,10 @@ @foreach($reports as $repo) - {{ $repo->id }} - {{ $repo->sender_id }} - {{ $repo->receiver_id }} + {{$repo->id}} + {{$repo->sender_id}} + {{$repo->receiver_id}} + {{$repo->message}} @if(!$repo->assignee)
@@ -144,6 +148,110 @@ {{ $reports->links() }}
+
+
+ + + + + + + + + + + + + + + @foreach($users as $user) + + + + + + + + + + + + + + @endforeach +
#权限学号真实姓名昵称用户名邮箱是否封禁注册时间
{{$user->id}}{{$user->privilege}}{{$user->stuid}}{{$user->realname}}{{$user->nickname}}{{$user->username}}{{$user->email}} + @if($user->baned == 0) + 否 + @endif + @if($user->baned == 1) + 已封禁{{$user->banedtime}}天 + @endif + @if($user->baned == -1) + 已永久封禁 + @endif + {{$user->created_at}}
+
+ {{ $users->links() }} +
+ +
+
+ + + + + + + + + + + + + @foreach($trans as $tran) + @if($tran->seller != NULL) + + + + + + + + + + + + @endif + @endforeach +
#卖家学号买家学号商品ID交易数目交易状态评价
{{$tran->id}}{{$tran->seller->stuid}}{{$tran->buyer->stuid}}{{$tran->good_id}}{{$tran->number}} + @if($tran->status == 0) + 订单已取消 + @endif + @if($tran->status == 1) + 买家已购买,卖家未确认 + @endif + @if($tran->status == 2) + 卖家已确认 + @endif + @if($tran->status == 3) + 交易失败 + @endif + @if($tran->status == 4) + 交易成功待评价 + @endif + @if($tran->status == 5) + 交易成功已评价 + @endif + + @if($tran->status == 5) + {{$tran->reason}} + @else + 无 + @endif +
+
+ {{ $trans->links() }} +
@@ -186,3 +260,17 @@ @endsection + + From 780eb1b8280d6a21989622d6387fd4452cd75bd3 Mon Sep 17 00:00:00 2001 From: yuki Date: Sat, 17 Jun 2017 12:14:51 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=A0=8F=E7=9A=84bug=EF=BC=8C=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=9C=AA=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AdminController.php | 6 +-- app/Http/Controllers/MessageController.php | 20 ++++----- app/Transaction.php | 3 +- app/User.php | 4 +- resources/views/admin/index.blade.php | 6 +-- resources/views/welcome.blade.php | 49 ++++++++++++---------- 6 files changed, 47 insertions(+), 41 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 23f68d5..01a17fe 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -29,9 +29,9 @@ class AdminController extends Controller $data['users'] = User::orderby('id', 'asc')->get(); $data['cats'] = GoodCat::orderby('cat_name', 'asc')->get(); $data['announcements'] = Announcement::orderby('id', 'dsc')->get(); - $data['reports'] = Ticket::where('type', '2')->orderby('id', 'dsc')->paginate(16); - $data['users'] = User::orderby('id', 'asc')->paginate(16); - $data['trans'] = Transaction::orderby('id', 'asc')->paginate(16); + $data['reports'] = Ticket::where('type', '2')->orderby('id', 'dsc')->paginate(40); + $data['users'] = User::orderby('id', 'asc')->paginate(40); + $data['trans'] = Transaction::orderby('id', 'asc')->paginate(40); return View::make('admin.index')->with($data); } diff --git a/app/Http/Controllers/MessageController.php b/app/Http/Controllers/MessageController.php index 46fc9f8..f42ef1a 100644 --- a/app/Http/Controllers/MessageController.php +++ b/app/Http/Controllers/MessageController.php @@ -23,6 +23,16 @@ class MessageController extends Controller { public function showMessageView(Request $request) { + $user_id = $request->session()->get('user_id'); + $post_data = 'user_id='.$user_id.''; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify'); + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + $output = curl_exec($ch); + curl_close($ch); return View::make('message.message'); } @@ -39,16 +49,6 @@ class MessageController extends Controller MessageContact::where('user_id', $user_id) ->where('contact_id', $contact_id) ->update(['unread_count' => 0]); - $user_id = $request->session()->get('user_id'); - $post_data = 'user_id='.$user_id.''; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify'); - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - $output = curl_exec($ch); - curl_close($ch); return json_encode($messages); } diff --git a/app/Transaction.php b/app/Transaction.php index a8eacf8..d253b9b 100644 --- a/app/Transaction.php +++ b/app/Transaction.php @@ -20,7 +20,8 @@ class Transaction extends Model public function getSellerIdAttribute() { - return $this->good->user_id; + if($this->good != NULL) + return $this->good->user_id; } public function seller() diff --git a/app/User.php b/app/User.php index 71698f7..df70742 100644 --- a/app/User.php +++ b/app/User.php @@ -38,9 +38,9 @@ class User extends Model { $len=strlen($this->stuid); $ans = ""; - $ans = $ans . ($this->stuid)[0]; + $ans = $ans . substr($this->stuid, 0, 1); for($i=1; $i<($len-1); $i++) $ans = $ans . '*'; - $ans = $ans . ($this->stuid)[$len-1]; + $ans = $ans . substr($this->stuid, -1); return $ans; } diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index a45492e..3ac3d60 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -153,7 +153,7 @@ - + @@ -171,7 +171,7 @@ - +
#用户ID 权限 学号 真实姓名{{$user->privilege}} {{$user->stuid}} {{$user->realname}}{{$user->nickname}}{{$user->nickname}} {{$user->username}} {{$user->email}} @@ -199,7 +199,7 @@ - + diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 9323b5a..e7f35fb 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -4,7 +4,6 @@ @section('asset') -@endsection + + +@endsection + + @section('content')
@@ -245,7 +264,7 @@
    @foreach($trans as $tran) @if($tran->seller != NULL) -
  • 恭喜{{$tran->seller->getcoding()}}和{{$tran->buyer->getcoding()}}成功完成了一笔交易!OvO
  • +
  • 恭喜{{$tran->seller->getcoding()}}和{{$tran->buyer->getcoding()}}成功完成了一笔交易!OvO
  • @endif @endforeach
@@ -260,17 +279,3 @@
@endsection - - From 128c1c965c3243f2e1f4b042fb54099eda8c4793 Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Sat, 17 Jun 2017 20:38:03 +0800 Subject: [PATCH 4/6] add wechat oauth --- app/Http/Controllers/AuthController.php | 108 +++++++++++++++++- app/Http/Controllers/UserController.php | 2 +- app/Http/routes.php | 1 + app/User.php | 5 + app/Wechat.php | 10 ++ ...2017_06_17_184447_create_wechats_table.php | 35 ++++++ ..._06_17_184808_alter_user_add_wechat_id.php | 38 ++++++ public/css/wechat.css | 22 ++++ resources/views/auth/wechatGuide.blade.php | 53 +++++++++ .../views/user/editUserAccount.blade.php | 12 +- 10 files changed, 280 insertions(+), 6 deletions(-) create mode 100644 app/Wechat.php create mode 100644 database/migrations/2017_06_17_184447_create_wechats_table.php create mode 100644 database/migrations/2017_06_17_184808_alter_user_add_wechat_id.php create mode 100644 public/css/wechat.css create mode 100644 resources/views/auth/wechatGuide.blade.php diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 28d2dac..d483fad 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -19,6 +19,7 @@ use App\PasswordReset; use Mail; use App\AuthLog; use phpCAS; +use App\Wechat; class AuthController extends Controller { @@ -27,6 +28,68 @@ class AuthController extends Controller return View::make('auth.login'); } + public function wx(Request $request) + { + if(isset($request->data) && $request->sign == substr(md5($request->data . env('WECHAT_KEY')), 8, 16)) + { + $data['wechat'] = json_decode(base64_decode($request->data)); + $user = User::where('wechat_open_id', $data['wechat']->openId)->first(); + $request->session()->put('wechat_open_id', $data['wechat']->openId); + if(!$user) { + $wechat = Wechat::firstOrNew(['open_id' => $data['wechat']->openId]); + $wechat->head_img_url = $data['wechat']->headImgUrl; + $wechat->nick_name = $data['wechat']->nickName; + $wechat->sex = $data['wechat']->sex; + $wechat->save(); + + return view('auth.wechatGuide')->with($data); + } + else { + if ($user->baned) { + $nowdate = time(); + $banedstart = $user->banedstart; + $date = $nowdate-$banedstart; + if($date>($user->banedtime)*86400 && $user->banedtime!=-1) + { + $user->baned = 0; + return Redirect::to('/'); + } + // log start + $log = new AuthLog(); + $log->user_id = $user->id; + $log->ip = $request->ip(); + $log->event = "wechat_oauth_login_banned"; + $log->save(); + // log end + + if($user->banedtime == -1) + return Redirect::to('/login')->withInput()->withErrors('你已经被永久封禁!'); + return Redirect::to('/login')->withInput()->withErrors('你已经被封禁!'.ceil($user->banedtime-($date/86400)).'天后解禁!'); + } + + // log start + $log = new AuthLog(); + $log->user_id = $user->id; + $log->ip = $request->ip(); + $log->event = "wechat_oauth_login_success"; + $log->save(); + // log end + + $request->session()->put('user_id', $user->id); + $request->session()->put('username', $user->username); + $request->session()->put('nickname', $user->nickname); + if ($user->privilege) + $request->session()->put('is_admin', $user->privilege); + + if ($user->registerCompletion() != 0) + return Redirect::to('/register/' . $user->registerCompletion()); + else + return Redirect::to('/'); + } + } + return Redirect::to("http://api.xms.rmbz.net/open/oauth?path=" . env("APP_URL") . "/wx"); + } + public function cas(Request $request) { phpCAS::client(CAS_VERSION_2_0, "sso.neu.cn", 443, "/cas"); @@ -53,6 +116,18 @@ class AuthController extends Controller $log->save(); // log end + if($request->session()->has('wechat_open_id')) { + $user->wechat_open_id = $request->session()->get('wechat_open_id'); + $user->save(); + // log start + $log = new AuthLog(); + $log->user_id = $user->id; + $log->ip = $request->ip(); + $log->event = "wechat_oauth_sso_bind_success"; + $log->save(); + // log end + } + $request->session()->put('user_id', $user->id); return Redirect::to('/register/' . $user->registerCompletion()); @@ -75,10 +150,10 @@ class AuthController extends Controller $log->event = "cas_login_banned"; $log->save(); // log end - + if($user->banedtime == -1) - return Redirect::back()->withInput()->withErrors('你已经被永久封禁!'); - return Redirect::back()->withInput()->withErrors('你已经被封禁!'.ceil($user->banedtime-($date/86400)).'天后解禁!'); + return Redirect::to('/login')->withInput()->withErrors('你已经被永久封禁!'); + return Redirect::to('/login')->withInput()->withErrors('你已经被封禁!'.ceil($user->banedtime-($date/86400)).'天后解禁!'); } // log start @@ -95,6 +170,18 @@ class AuthController extends Controller if ($user->privilege) $request->session()->put('is_admin', $user->privilege); + if($request->session()->has('wechat_open_id')) { + $user->wechat_open_id = $request->session()->get('wechat_open_id'); + $user->save(); + // log start + $log = new AuthLog(); + $log->user_id = $user->id; + $log->ip = $request->ip(); + $log->event = "wechat_oauth_sso_bind_success"; + $log->save(); + // log end + } + if ($user->registerCompletion() != 0) return Redirect::to('/register/' . $user->registerCompletion()); else @@ -144,7 +231,7 @@ class AuthController extends Controller $log->event = "login_banned"; $log->save(); // log end - + if($user->banedtime == -1) return Redirect::back()->withInput()->withErrors('你已经被永久封禁!'); return Redirect::back()->withInput()->withErrors('你已经被封禁!'.ceil($user->banedtime-($date/86400)).'天后解禁!'); @@ -166,6 +253,18 @@ class AuthController extends Controller if ($user->privilege) $request->session()->put('is_admin', $user->privilege); + if($request->session()->has('wechat_open_id')) { + $user->wechat_open_id = $request->session()->get('wechat_open_id'); + $user->save(); + // log start + $log = new AuthLog(); + $log->user_id = $user->id; + $log->ip = $request->ip(); + $log->event = "wechat_oauth_bind_success"; + $log->save(); + // log end + } + if ($user->registerCompletion() != 0) return Redirect::to('/register/' . $user->registerCompletion()); else @@ -229,6 +328,7 @@ class AuthController extends Controller $request->session()->forget('username'); $request->session()->forget('nickname'); $request->session()->forget('is_admin'); + $request->session()->forget('wechat_open_id'); return Redirect::to('/'); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index e4f66ef..484d680 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -172,7 +172,7 @@ class UserController extends Controller { $data = []; $user_id = $request->session()->get('user_id'); - $data['user'] = User::find($user_id); + $data['user'] = User::with('wechat')->find($user_id); $data['userinfos'] = UserInfo::where('user_id', $user_id)->get(); $data['tab'] = isset($request->tab) ? $request->tab : "profile"; return View::make('user.user')->with($data); diff --git a/app/Http/routes.php b/app/Http/routes.php index 5e56ff5..04460f8 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -30,6 +30,7 @@ Route::group(['middleware' => ['web']],function () { Route::group(['middleware' => ['authredirect']], function() { Route::get('/login', "AuthController@showLogin"); Route::get('/sso', "AuthController@cas"); + Route::get('/wx', "AuthController@wx"); Route::post('/login', "AuthController@login"); Route::get('/register', "AuthController@showRegister"); Route::post('/register', "AuthController@register"); diff --git a/app/User.php b/app/User.php index 870749b..1780a31 100644 --- a/app/User.php +++ b/app/User.php @@ -34,4 +34,9 @@ class User extends Model return $this->nickname != "" ? $this->nickname : "一位先锋市场用户"; } + public function wechat() + { + return $this->belongsTo('App\Wechat', "wechat_open_id", "open_id"); + } + } diff --git a/app/Wechat.php b/app/Wechat.php new file mode 100644 index 0000000..631007f --- /dev/null +++ b/app/Wechat.php @@ -0,0 +1,10 @@ +string('open_id'); + $table->primary('open_id'); + $table->string('head_img_url'); + $table->string('nick_name'); + $table->string('sex'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('wechats'); + } +} diff --git a/database/migrations/2017_06_17_184808_alter_user_add_wechat_id.php b/database/migrations/2017_06_17_184808_alter_user_add_wechat_id.php new file mode 100644 index 0000000..026f460 --- /dev/null +++ b/database/migrations/2017_06_17_184808_alter_user_add_wechat_id.php @@ -0,0 +1,38 @@ +string('wechat_open_id')->nullable()->unique(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable('users') && Schema::hasColumn('users', 'wechat_open_id')) + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('wechat_open_id'); + }); + } + } +} diff --git a/public/css/wechat.css b/public/css/wechat.css new file mode 100644 index 0000000..916db3a --- /dev/null +++ b/public/css/wechat.css @@ -0,0 +1,22 @@ +.head-img { + border-style: solid; + border-width: 0.3em; + border-color: #cccccc; + border-radius: 15%; + margin-bottom: 1em; +} + +.nickname { + background: #f9fafa; + padding: 3px 6px; + border-radius: 3px; + color: #f4645f; + margin: 5px; + border: 1px solid #ded9d9; + overflow-x: auto; + font-size: 0.9em; +} + +.content-wrapper { + margin-top: 3em; +} \ No newline at end of file diff --git a/resources/views/auth/wechatGuide.blade.php b/resources/views/auth/wechatGuide.blade.php new file mode 100644 index 0000000..8763b25 --- /dev/null +++ b/resources/views/auth/wechatGuide.blade.php @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + @yield('asset') + + + + + + + + + + + + 微信登录 - 先锋市场 + + +
+
+
+ +
+ +
+

您正在使用微信账号 {{ $wechat->nickName }} 登录先锋市场,要绑定此账号,点击下面的按钮继续。

+ + + +
+
+
+ + + @include('layout.footer') + + \ No newline at end of file diff --git a/resources/views/user/editUserAccount.blade.php b/resources/views/user/editUserAccount.blade.php index 4de203c..b843b17 100644 --- a/resources/views/user/editUserAccount.blade.php +++ b/resources/views/user/editUserAccount.blade.php @@ -30,6 +30,14 @@ @endif +
+ @if($user->wechat_open_id) + + + @else + + @endif +
{{ csrf_field() }} @if($user->password!='') @@ -39,4 +47,6 @@ - \ No newline at end of file + + + \ No newline at end of file From c47d805a3f0dbf9f5a5a3993c55b83f6affd1e29 Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Sat, 17 Jun 2017 22:23:50 +0800 Subject: [PATCH 5/6] add welcome trans limit --- app/Http/Controllers/ContentController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ContentController.php b/app/Http/Controllers/ContentController.php index 4696c37..44476ef 100644 --- a/app/Http/Controllers/ContentController.php +++ b/app/Http/Controllers/ContentController.php @@ -26,7 +26,7 @@ class ContentController extends Controller $data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->where('count', '>', 0)->inRandomOrder()->limit(4)->get(); } $data['announces'] = Announcement::orderby('id', 'dsc')->limit(3)->get(); - $data['trans'] = Transaction::where('status', '>', 3)->orderby('id', 'dsc')->get(); + $data['trans'] = Transaction::where('status', '>', 3)->orderby('id', 'dsc')->limit(20)->get(); return View::make('welcome')->with($data); } From af4dc71e83c28b31ff1032dabe919a7663a4bb91 Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Sat, 17 Jun 2017 22:26:42 +0800 Subject: [PATCH 6/6] text ammendment --- app/Http/Requests/AddGoodRequest.php | 2 +- resources/views/good/goodInfo.blade.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Requests/AddGoodRequest.php b/app/Http/Requests/AddGoodRequest.php index 8187d34..49ac772 100644 --- a/app/Http/Requests/AddGoodRequest.php +++ b/app/Http/Requests/AddGoodRequest.php @@ -51,7 +51,7 @@ class addGoodRequest extends Request 'count.max' => '库存数不能超过2147483647!', //'good_tag.required' => '商品标签不能为空!', //'other_tag.max' => '自定义标签不能多于2048个字符!', - 'goodTitlePic.required' => '必须为商品上传一张图片!', + 'goodTitlePic.required' => '必须为商品上传封面!', 'crop_width.required' => '请按要求裁剪图片', 'crop_height.required' => '请按要求裁剪图片', 'crop_x.required' => '请按要求裁剪图片', diff --git a/resources/views/good/goodInfo.blade.php b/resources/views/good/goodInfo.blade.php index 27fe29c..79460a6 100644 --- a/resources/views/good/goodInfo.blade.php +++ b/resources/views/good/goodInfo.blade.php @@ -53,13 +53,13 @@
- 货主:@if(isset($user->nickname)){{ $user->nickname }} @else 还没有昵称>_< @endif + 卖家:@if(isset($user->nickname)){{ $user->nickname }} @else 还没有昵称>_< @endif @if($user->baned) 【已封禁】 @endif @if ($user->id != session('user_id')) - 和我联系 + 联系卖家 @endif

¥{{ $good->price }}

@if($good->count > 1)(库存:{{ $good->count }}件)@else 仅一件 @endif

@@ -169,7 +169,7 @@
  • #交易单号 卖家学号 买家学号 商品ID