Merge branch 'yukiyukiyu-master'

This commit is contained in:
LI JIAHAO
2017-06-17 21:47:01 +08:00
6 changed files with 225 additions and 7 deletions
+4 -1
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
@@ -28,7 +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['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);
}
@@ -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)->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();
return View::make('welcome')->with($data);
}
+3 -1
View File
@@ -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()
@@ -32,4 +33,5 @@ class Transaction extends Model
{
return $this->hasOne('App\Ticket', 'trans_id');
}
}
+10
View File
@@ -39,4 +39,14 @@ class User extends Model
return $this->belongsTo('App\Wechat', "wechat_open_id", "open_id");
}
public function getcoding()
{
$len=strlen($this->stuid);
$ans = "";
$ans = $ans . substr($this->stuid, 0, 1);
for($i=1; $i<($len-1); $i++) $ans = $ans . '*';
$ans = $ans . substr($this->stuid, -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>用户ID</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><a href="/user/{{$user->id}}">{{$user->nickname}}</a></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
+94 -1
View File
@@ -4,8 +4,85 @@
@section('asset')
<link rel="stylesheet" href="/css/wel.css" />
<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;
}
.slide-list li.odd{
background: rgba(51,79,109,.2);
}
</style>
<script>
var doscroll = function(){
var $parent = $('.js-slide-list');
var $first = $parent.find('li:first');
var height = $first.height();
$first.animate({
marginTop: -height + 'px'
}, 500, function() {
$first.css('marginTop', 0).appendTo($parent);
});
};
setInterval(function(){doscroll()}, 2000);
</script>
@endsection
@section('content')
<div class="row">
@@ -165,7 +242,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 +255,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 class="odd"><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>