| xqd
@@ -28,34 +28,8 @@ class UserAuthForm extends Form implements LazyRenderable
|
|
|
if(!$user){
|
|
|
throw new Exception("请刷新后重试");
|
|
|
}
|
|
|
- if($input['vip']>0){
|
|
|
- $vip_info = VipModel::query()->find($input['vip']);
|
|
|
- $user_vip_log = UserVipLogModel::query()->where(['user_id'=>$user->id])->first();
|
|
|
- if(!$user_vip_log){
|
|
|
- UserVipLogModel::query()->create([
|
|
|
- 'user_id'=>$user->id,
|
|
|
- 'status'=>1,
|
|
|
- 'day'=>$vip_info['day'],
|
|
|
- 'end_day'=> date("Y-m-d H:i:s",strtotime("+".$vip_info['day']." day")),
|
|
|
- ]);
|
|
|
- }elseif($user_vip_log->status==1){
|
|
|
- $user_vip_log->end_day = date("Y-m-d H:i:s",strtotime($user_vip_log->end_day."+".$vip_info['day']." day"));
|
|
|
- $user_vip_log->save();
|
|
|
- }elseif ($user_vip_log->status==0){
|
|
|
- $user_vip_log->end_day = date("Y-m-d H:i:s",strtotime("+".$vip_info['day']." day"));
|
|
|
- $user_vip_log->status = 1;
|
|
|
- $user_vip_log->save();
|
|
|
- }
|
|
|
- $user->is_vip = 1;
|
|
|
- $user->save();
|
|
|
- }else{
|
|
|
- if($user_vip_log = UserVipLogModel::query()->where(['user_id'=>$user->id])->first()){
|
|
|
- $user_vip_log->status = 0;
|
|
|
- $user_vip_log->save();
|
|
|
- }
|
|
|
- $user->is_vip = 0;
|
|
|
- $user->save();
|
|
|
- }
|
|
|
+ $user->is_auth = $input['is_auth'];
|
|
|
+ $user->save();
|
|
|
DB::commit();
|
|
|
}catch (\Exception $exception){
|
|
|
DB::rollBack();
|