完成了举报功能

添加了tickets, admin_events两张表
This commit is contained in:
yuki
2017-06-10 17:40:58 +08:00
parent 7a9d5674e2
commit 179f8f9105
8 changed files with 139 additions and 2 deletions
+26
View File
@@ -27,6 +27,7 @@ use App\Http\Controllers\Controller;
use Hash;
use Mail;
use Image;
use App\Ticket;
class UserController extends Controller
{
@@ -272,4 +273,29 @@ class UserController extends Controller
return view::make('user.buyer')->with($data);
}
public function reportSeller(Request $request, $seller_id)
{
$data = [];
$data['seller_id'] = $seller_id;
return view::make('user.report')->with($data);
}
/*
* 评价type=1 举报type=2
* 发布未领取state=0
* 已领取未处理state=1
* 已处理state=2
*/
public function sendRepo(Request $request, $seller_id)
{
$input = $request->all();
$ticket = new Ticket;
$ticket->sender_id = $request->session()->get('user_id');
$ticket->receiver_id = $seller_id;
$ticket->type = 2;
$ticket->message = $input['reason'];
$ticket->save();
return View::make('common.errorPage')->withErrors('举报成功!');
}
}
+3
View File
@@ -81,6 +81,9 @@ Route::group(['middleware' => ['web']],function () {
Route::get('/avatar/{user_id}', "UserController@getSimpleAvatar");
Route::get('/avatar/{user_id}/{width}/{height}', "UserController@getAvatar");
Route::get('/report/{seller_id}', "UserController@reportSeller")->middleware('auth');
Route::post('/sendRepo/{seller_id}', "UserController@sendRepo");
Route::get('/good', "GoodController@getList");
Route::get('/good/add', "GoodController@showAddGood")->middleware('auth');
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Ticket extends Model
{
//
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTicketsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tickets', function (Blueprint $table) {
$table->increments('id');
$table->integer('sender_id');
$table->integer('trans_id');
$table->integer('receiver_id');
$table->tinyInteger('type');
$table->string('message');
$table->integer('assignee');
$table->integer('state');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tickets');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAdminEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('admin_events', function (Blueprint $table) {
$table->increments('id');
$table->integer('admin_id');
$table->integer('target_user');
$table->string('event');
$table->integer('ticket_id')->nullable();
$table->text('message');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('admin_events');
}
}
+7
View File
@@ -30,6 +30,7 @@
<div class="row">
<div class="small-12 medium-5 columns block" style="background-color: white;">
<a href="/user/{{ $good->user_id }}">卖家</a>
<a id="pic" href="/good/{{ sha1($good->id) }}/titlepic"><img alt="" class="thumbnail" src="/good/{{ sha1($good->id) }}/titlepic" /></a>
</div>
<div class="small-12 medium-6 medium-offset-1 columns block" style="background-color: white;margin-bottom: 10px;margin-top:10px">
@@ -87,6 +88,12 @@
</div>
</div>
<div class="row hide-for-small-only">
@if($good->user_id != Session::get('user_id'))
<a class="button" href="/report/{{ $good->user_id }}">举报该卖家</a>
@endif
</div>
<div class="row">
<div id="" class="small-12 medium-12 columns" style="background-color: white">
<h3>商品介绍: </h3>
+17
View File
@@ -0,0 +1,17 @@
@extends('layout.master')
@section('title', "举报")
@section('content')
<div class="row">
<form action="/sendRepo/{{ $seller_id }}" method="POST">
{!! csrf_field() !!}
<label class="right inline">举报理由:</label>
<textarea name="reason"></textarea>
<input class="button" type="submit" name="submit1"
value="确认举报"/>
</form>
</div>
@endsection