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 - -
#交易单号 卖家学号 买家学号 商品ID