完善了管理员界面的功能,添加了首页的滚动公示牌

This commit is contained in:
yuki
2017-06-17 02:05:23 +08:00
parent d75e6f3162
commit 20ebce97f4
7 changed files with 227 additions and 15 deletions
+3
View File
@@ -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);
}
@@ -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);
}
+10 -10
View File
@@ -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);
}
+1
View File
@@ -32,4 +32,5 @@ class Transaction extends Model
{
return $this->hasOne('App\Ticket', 'trans_id');
}
}
+10
View File
@@ -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;
}
}
+112 -4
View File
@@ -7,7 +7,9 @@
<ul class="tabs" data-tabs="w6tmms-tabs" id="editadmin" role="tablist">
<li class="tabs-title is-active " role="presentation"><a href="#announcement" aria-selected="true" role="tab" aria-controls="extra" id="extra-label">公告管理</a></li>
<li class="tabs-title " role="presentation"><a href="#classify" role="tab" aria-controls="account" aria-selected="false" id="account-label">分类管理</a></li>
<li class="tabs-title "><a href="#report">查看举报记录</a></li>
<li class="tabs-title"><a href="#report">查看举报记录</a></li>
<li class="tabs-title"><a href="#userlist">查看所有用户</a></li>
<li class="tabs-title"><a href="#translist">交易列表</a></li>
</ul>
<div class="tabs-content" data-tabs-content="editadmin">
@@ -91,6 +93,7 @@
<th>#</th>
<th>举报者ID</th>
<th>被举报者ID</th>
<th>举报理由</th>
<th>受理管理员ID</th>
<th colspan="2">状态</th>
</tr>
@@ -98,9 +101,10 @@
@foreach($reports as $repo)
<tbody>
<tr>
<td>{{ $repo->id }}</td>
<td>{{ $repo->sender_id }}</td>
<td>{{ $repo->receiver_id }}</td>
<td>{{$repo->id}}</td>
<td><a href="/user/{{$repo->sender_id}}">{{$repo->sender_id}}</a></td>
<td><a href="/user/{{$repo->receiver_id}}">{{$repo->receiver_id}}</a></td>
<td>{{$repo->message}}</td>
@if(!$repo->assignee)
<td>
<form action="/repo/{{ $repo->id }}/assign" method="POST">
@@ -144,6 +148,110 @@
{{ $reports->links() }}
</div>
<div class="tabs-panel" id="userlist">
<div class="card-section">
<table>
<thead>
<tr>
<th>#</th>
<th>权限</th>
<th>学号</th>
<th>真实姓名</th>
<th>昵称</th>
<th>用户名</th>
<th>邮箱</th>
<th>是否封禁</th>
<th>注册时间</th>
</tr>
</thead>
@foreach($users as $user)
<tbody>
<tr>
<td><a href="/user/{{$user->id}}">{{$user->id}}</a></td>
<td>{{$user->privilege}}</td>
<td>{{$user->stuid}}</td>
<td>{{$user->realname}}</td>
<td>{{$user->nickname}}</td>
<td>{{$user->username}}</td>
<td>{{$user->email}}</td>
<td>
@if($user->baned == 0)
否
@endif
@if($user->baned == 1)
已封禁{{$user->banedtime}}天
@endif
@if($user->baned == -1)
已永久封禁
@endif
</td>
<td>{{$user->created_at}}</td>
</tr>
</tbody>
@endforeach
</table>
</div>
{{ $users->links() }}
</div>
<div class="tabs-panel" id="translist">
<div class="card-section">
<table>
<thead>
<tr>
<th>#</th>
<th>卖家学号</th>
<th>买家学号</th>
<th>商品ID</th>
<th>交易数目</th>
<th>交易状态</th>
<th>评价</th>
</tr>
</thead>
@foreach($trans as $tran)
@if($tran->seller != NULL)
<tbody>
<tr>
<td>{{$tran->id}}</td>
<td><a href="/user/{{$tran->seller->id}}">{{$tran->seller->stuid}}</a></td>
<td><a href="/user/{{$tran->buyer_id}}">{{$tran->buyer->stuid}}</a></td>
<td><a href="/good/{{$tran->good_id}}">{{$tran->good_id}}</a></td>
<td>{{$tran->number}}</td>
<td>
@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
</td>
<td>
@if($tran->status == 5)
{{$tran->reason}}
@else
无
@endif
</td>
</tr>
</tbody>
@endif
@endforeach
</table>
</div>
{{ $trans->links() }}
</div>
</div>
<script>
// WYSIWYG
+89 -1
View File
@@ -6,6 +6,64 @@
<link rel="stylesheet" href="/css/wel.css" />
@endsection
<style>
.slide-title{
background: rgba(0,0,0,.5);
color: #fff;
height: 34px;
line-height: 34px;
padding: 0 10px;
font-size: 12px;
font-weight: bold;
}
.slide-title span{
float: left;
margin-right: 0px;
}
.slide-title span:nth-child(1),
.slide-list li span:nth-child(1){
width: 1500px;
}
.slide-title span:nth-child(2),
.slide-list li span:nth-child(2){
width: 1500px;
}
.slide-title span:nth-child(3),
.slide-list li span:nth-child(3){
width: 1500px;
}
.slide-container{
position: relative;
overflow: hidden;
height: 90px;
}
.slide-list{
position: absolute;
width: 100%;
left: 0;
top: 0;
color: #000;
margin: 0;
padding: 0;
}
.slide-list li {
height: 30px;
line-height: 30px;
list-style: none;
margin: 0;
padding: 3px;
}
.slide-list li span {
display: inline-block;
margin-right: 0px;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
@section('content')
<div class="row">
@@ -165,7 +223,7 @@
@endif
@endforeach
</div>
<div class="hide-for-medium-only large-5 columns">
<div class="large-5 columns">
<div class="row">
<div class="medium-10 medium-offset-2 columns">
<div class="card">
@@ -178,6 +236,22 @@
</div>
</div>
</div>
<div class="row">
<div class="medium-10 medium-offset-2 columns">
<div class="slide-title">
<h4>交易公示牌OvO</h4>
</div>
<div class="slide-container">
<ul class="slide-list js-slide-list">
@foreach($trans as $tran)
@if($tran->seller != NULL)
<li><span>恭喜{{$tran->seller->getcoding()}}和{{$tran->buyer->getcoding()}}成功完成了一笔交易!OvO</span></li>
@endif
@endforeach
</ul>
</div>
</div>
</div>
</div>
</div>
<script src="/js/good/cat.js"></script>
@@ -186,3 +260,17 @@
</div>
</div>
@endsection
<script>
var doscroll = function(){
var $parent = $('.js-slide-list');
var $first = $parent.find('li:first');
var height = $first.height();
$first.animate({
height: 0
}, 500, function() {
$first.css('height', height).appendTo($parent);
});
};
setInterval(function(){doscroll()}, 2000);
</script>