| xqd
@@ -6,10 +6,12 @@ namespace App\Services;
|
|
|
|
|
|
use App\Http\Params\ProblemParam;
|
|
|
use App\Models\PaymentLogModel;
|
|
|
+use App\Models\UserBlacklistModel;
|
|
|
use App\Models\UserLookModel;
|
|
|
use App\Models\UserProblemModel;
|
|
|
use App\Models\VipModel;
|
|
|
use PHPUnit\Util\Exception;
|
|
|
+use function Symfony\Component\Translation\t;
|
|
|
|
|
|
class UserService
|
|
|
{
|
| xqd
@@ -72,4 +74,33 @@ class UserService
|
|
|
];
|
|
|
return PayService::pay($pay_param);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 黑名单
|
|
|
+ */
|
|
|
+ public function black_list(){
|
|
|
+ $user = auth('api')->user();
|
|
|
+ $res = UserBlacklistModel::query()
|
|
|
+ ->leftJoin('users_info','users_blacklist.black_id','=','users_info.user_id')
|
|
|
+ ->select(['users_blacklist.id','users_info.user_id','users_info.avatar','users_info.nickname'])
|
|
|
+ ->where('users_blacklist.user_id','=',$user->id)
|
|
|
+ ->paginate(request('prePage',20));
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除黑名单
|
|
|
+ */
|
|
|
+ public function del_black($id){
|
|
|
+ if(empty($id)){
|
|
|
+ throw new Exception("参数错误");
|
|
|
+ }
|
|
|
+ $user = auth('api')->user();
|
|
|
+ if(!$black = UserBlacklistModel::query()->where(['id'=>$id,'user_id'=>$user->id])->first()){
|
|
|
+ throw new Exception("对方不在你的黑名单中");
|
|
|
+ }
|
|
|
+ $black->delete();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|