This commit is contained in:
LI JIAHAO
2017-06-20 19:21:56 +08:00
parent 0bcbf536b7
commit fab933a87b
5 changed files with 13 additions and 7 deletions
+2 -2
View File
@@ -186,7 +186,7 @@ class GoodController extends Controller
//$data['tags'] = Tag::orderby('id', 'asc')->get();
if(!$user || $user->baned)
return view::make('good.goodInfoForm')->with($data)->withErrors('您的账号被封禁,无法出售商品,请联系系统管理员');
if(UserInfo::where('user_id', $user_id)->count() == 0)
if(UserInfo::where('user_id', $user_id)->count() == 0 && !$user->wechat_open_id)
return view::make('good.goodInfoForm')->with($data)->withErrors('你必须先添加联系方式才能出售');
return view::make('good.goodInfoForm')->with($data);
}
@@ -197,7 +197,7 @@ class GoodController extends Controller
$user = User::find($user_id);
if(!$user || $user->baned)
return Redirect::back()->withInput()->withErrors('您的账号被封禁,请联系系统管理员');
if(UserInfo::where('user_id', $user_id)->count() == 0)
if(UserInfo::where('user_id', $user_id)->count() == 0 && !$user->wechat_open_id)
return Redirect::back()->withInput()->withErrors('你必须添加联系方式才能出售');
$input = $request->all();
$good = new GoodInfo;
@@ -29,7 +29,7 @@ class TransactionController extends Controller
$user = User::find($user_id);
if(!$user || $user->baned)
return Redirect::back()->withInput()->withErrors('您的账号被封禁,请联系系统管理员');
if(UserInfo::where('user_id', $user_id)->count() == 0)
if(UserInfo::where('user_id', $user_id)->count() == 0 && !$user->wechat_open_id)
return Redirect::back()->withInput()->withErrors('你必须添加联系方式才能购买');
$count = $request->count;
$result = $this->buy($good_id, $user_id, $count, $request->ip());
+2 -2
View File
@@ -20,8 +20,8 @@ class RegisterComplete
if($request->session()->has('user_id'))
{
$user = User::find($request->session()->get('user_id'));
if($user->registerCompletion())
return Redirect::to('/register/' . $user->registerCompletion());
if($user->registerCompletion(true))
return Redirect::to('/register/' . $user->registerCompletion(true));
return $next($request);
}
else
+2 -2
View File
@@ -16,9 +16,9 @@ class User extends Model
return $this->hasMany('App\UserInfo');
}
public function registerCompletion()
public function registerCompletion($force = false)
{
if ($this->nickname == null || !Storage::exists('avatar/' . $this->id)) {
if (!$force && ($this->nickname == null || !Storage::exists('avatar/' . $this->id))) {
return 2;
} else if (count($this->user_infos) == 0 && $this->wechat_open_id == null) {
return 3;
+6
View File
@@ -79,6 +79,9 @@
<th nowrap="nowrap">地址</th>
</tr>
@if(count($seller->user_infos) == 0)
<tr><td nowrap="nowrap" colspan="5">该用户没有填写联系方式,你们可以通过“消息”来联系。“消息”会通过东大小秘书微信公众号进行推送。</td></tr>
@endif
@foreach($seller->user_infos as $userinfo)
<tr>
<td nowrap="nowrap">{{ $seller->realname }}</td>
@@ -103,6 +106,9 @@
<th nowrap="nowrap">地址</th>
</tr>
@if(count($buyer->user_infos) == 0)
<tr><td nowrap="nowrap" colspan="5">该用户没有填写联系方式,你们可以通过“消息”来联系。“消息”会通过东大小秘书微信公众号进行推送。</td></tr>
@endif
@foreach($buyer->user_infos as $userinfo)
<tr>
<td nowrap="nowrap">{{ $buyer->realname }}</td>