| xqd
@@ -13,6 +13,7 @@ use App\Models\UserComment;
|
|
|
use App\Models\UserInfoModel;
|
|
|
use App\Models\UserLikeModel;
|
|
|
use App\Models\UserPhotoDestroy;
|
|
|
+use App\Models\UserVipLimit;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Redis;
|
| xqd
@@ -68,8 +69,15 @@ class HomeService
|
|
|
}else{
|
|
|
//判断会员特权和普通用户
|
|
|
if($user->is_vip==0){
|
|
|
-
|
|
|
-
|
|
|
+ $limit = UserVipLimit::query()->where('user_id',$user->id)->first();
|
|
|
+ if($limit->user_detail>=10){
|
|
|
+ throw new Exception("非VIP用户每天只能看10个人");
|
|
|
+ }else{
|
|
|
+ //如果当天没有看过这个人 增加记录
|
|
|
+ if(!DB::table('users_look')->where(['user_id'=>$user->id,'look_id'=>$user_id])->whereBetween('atime',[date('Y-m-d 00:00:00'),date('Y-m-d 23:59:59')])->first()){
|
|
|
+ UserVipLimit::query()->where('user_id',$user->id)->increment('user_detail',1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|