From 59a5eb157662e32a359fb56a5457eae36dd37676 Mon Sep 17 00:00:00 2001 From: yuki Date: Wed, 14 Jun 2017 22:36:00 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=BE?= =?UTF-8?q?=E6=8A=A5=E6=82=AC=E6=B5=AE=E7=AA=97=E5=92=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/admin/index.blade.php | 60 +++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index 7fffecd..e854c69 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -10,6 +10,7 @@ + @@ -100,9 +101,22 @@ @foreach($reports as $repo) - {{ $repo->id }} - {{ $repo->sender_id }} - {{ $repo->receiver_id }} + {{ $repo->id }} + {{ $repo->sender_id }} + {{ $repo->receiver_id }} + @if(!$repo->assignee)
@@ -144,5 +158,45 @@ {{ $reports->links() }} +
+ + + + + + + + + + + + + + @foreach($users as $user) + + + + + + + + + + + + + @endforeach +
#权限用户名学号真名昵称邮箱是否封禁
{{$user->id}}{{$user->privilege}}{{$user->username}}{{$user->stuid}}{{$user->realname}}{{$user->nickname}}{{$user->email}} + @if($user->baned == 0) + 否 + @endif + @if($user->baned == 1) + 已封禁{{$user->banedtime}}天 + @endif + @if($user->baned == -1) + 已永久封禁 + @endif +
+
@endsection From fe87e81749cac11ee70ce9d6952858287a1533ab Mon Sep 17 00:00:00 2001 From: iborvs Date: Thu, 15 Jun 2017 00:15:42 +0800 Subject: [PATCH 2/9] www --- resources/views/user/userProfile.blade.php | 241 ++++++++++++++------- 1 file changed, 164 insertions(+), 77 deletions(-) diff --git a/resources/views/user/userProfile.blade.php b/resources/views/user/userProfile.blade.php index 63c8c56..f963e48 100644 --- a/resources/views/user/userProfile.blade.php +++ b/resources/views/user/userProfile.blade.php @@ -9,100 +9,187 @@ @section('content')
-
-

- @if(isset($user->nickname)) - {{ $user->nickname }} - @if($user->baned) - 【已封禁】 - @endif - @else - 还没有昵称>< - @if($user->baned) - 【已封禁】 - @endif - @endif - @if(isset($user->stuid)) - @if(strlen($user->stuid) == 8) - @if(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR')) - - @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 1) - - @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 2) - - @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 3) - - @elseif(intval(substr($user->stuid, 0, 4)) < 2000 + env('FRESH_YEAR') - 3) - - @endif - @elseif(strlen($user->stuid) == 7) - - @elseif(strlen($user->stuid) == 5) - - @endif - @endif - @if($user->privilege == 1) - - @elseif($user->privilege == 2) - - @endif -

-
+
-
-
-

- -

-

- +

+
+
+
+
+
+ @if(Session::get('user_id') == $user->id) @elseif(Session::get('is_admin') >= 1) + - + @else +
- +
@endif -

-
-
- -
-
-
-
- - - - - - - - @foreach($goods as $good) - - - - - + +
+ +
+
+
+
+
#商品名称商品价格剩余库存
{{ $good->id }}{{ $good->good_name }}{{ $good->price }}{{ $good->count }}
+ + + + + + @foreach($goods as $good) + + + + + + + @endforeach + {{ $goods->links() }} +
#商品名称商品价格剩余库存
{{ $good->id }}{{ $good->good_name }}{{ $good->price }}{{ $good->count }}
+
+
+
+
+
+
    + @foreach($tickets as $ticket) +
  • + +

    {{ $ticket->message }}

    +
  • @endforeach - {{ $goods->links() }} - +
-
+
+
+
+ + + + + + +
+
+
+
+ + +
+ @if(isset($user->nickname)) + 用户名: {{ $user->nickname }} + @if($user->baned) + 【已封禁】 + @endif + @else + 还没有昵称>< + @if($user->baned) + 【已封禁】 + @endif + @endif + @if(isset($user->stuid)) + @if(strlen($user->stuid) == 8) + @if(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR')) + + @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 1) + + @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 2) + + @elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 3) + + @elseif(intval(substr($user->stuid, 0, 4)) < 2000 + env('FRESH_YEAR') - 3) + + @endif + @elseif(strlen($user->stuid) == 7) + + @elseif(strlen($user->stuid) == 5) + + @endif + @endif + @if($user->privilege == 1) + + @elseif($user->privilege == 2) + + @endif +
+ +
+
+ @if(Session::get('user_id') == $user->id) + @elseif(Session::get('is_admin') >= 1) +
+ + +
+ @else +
+ + +
+ @endif +
+
+ +
+
+
+
+ + + + + + + + @foreach($goods as $good) + + + + + + + + @endforeach + {{ $goods->links() }} +
#商品名称商品价格剩余库存
{{ $good->id }}{{ $good->good_name }}{{ $good->price }}{{ $good->count }}
+
+
+
+
    @foreach($tickets as $ticket) From 88503c4ffbdf693fdfd2d4286e7fc59e830553cf Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Thu, 15 Jun 2017 12:19:23 +0800 Subject: [PATCH 3/9] transaction bugfix Signed-off-by: LI JIAHAO --- app/Http/Controllers/GoodController.php | 9 ++++++++- app/Http/Controllers/TransactionController.php | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/GoodController.php b/app/Http/Controllers/GoodController.php index 84110d2..036a108 100644 --- a/app/Http/Controllers/GoodController.php +++ b/app/Http/Controllers/GoodController.php @@ -295,6 +295,13 @@ class GoodController extends Controller $good->delete(); //$deleteGoodTag = GoodTag::where('good_id', $good_id)->delete(); $deleteFavList = Favlist::where('good_id', $good_id)->delete(); + $trans = Transaction::where('good_id', $good_id)->where('status', '<' , 3)->get(); + foreach($trans as $tran) + { + $tran->status = 0; + MessageController::sendMessageHandle(0, $tran->buyer_id, "【系统消息】您好!由于该商品被卖家删除,您的订单(编号:".$tran->id.")已被取消。非常抱歉。"); + $tran->update(); + } return Redirect::to('/good'); } @@ -370,7 +377,7 @@ class GoodController extends Controller MessageController::sendMessageHandle($admin_id, $good->user_id, "【系统消息】您好!您的商品(编号:".$good_id.")由于不符合有关规定已被管理员(ID:".$admin_id.")下架。请在此消息下询问具体细节。"); - $trans = Transaction::where('good_id', $good_id)->get(); + $trans = Transaction::where('good_id', $good_id)->where('status', '<' , 3)->get(); foreach($trans as $tran) { $tran->status = 0; diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index a2fcd35..b5d1f8a 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -301,11 +301,12 @@ class TransactionController extends Controller { $user_id = $request->session()->get('user_id'); $trans = Transaction::find($trans_id); - if(!$trans) + if(!$trans || $trans->status < 2) return View::make('common.errorPage')->withErrors('交易ID错误!'); $seller = User::with('user_infos')->find($trans->seller_id); $buyer = User::with('user_infos')->find($trans->buyer_id); - if(($user_id != $trans->buyer_id && $user_id != $trans->seller_id) || $trans->status != 2) + if($user_id != $trans->buyer_id + && (GoodInfo::where('id', $trans->good_id)->count() == 0 || $user_id != $trans->seller_id)) return View::make('common.errorPage')->withErrors('交易ID错误!'); $data['tran'] = $trans; $data['seller'] = $seller; From ce50c661f40e8edfee20424d3336f31e8c75b548 Mon Sep 17 00:00:00 2001 From: LI JIAHAO Date: Wed, 14 Jun 2017 21:29:20 +0800 Subject: [PATCH 4/9] goodinfo nickname bugfix Modify good list. Now good list search params won't be cleared while going through different pages. --- app/Http/Controllers/GoodController.php | 84 +++++++++++++++---------- public/js/good/good_list.js | 11 ++++ resources/views/good/goodInfo.blade.php | 5 +- resources/views/good/goodList.blade.php | 12 +++- 4 files changed, 77 insertions(+), 35 deletions(-) diff --git a/app/Http/Controllers/GoodController.php b/app/Http/Controllers/GoodController.php index 036a108..56dec46 100644 --- a/app/Http/Controllers/GoodController.php +++ b/app/Http/Controllers/GoodController.php @@ -34,75 +34,95 @@ class GoodController extends Controller */ public function getList(Request $request) { + $paginate_limit = 16; $data = []; $input = $request->all(); - $query = ""; + $query = ""; + $cat_id = $start_price = $end_price = $start_count = $sort = ""; + if(isset($input['cat_id'])) + $cat_id = $input['cat_id']; + if(isset($input['start_price'])) + $start_price = $input['start_price']; + if(isset($input['end_price'])) + $end_price = $input['end_price']; + if(isset($input['start_count'])) + $start_count = $input['start_count']; + if(isset($input['sort'])) + $sort = $input['sort']; if(isset($input['query'])) $query = $input['query']; $data['cats'] = GoodCat::orderby('cat_index', 'asc')->get(); - $data['goods'] = GoodInfo::where('good_name', 'like', "%$query%"); - $data['cat_id'] = 0; - if(isset($input['cat_id'])){ + $data['goods'] = GoodInfo::where('good_name', 'like', "%$query%"); + //$data['cat_id'] = 0; + if(isset($input['cat_id']) && $input['cat_id'] != ""){ $data['goods'] = GoodInfo::where('cat_id', $input['cat_id']); $data['cat_id'] = $input['cat_id']; } //同时给定价格上下限 - if(isset($input['start_price']) && isset($input['end_price'])){ + if(isset($input['start_price']) && isset($input['end_price']) + && $input['start_price'] != "" && $input['end_price'] != ""){ //确保上限大于下限 if($input['start_price'] > $input['end_price']){ - $temp = $input['start_price']; - $input['start_price'] = $input['end_price']; - $input['end_price'] = $temp; + $temp = $input['start_price']; + $input['start_price'] = $input['end_price']; + $input['end_price'] = $temp; } $data['goods'] = $data['goods']->where([ - ['price', '>=', $input['start_price']], - ['price', '<=', $input['end_price']] - ]); + ['price', '>=', $input['start_price']], + ['price', '<=', $input['end_price']] + ]); } //只设上限或下限时 else{ - if(isset($input['start_price'])) + if(isset($input['start_price']) && $input['start_price'] != "") $data['goods'] = $data['goods']->where('price', '>=', $input['start_price']); - if(isset($input['end_price'])) + if(isset($input['end_price']) && $input['end_price'] != "") $data['goods'] = $data['goods']->where('price', '<=', $input['end_price']); - } + } //对数量筛选只设下限 - if(isset($input['start_count'])) + if(isset($input['start_count']) && $input['start_count'] != "") $data['goods'] = $data['goods']->where('count', '>=', $input['start_count']); - else + else $data['goods'] = $data['goods']->where('count', '>', 0); // 最后在排序筛选baned==0以及paginate分页 // p为价格,c为数量,d为倒序,值相同时按id倒序排列 - if(isset($input['sort'])){ + if(isset($input['sort']) && $input['sort'] != ""){ if ($input['sort'] == 'old'){ - $data['goods'] = $data['goods']->orderby('id', 'asc')->where('baned', 0)->paginate(16); + $data['goods'] = $data['goods']->orderby('id', 'asc')->where('baned', 0)->paginate($paginate_limit); } elseif ($input['sort'] == 'p'){ - $data['goods'] = $data['goods']->orderby('price', 'asc')->orderby('id', 'desc')->where('baned', 0)->paginate(16); + $data['goods'] = $data['goods']->orderby('price', 'asc')->orderby('id', 'desc')->where('baned', 0)->paginate($paginate_limit); } elseif ($input['sort'] == 'pd') { - $data['goods'] = $data['goods']->orderby('price', 'desc')->orderby('id', 'desc')->where('baned', 0)->paginate(16); + $data['goods'] = $data['goods']->orderby('price', 'desc')->orderby('id', 'desc')->where('baned', 0)->paginate($paginate_limit); } elseif ($input['sort'] == 'c') { - $data['goods'] = $data['goods']->orderby('count', 'asc')->orderby('id', 'desc')->where('baned', 0)->paginate(16); + $data['goods'] = $data['goods']->orderby('count', 'asc')->orderby('id', 'desc')->where('baned', 0)->paginate($paginate_limit); } elseif ($input['sort'] == 'cd') { - $data['goods'] = $data['goods']->orderby('count', 'desc')->orderby('id', 'desc')->where('baned', 0)->paginate(16); + $data['goods'] = $data['goods']->orderby('count', 'desc')->orderby('id', 'desc')->where('baned', 0)->paginate($paginate_limit); } } //未指定排序规则时按id倒序排序 else - $data['goods'] = $data['goods']->orderby('id', 'desc')->where('baned', 0)->paginate(16); - if($request->session()->has('user_id')) - $data['user_id'] = $request->session()->get('user_id'); - else - $data['user_id'] = NULL; - if($request->session()->has('is_admin')) - $data['is_admin'] = $request->session()->get('is_admin'); - else - $data['is_admin'] = NULL; + $data['goods'] = $data['goods']->orderby('id', 'desc')->where('baned', 0)->paginate($paginate_limit); + if($request->session()->has('user_id')) + $data['user_id'] = $request->session()->get('user_id'); + else + $data['user_id'] = NULL; + if($request->session()->has('is_admin')) + $data['is_admin'] = $request->session()->get('is_admin'); + else + $data['is_admin'] = NULL; $data['page'] = 1; - if(isset($input['page'])) $data['page'] = $input['page']; + if(isset($input['page']) && $input['page'] != "") $data['page'] = $input['page']; + $data['cat_id'] = $cat_id; + $data['query'] = $query; + $data['start_price'] = $start_price; + $data['end_price'] = $end_price; + $data['start_count'] = $start_count; + $data['sort'] = $sort; + //dd($data['cat_id'] == ""); return view::make('good.goodList')->with($data); } diff --git a/public/js/good/good_list.js b/public/js/good/good_list.js index 9dce720..6b2371a 100644 --- a/public/js/good/good_list.js +++ b/public/js/good/good_list.js @@ -59,5 +59,16 @@ function setc(ha){ if($("#searchq").val()!=""){ hr=hr+"&query="+$("#searchq").val(); } + if(getUrlParam('cat_id')) + hr = hr + '&cat_id=' + getUrlParam('cat_id'); location.href=hr; +} + +function getUrlParam(name) +{ + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); + var r = window.location.search.substr(1).match(reg); + if (r != null) + return r[2]; + return null; } \ No newline at end of file diff --git a/resources/views/good/goodInfo.blade.php b/resources/views/good/goodInfo.blade.php index c0472ff..4bb8278 100644 --- a/resources/views/good/goodInfo.blade.php +++ b/resources/views/good/goodInfo.blade.php @@ -37,7 +37,10 @@

    {{ $good->good_name }}@if($good->baned)【已封禁】@endif

- 卖家:{{ $user->nickname }}@if($user->baned)【已封禁】@endif   和我联系 + 卖家:{{ $user->nickname }}@if($user->baned)【已封禁】@endif   + @if($user->baned) + 和我联系 + @endif
售价:

¥{{ $good->price }}

count==0) class="text-danger" @endif>@if($good->count>0) 库存:{{ $good->count }}件 @else 没库存了QAQ @endif

diff --git a/resources/views/good/goodList.blade.php b/resources/views/good/goodList.blade.php index f4ae8c8..397ad86 100644 --- a/resources/views/good/goodList.blade.php +++ b/resources/views/good/goodList.blade.php @@ -57,9 +57,17 @@
- {{ $goods->links() }} - @endforeach + @endforeach
+ {{ $goods->appends([ + 'start_price' => $start_price, + 'end_price' => $end_price, + 'start_count' => $start_count, + 'sort' => $sort, + 'query' => $query, + 'cat_id' => $cat_id + ]) + ->links() }}
From ab411aab0ce2c47145bc12b6669619d12c09d32c Mon Sep 17 00:00:00 2001 From: iborvs Date: Thu, 15 Jun 2017 13:00:34 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B0=8Fbug=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/user/userProfile.blade.php | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/resources/views/user/userProfile.blade.php b/resources/views/user/userProfile.blade.php index f963e48..5dc1e82 100644 --- a/resources/views/user/userProfile.blade.php +++ b/resources/views/user/userProfile.blade.php @@ -3,15 +3,17 @@ @section('title', "用户") @section('asset') - + @endsection @section('content') -
- -
-