Merge branch 'master' into catsworld-master
This commit is contained in:
@@ -161,6 +161,12 @@ class GoodController extends Controller
|
||||
|
||||
public function addGood(AddGoodRequest $request)
|
||||
{
|
||||
$user_id = $request->session()->get('user_id');
|
||||
$user = User::find($user_id);
|
||||
if(!$user || $user->baned)
|
||||
return Redirect::back()->withInput()->withErrors('您的账号被封禁,请联系系统管理员');
|
||||
if(UserInfo::where('user_id', $user_id)->count() == 0)
|
||||
return Redirect::back()->withInput()->withErrors('你必须添加联系方式才能出售');
|
||||
$input = $request->all();
|
||||
$good = new GoodInfo;
|
||||
$good->good_name = $input['good_name'];
|
||||
@@ -169,7 +175,7 @@ class GoodController extends Controller
|
||||
$good->price = $input['price'];
|
||||
$good->type = $input['type'];
|
||||
$good->count = $input['count'];
|
||||
$good->user_id = $request->session()->get('user_id');
|
||||
$good->user_id = $user_id;
|
||||
$good->baned = '0';
|
||||
$good->save();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\MessageContact;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use App\Ticket;
|
||||
use App\UserInfo;
|
||||
|
||||
class TransactionController extends Controller
|
||||
{
|
||||
@@ -24,6 +25,11 @@ class TransactionController extends Controller
|
||||
public function add(Request $request, $good_id)
|
||||
{
|
||||
$user_id = $request->session()->get('user_id');
|
||||
$user = User::find($user_id);
|
||||
if(!$user || $user->baned)
|
||||
return Redirect::back()->withInput()->withErrors('您的账号被封禁,请联系系统管理员');
|
||||
if(UserInfo::where('user_id', $user_id)->count() == 0)
|
||||
return Redirect::back()->withInput()->withErrors('你必须添加联系方式才能购买');
|
||||
$count = $request->count;
|
||||
$result = $this->buy($good_id, $user_id, $count, $request->ip());
|
||||
$result = json_decode($result, true);
|
||||
|
||||
@@ -26,12 +26,14 @@ class StoreUserInfoRequest extends Request
|
||||
if($this->method()=='GET') return [];
|
||||
return [
|
||||
'realname'=>'required',
|
||||
'tel_num'=>'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(){
|
||||
return [
|
||||
'realname.required' => '真实姓名不可为空!',
|
||||
'tel_num.required' => '手机号不可为空!',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateUserInfoTable extends Migration
|
||||
$table->integer('user_id');
|
||||
$table->boolean('gender')->nullable();
|
||||
$table->string('realname');
|
||||
$table->string('tel_num')->nullable();
|
||||
$table->string('tel_num');
|
||||
$table->string('QQ')->nullable();
|
||||
$table->string('wechat')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
|
||||
@@ -54,6 +54,11 @@
|
||||
<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/>
|
||||
@if (count($errors) > 0)
|
||||
<label>
|
||||
<span class="form-error is-visible">{!! $errors->first() !!}</span>
|
||||
</label>
|
||||
@endif
|
||||
@if(($good->user_id) != Session::get('user_id'))
|
||||
<form action="/good/{{ $good->id }}/buy" method="post">
|
||||
<div class="input-group">
|
||||
|
||||
@@ -4,8 +4,116 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ json_encode($tran) }}
|
||||
{{ json_encode($seller) }}
|
||||
{{ json_encode($buyer) }}
|
||||
<h3>订单信息</h3>
|
||||
<div class="card-section">
|
||||
<div class="row table-responsive">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>订单编号</td>
|
||||
<td>商品名称</td>
|
||||
<td>数量</td>
|
||||
<td>订单状态</td>
|
||||
<td>操作</td>
|
||||
</tr>
|
||||
<tr id="tran{{ $tran->id }}">
|
||||
<td>{{ $tran->id }}</td>
|
||||
<td><a href="/good/{{$tran->good_id}}"
|
||||
onMouseOver="toolTip('<img src=/good/{{ sha1($tran->good_id) }}/titlepic>')"
|
||||
onMouseOut="toolTip()">{{ $tran->good->good_name }}</a></td>
|
||||
<td>{{ $tran->number }}</td>
|
||||
@if($tran->status == 0)
|
||||
<td>
|
||||
已取消
|
||||
</td>
|
||||
@elseif($tran->status == 1)
|
||||
<td>
|
||||
等待卖家确认
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" action="/trans/{{ $tran->id }}/cancel" id="delform">
|
||||
{!! csrf_field() !!}
|
||||
{!! method_field('DELETE') !!}
|
||||
<input type="submit" class="button" value="取消订单" style="margin: 0;"
|
||||
id="delbutton">
|
||||
</form>
|
||||
</td>
|
||||
@elseif($tran->status == 2)
|
||||
<td>
|
||||
交易已成立
|
||||
</td>
|
||||
<td>
|
||||
<a href="/trans/{{ $tran->id }}">查看交易</a>
|
||||
</td>
|
||||
@elseif($tran->status == 3)
|
||||
<td>
|
||||
交易失败
|
||||
</td>
|
||||
@elseif($tran->status == 4)
|
||||
<td>
|
||||
交易成功待评价
|
||||
</td>
|
||||
<td>
|
||||
<form action="/comment/{{ $tran->id }}">
|
||||
{!! csrf_field() !!}
|
||||
<input type="submit" class="button" value="评价" style="margin: 0;">
|
||||
</form>
|
||||
</td>
|
||||
@elseif($tran->status == 5)
|
||||
<td>
|
||||
已评价
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h3>卖家联系方式</h3>
|
||||
<div class="card-section">
|
||||
<div class="row table-responsive">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>真实姓名</th>
|
||||
<th>手机</th>
|
||||
<th>QQ</th>
|
||||
<th>微信</th>
|
||||
<th>地址</th>
|
||||
</tr>
|
||||
|
||||
@foreach($seller->user_infos as $userinfo)
|
||||
<tr>
|
||||
<td>{{ $userinfo->realname }}</td>
|
||||
<td>{{ isset($userinfo->tel_num) ? $userinfo->tel_num : "" }}</td>
|
||||
<td>{{ isset($userinfo->QQ) ? $userinfo->QQ : "" }}</td>
|
||||
<td>{{ isset($userinfo->wechat) ? $userinfo->wechat : "" }}</td>
|
||||
<td>{{ isset($userinfo->address) ? $userinfo->address : "" }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h3>买家联系方式</h3>
|
||||
<div class="card-section">
|
||||
<div class="row table-responsive">
|
||||
<table class="card-table" rules="rows">
|
||||
<tr>
|
||||
<th>真实姓名</th>
|
||||
<th>手机</th>
|
||||
<th>QQ</th>
|
||||
<th>微信</th>
|
||||
<th>地址</th>
|
||||
</tr>
|
||||
|
||||
@foreach($buyer->user_infos as $userinfo)
|
||||
<tr>
|
||||
<td>{{ $userinfo->realname }}</td>
|
||||
<td>{{ isset($userinfo->tel_num) ? $userinfo->tel_num : "" }}</td>
|
||||
<td>{{ isset($userinfo->QQ) ? $userinfo->QQ : "" }}</td>
|
||||
<td>{{ isset($userinfo->wechat) ? $userinfo->wechat : "" }}</td>
|
||||
<td>{{ isset($userinfo->address) ? $userinfo->address : "" }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user