| xqd
@@ -283,13 +283,16 @@ class HomeService
|
|
|
//拉黑用户
|
|
|
public function lahei($param){
|
|
|
$user = auth('api')->user();
|
|
|
- if(empty($param['user_id'])){
|
|
|
- throw new Exception("参数错误");
|
|
|
+ if(!empty($param['user_id'])&& $param['user_id']>0){
|
|
|
+ $touser = User::query()->where('id',$param['user_id'])->first();
|
|
|
}
|
|
|
- if(!$touser = User::query()->where('id',$param['user_id'])->first()){
|
|
|
- throw new Exception("用户不存在");
|
|
|
+ if(!empty($param['tencent_im_user_id'])){
|
|
|
+ $touser = User::query()->where('tencent_im_user_id',$param['tencent_im_user_id'])->first();
|
|
|
}
|
|
|
|
|
|
+ if(!$touser){
|
|
|
+ throw new Exception("用户不存在");
|
|
|
+ }
|
|
|
$tencentim = new TencentImFriendService();
|
|
|
|
|
|
$res = $tencentim->friend_black_add($user->tencent_im_user_id,$touser->tencent_im_user_id);
|