Commit at 2017/06/15 14:45

This commit is contained in:
catsworld
2017-06-15 14:45:37 +08:00
12 changed files with 500 additions and 170 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ use App\User;
use App\Announcement;
use App\Http\Controllers\Controller;
use App\Ticket;
use Mews\Purifier\Purifier;
class AdminController extends Controller
{
@@ -130,7 +131,7 @@ class AdminController extends Controller
$input = $request->all();
$announcement = new Announcement;
$announcement->title = $input['title'];
$announcement->content = $input['content'];
$announcement->content = clean($input['content']);
$announcement->save();
return Redirect::to('/admin');
}
+63 -35
View File
@@ -23,6 +23,7 @@ use Storage;
use Image;
use App\Http\Requests\AddGoodRequest;
use App\Http\Requests\EditGoodRequest;
use Mews\Purifier\Purifier;
class GoodController extends Controller
{
@@ -34,75 +35,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);
}
@@ -182,7 +203,7 @@ class GoodController extends Controller
$good = new GoodInfo;
$good->good_name = $input['good_name'];
$good->cat_id = $input['cat_id'];
$good->description = $input['description'];
$good->description = clean($input['description']);
$good->price = $input['price'];
$good->type = $input['type'];
$good->count = $input['count'];
@@ -246,7 +267,7 @@ class GoodController extends Controller
return Redirect::to('/good/'.$good_id);
$good->good_name=$input['good_name'];
$good->cat_id=$input['cat_id'];
$good->description=$input['description'];
$good->description= clean($input['description']);
$good->price=$input['price'];
$good->type=$input['type'];
$good->count=$input['count'];
@@ -295,6 +316,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, "【系统消息】您好!由于该商品被卖家删除,您的<a href='/user/trans'>订单(编号:".$tran->id.")</a>已被取消。非常抱歉。");
$tran->update();
}
return Redirect::to('/good');
}
@@ -370,7 +398,7 @@ class GoodController extends Controller
MessageController::sendMessageHandle($admin_id, $good->user_id, "【系统消息】您好!您的<a href='/good/" . $good_id ."'>商品(编号:".$good_id.")</a>由于不符合有关规定已被管理员(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;
@@ -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;
+2 -1
View File
@@ -10,7 +10,8 @@
"intervention/image": "^2.3",
"laravel/browser-kit-testing": "^1.0",
"satooshi/php-coveralls": "^1.0",
"jasig/phpcas": "^1.3"
"jasig/phpcas": "^1.3",
"mews/purifier": "^2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Generated
+134 -25
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "ba8ffb9ee316786406c6e5e5594b771f",
"content-hash": "532bb9f36654d490014eddaf16a312c8",
"packages": [
{
"name": "doctrine/inflector",
@@ -115,6 +115,50 @@
],
"time": "2017-03-29T16:04:15+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.8.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2",
"reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"type": "library",
"autoload": {
"psr-0": {
"HTMLPurifier": "library/"
},
"files": [
"library/HTMLPurifier.composer.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"time": "2016-07-16T12:58:58+00:00"
},
{
"name": "guzzle/guzzle",
"version": "v3.9.3",
@@ -649,6 +693,71 @@
],
"time": "2017-04-28T10:15:08+00:00"
},
{
"name": "mews/purifier",
"version": "v2.0.7",
"source": {
"type": "git",
"url": "https://github.com/mewebstudio/Purifier.git",
"reference": "e7cb532acbb9f5aaed4d62fe21fe387c8abf18db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mewebstudio/Purifier/zipball/e7cb532acbb9f5aaed4d62fe21fe387c8abf18db",
"reference": "e7cb532acbb9f5aaed4d62fe21fe387c8abf18db",
"shasum": ""
},
"require": {
"ezyang/htmlpurifier": "4.8.*",
"illuminate/config": "5.1.*|5.2.*|5.3.*|5.4.*",
"illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*",
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*",
"php": ">=5.5.9"
},
"require-dev": {
"graham-campbell/testbench": "^3.2",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "^4.8|^5.0",
"scrutinizer/ocular": "^1.3"
},
"suggest": {
"laravel/framework": "To test the Laravel bindings",
"laravel/lumen-framework": "To test the Lumen bindings"
},
"type": "package",
"autoload": {
"psr-4": {
"Mews\\Purifier\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Muharrem ERİN",
"email": "me@mewebstudio.com",
"homepage": "https://github.com/mewebstudio",
"role": "Developer"
}
],
"description": "Laravel 5 HtmlPurifier Package",
"homepage": "https://github.com/mewebstudio/purifier",
"keywords": [
"Purifier",
"htmlpurifier",
"laravel5 HtmlPurifier",
"laravel5 Purifier",
"laravel5 Security",
"security",
"xss"
],
"time": "2017-04-16T12:23:45+00:00"
},
{
"name": "monolog/monolog",
"version": "1.22.1",
@@ -2284,7 +2393,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/fzaninotto/Faker/44f9a286a04b80c76a4e5fb7aad8bb539b920123.zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123",
"reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123",
"shasum": ""
},
@@ -2377,7 +2486,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/padraic/mockery/6fdb61243844dc924071d3404bb23994ea0b6856.zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/6fdb61243844dc924071d3404bb23994ea0b6856",
"reference": "6fdb61243844dc924071d3404bb23994ea0b6856",
"shasum": ""
},
@@ -2442,7 +2551,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/myclabs/DeepCopy/8e6e04167378abf1ddb4d3522d8755c5fd90d102.zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"shasum": ""
},
@@ -2484,7 +2593,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/ReflectionCommon/144c307535e82c8fdcaacbcfc1d6d8eeb896687c.zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": ""
},
@@ -2538,7 +2647,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/ReflectionDocBlock/8331b5efe816ae05461b7ca1e721c01b46bafb3e.zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"shasum": ""
},
@@ -2583,7 +2692,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/TypeResolver/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb.zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"shasum": ""
},
@@ -2630,7 +2739,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/phpspec/prophecy/93d39f1f7f9326d746203c7c056f300f7f126073.zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073",
"reference": "93d39f1f7f9326d746203c7c056f300f7f126073",
"shasum": ""
},
@@ -2693,7 +2802,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/php-code-coverage/ef7b2f56815df854e66ceaee8ebe9393ae36a40d.zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"shasum": ""
},
@@ -2756,7 +2865,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-file-iterator/3cc8f69b3028d0f96a9078e6295d86e9bf019be5.zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": ""
},
@@ -2844,7 +2953,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/php-timer/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f.zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"shasum": ""
},
@@ -2893,7 +3002,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/php-token-stream/e03f8f67534427a787e21a385a67ec3ca6978ea7.zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7",
"shasum": ""
},
@@ -2942,7 +3051,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/phpunit/3cb94a5f8c07a03c8b7527ed7468a2926203f58b.zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cb94a5f8c07a03c8b7527ed7468a2926203f58b",
"reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b",
"shasum": ""
},
@@ -3024,7 +3133,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/phpunit-mock-objects/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24.zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
"reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
"shasum": ""
},
@@ -3083,7 +3192,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/code-unit-reverse-lookup/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18.zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"shasum": ""
},
@@ -3128,7 +3237,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/comparator/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be.zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"shasum": ""
},
@@ -3192,7 +3301,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/diff/7f066a26a962dbe58ddea9f72a4e82874a3975a4.zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"shasum": ""
},
@@ -3244,7 +3353,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/environment/5795ffe5dc5b02460c3e34222fee8cbe245d8fac.zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"shasum": ""
},
@@ -3294,7 +3403,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/exporter/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4.zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"shasum": ""
},
@@ -3412,7 +3521,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/object-enumerator/1311872ac850040a79c3c058bea3e22d0f09cbb7.zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
"shasum": ""
},
@@ -3458,7 +3567,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/recursion-context/2c3ba150cbec723aa057506e73a8d33bdb286c9a.zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"shasum": ""
},
@@ -3511,7 +3620,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/resource-operations/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52.zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"shasum": ""
},
@@ -3553,7 +3662,7 @@
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/sebastianbergmann/version/99732be0ddb3361e16ad77b68ba41efc8e979019.zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
"shasum": ""
},
@@ -3596,7 +3705,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/symfony/dom-crawler/dff8fecf1f56990d88058e3a1885c2a5f1b8e970.zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/dff8fecf1f56990d88058e3a1885c2a5f1b8e970",
"reference": "dff8fecf1f56990d88058e3a1885c2a5f1b8e970",
"shasum": ""
},
@@ -3652,7 +3761,7 @@
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/webmozart/assert/2db61e59ff05fe5126d152bd0655c9ea113e550f.zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
"shasum": ""
},
+2
View File
@@ -158,6 +158,7 @@ return [
App\Providers\RouteServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
Mews\Purifier\PurifierServiceProvider::class,
],
/*
@@ -204,6 +205,7 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Image' => Intervention\Image\Facades\Image::class,
'Purifier' => Mews\Purifier\Facades\Purifier::class,
],
+105
View File
@@ -0,0 +1,105 @@
<?php
/**
* Ok, glad you are here
* first we get a config instance, and set the settings
* $config = HTMLPurifier_Config::createDefault();
* $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
* $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
* if ( ! $this->config->get('purifier.finalize')) {
* $config->autoFinalize = false;
* }
* $config->loadArray($this->getConfig());
*
* You must NOT delete the default settings
* anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
*
* @link http://htmlpurifier.org/live/configdoc/plain.html
*/
return [
'encoding' => 'UTF-8',
'finalize' => true,
'cachePath' => storage_path('app/purifier'),
'cacheFileMode' => 0755,
'settings' => [
'default' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
],
'test' => [
'Attr.EnableID' => 'true',
],
"youtube" => [
"HTML.SafeIframe" => 'true',
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
],
'custom_definition' => [
'id' => 'html5-definitions',
'rev' => 1,
'debug' => false,
'elements' => [
// http://developers.whatwg.org/sections.html
['section', 'Block', 'Flow', 'Common'],
['nav', 'Block', 'Flow', 'Common'],
['article', 'Block', 'Flow', 'Common'],
['aside', 'Block', 'Flow', 'Common'],
['header', 'Block', 'Flow', 'Common'],
['footer', 'Block', 'Flow', 'Common'],
// Content model actually excludes several tags, not modelled here
['address', 'Block', 'Flow', 'Common'],
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
// http://developers.whatwg.org/grouping-content.html
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
['figcaption', 'Inline', 'Flow', 'Common'],
// http://developers.whatwg.org/the-video-element.html#the-video-element
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
'width' => 'Length',
'height' => 'Length',
'poster' => 'URI',
'preload' => 'Enum#auto,metadata,none',
'controls' => 'Bool',
]],
['source', 'Block', 'Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
]],
// http://developers.whatwg.org/text-level-semantics.html
['s', 'Inline', 'Inline', 'Common'],
['var', 'Inline', 'Inline', 'Common'],
['sub', 'Inline', 'Inline', 'Common'],
['sup', 'Inline', 'Inline', 'Common'],
['mark', 'Inline', 'Inline', 'Common'],
['wbr', 'Inline', 'Empty', 'Core'],
// http://developers.whatwg.org/edits.html
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
],
'attributes' => [
['iframe', 'allowfullscreen', 'Bool'],
['table', 'height', 'Text'],
['td', 'border', 'Text'],
['th', 'border', 'Text'],
['tr', 'width', 'Text'],
['tr', 'height', 'Text'],
['tr', 'border', 'Text'],
],
],
'custom_attributes' => [
['a', 'target', 'Enum#_blank,_self,_target,_top'],
],
'custom_elements' => [
['u', 'Inline', 'Inline', 'Common'],
],
],
];
+11
View File
@@ -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;
}
+59 -3
View File
@@ -10,6 +10,7 @@
<li class="nav-item"><a class="nav-link active" href="#announcement" role="tab" data-toggle="tab" aria-controls="announcement">公告管理</a></li>
<li class="nav-item"><a class="nav-link" href="#classify" role="tab" data-toggle="tab" aria-controls="classify">分类管理</a></li>
<li class="nav-item"><a class="nav-link" href="#report" role="tab" data-toggle="tab" aria-controls="report">查看举报记录</a></li>
<li class="nav-item"><a class="nav-link" href="#userlist" role="tab" data-toggle="tab" aria-controls="userlist">查看所有用户</a></li>
</ul>
</div>
@@ -100,9 +101,22 @@
@foreach($reports as $repo)
<tbody>
<tr>
<td>{{ $repo->id }}</td>
<td>{{ $repo->sender_id }}</td>
<td>{{ $repo->receiver_id }}</td>
<td><a href="#repo{{$repo->id}}" data-toggle="modal">{{ $repo->id }}</a></td>
<td><a href="#repo{{$repo->id}}" data-toggle="modal">{{ $repo->sender_id }}</a></td>
<td><a href="#repo{{$repo->id}}" data-toggle="modal">{{ $repo->receiver_id }}</a></td>
<div class="modal fade" id="repo{{$repo->id}}" tabindex="-1" role="dialog" aria-labelledby="repo{{$repo->id}}Label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">举报理由:</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
{{ $repo->message }}
</div>
</div>
</div>
</div>
@if(!$repo->assignee)
<td>
<form action="/repo/{{ $repo->id }}/assign" method="POST">
@@ -144,6 +158,48 @@
</table>
{{ $reports->links() }}
</div>
<div class="tab-pane" id="userlist" role="tabpanel">
<table class="table table-hover">
<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>{{$user->id}}</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>
</div>
<script>
// WYSIWYG Editor
+4 -1
View File
@@ -37,7 +37,10 @@
</span>
<h2 style="margin-left:10px;display:inline-block;word-break:break-all">{{ $good->good_name }}@if($good->baned)【已封禁】@endif</h2>
</div>
卖家:<a href="/user/{{ $user->id }}">{{ $user->nickname }}@if($user->baned)【已封禁】@endif</a>@if(Session::get('user_id') != $user->id) &nbsp; <a href="/message/startConversation/{{ $user->id }}">和我联系</a> @endif
卖家:<a href="/user/{{ $user->id }}">{{ $user->nickname }}@if($user->baned)【已封禁】@endif</a> &nbsp;
@if($user->baned)
<a href="/message/startConversation/{{ $user->id }}">和我联系</a>
@endif
<div><!-- 放tag 和更多图片缩略图 --></div>
<div>售价:<h3 style="display:inline-block"><b class="text-warning">¥{{ $good->price }}</b></h3></div>
<div @if($good->count==0) class="text-danger" @endif>@if($good->count>0) 库存:{{ $good->count }}件 @else 没库存了QAQ @endif</div><br/>
+10 -2
View File
@@ -57,9 +57,17 @@
</a>
</div>
</div>
{{ $goods->links() }}
@endforeach
@endforeach
</div>
{{ $goods->appends([
'start_price' => $start_price,
'end_price' => $end_price,
'start_count' => $start_count,
'sort' => $sort,
'query' => $query,
'cat_id' => $cat_id
])
->links() }}
</div>
</div>
<script src="/js/good/cat.js"></script>
+105 -100
View File
@@ -3,121 +3,126 @@
@section('title', "用户")
@section('asset')
<style>
@media (max-width: 770px) {
#profile_bt {
height: 40px;
}
}
</style>
<script src="/js/good/good_list.js"></script>
@endsection
@section('content')
<div class="row">
<div class="column">
<h2>
@if(isset($user->nickname))
{{ $user->nickname }}
@if($user->baned)
【已封禁】
@endif
@else
还没有昵称&gt;&lt;
@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'))
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-54c0e6.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 1)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-a31b3f.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 2)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-3ca88e.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 3)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-d58d15.svg">
@elseif(intval(substr($user->stuid, 0, 4)) < 2000 + env('FRESH_YEAR') - 3)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E6%A0%A1%E5%8F%8B%E8%AE%A4%E8%AF%81-bfbfbf.svg">
<div class="card">
<div class="card-header">
<div class="row" style="margin-bottom:10px">
<div class="col-md-7 col-sm-12">
<img src="/avatar/{{ $user->id }}/150/150" style="width:150px; height:150px; border-radius:50%; overflow:hidden;margin-bottom:10px" />
<div class="column" style="margin-bottom:10px;padding-left:5px">
@if(isset($user->nickname))
用户名: {{ $user->nickname }}
@if($user->baned)
【已封禁】
@endif
@else
还没有昵称&gt;&lt;
@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'))
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-54c0e6.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 1)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-a31b3f.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 2)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-3ca88e.svg">
@elseif(intval(substr($user->stuid, 0, 4)) == 2000 + env('FRESH_YEAR') - 3)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E5%AD%A6%E7%94%9F%E8%AE%A4%E8%AF%81-d58d15.svg">
@elseif(intval(substr($user->stuid, 0, 4)) < 2000 + env('FRESH_YEAR') - 3)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E6%A0%A1%E5%8F%8B%E8%AE%A4%E8%AF%81-bfbfbf.svg">
@endif
@elseif(strlen($user->stuid) == 7)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E7%A0%94%E7%A9%B6%E7%94%9F%E8%AE%A4%E8%AF%81-ec3468.svg">
@elseif(strlen($user->stuid) == 5)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E6%95%99%E8%81%8C%E5%B7%A5%E8%AE%A4%E8%AF%81-000000.svg">
@endif
@endif
@if($user->privilege == 1)
<img src="https://img.shields.io/badge/%E5%85%88%E9%94%8B%E5%B8%82%E5%9C%BA-%E7%AE%A1%E7%90%86%E5%91%98-9300dd.svg">
@elseif($user->privilege == 2)
<img src="https://img.shields.io/badge/%E5%85%88%E9%94%8B%E5%B8%82%E5%9C%BA-%E7%AE%A1%E7%90%86%E5%91%98-ee0000.svg">
@endif
@elseif(strlen($user->stuid) == 7)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E7%A0%94%E7%A9%B6%E7%94%9F%E8%AE%A4%E8%AF%81-ec3468.svg">
@elseif(strlen($user->stuid) == 5)
<img src="https://img.shields.io/badge/%E4%B8%9C%E5%8C%97%E5%A4%A7%E5%AD%A6-%E6%95%99%E8%81%8C%E5%B7%A5%E8%AE%A4%E8%AF%81-000000.svg">
@endif
@endif
@if($user->privilege == 1)
<img src="https://img.shields.io/badge/%E5%85%88%E9%94%8B%E5%B8%82%E5%9C%BA-%E7%AE%A1%E7%90%86%E5%91%98-9300dd.svg">
@elseif($user->privilege == 2)
<img src="https://img.shields.io/badge/%E5%85%88%E9%94%8B%E5%B8%82%E5%9C%BA-%E7%AE%A1%E7%90%86%E5%91%98-ee0000.svg">
@endif
</h2>
</div>
</div>
<div class="row">
<div class="column" style="max-width: 256px">
<p>
<img src="/avatar/{{ $user->id }}/256/256"/>
</p>
<p>
<input type="button" value="和他联系" class="button"
onclick="window.location.href='/message/startConversation/{{ $user->id }}'"/>
@if(Session::get('user_id') == $user->id)
@elseif(Session::get('is_admin') >= 1)
<form action="/user/{{ $user->id }}/banpage" method="GET">
<input type="submit" class="button" value="封禁该用户">
</form>
@else
<form action="/report/{{ $user->id }}" method="GET">
<input type="submit" class="button" value="举报该用户">
</form>
@endif
</p>
</div>
<div class="column medium-8 large-9">
<ul class="tabs" data-tabs id="editinfo">
<li class="tabs-title is-active"><a href="#goods" aria-selected="true">他的商品</a></li>
<li class="tabs-title"><a href="#tickets">历史评价</a></li>
</ul>
<div class="tabs-content" data-tabs-content="editinfo">
<div class="tabs-panel" id="goods">
<div class="card-section">
<div class="row table-responsive">
<table class="table">
<tr>
<td>#</td>
<td>商品名称</td>
<td>商品价格</td>
<td>剩余库存</td>
</tr>
@foreach($goods as $good)
<tr id="good{{ $good->id }}">
<td>{{ $good->id }}</td>
<td><a href="/good/{{$good->id}}"
onMouseOver="toolTip('<img src=/good/{{ sha1($good->id) }}/titlepic>')"
onMouseOut="toolTip()">{{ $good->good_name }}</a></td>
<td>{{ $good->price }}</td>
<td>{{ $good->count }}</td>
</tr>
@endforeach
{{ $goods->links() }}
</table>
</div>
</div>
</div>
<div class="tabs-panel" id="tickets">
<div class="col-md-5 col-sm-12" id="profile_bt">
@if(Session::get('user_id') == $user->id)
@elseif(Session::get('is_admin') >= 1)
<form action="/user/{{ $user->id }}/banpage" method="GET" style="position:absolute;bottom:0px">
<input type="button" value="和他联系" class="btn btn-info"
onclick="window.location.href='/message/startConversation/{{ $user->id }}'"/>
<input type="submit" class="btn btn-danger" value="封禁该用户">
</form>
@else
<form action="/report/{{ $user->id }}" method="GET" style="position:absolute;bottom:0px">
<input type="button" value="和他联系" class="btn btn-info"
onclick="window.location.href='/message/startConversation/{{ $user->id }}'"/>
<input type="submit" class="btn btn-danger" value="举报该用户">
</form>
@endif
</div>
</div>
<ul class="nav nav-tabs card-header-tabs" role="tablist">
<li class="nav-item"><a class="nav-link active" href="#goods" aria-controls="goods" role="tab" data-toggle="tab">他的商品</a></li>
<li class="nav-item"><a class="nav-link" href="#tickets" aria-controls="tickets" role="tab" data-toggle="tab">历史评价</a></li>
</ul>
</div>
<div class="tab-content card-block">
<div role="tabpanel" class="tab-pane active" id="goods">
<div class="row">
@foreach($goods as $good)
<div class="col-6 col-md-4 col-lg-3">
<div class="good" style="margin-bottom:20px;">
<a href="/good/{{ $good->id }}">
<div class="card">
<div class="card-img-top">
<img src="/good/{{ sha1($good->id) }}/titlepic" title="{{ $good->good_name }}" style="width:100%"/>
</div>
<div class="card-block">
<div style="word-break:break-all">{{ $good->good_name }}</div>
<div class="text-warning"><b>¥{{ $good->price }}</b></div>
@if($good->count==0)
<div class="text-danger">无库存QAQ</div>
@else
<div>库存:{{ $good->count }}</div>
@endif
</div>
</div>
</a>
</div>
</div>
{{ $goods->links() }}
@endforeach
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tickets">
<div class="card-section">
<div id="tickets-container" class="card-section">
<ul>
@foreach($tickets as $ticket)
<li>
<div class="card card-block" style="margin-bottom: 5px">
<label>{{ $ticket->created_at }}
@if($ticket->type == 1)
评价
一只小萌妹评价了TA说:
@else
举报
一只小萌妹举报了TA说:
@endif
</label>
<p>{{ $ticket->message }}</p>
</li>
</div>
@endforeach
</ul>
</div>
</div>
</div>