|
@@ -140,7 +140,7 @@ class Friend extends Api
|
|
|
$keyword = input('keyword',0);
|
|
|
if(!$keyword){$this->error();}
|
|
|
|
|
|
- $list = Db::name('user')->field('id,nickname,mobile,avatar')->where('mobile',$keyword)->select();
|
|
|
+ $list = Db::name('user')->field('id,nickname,mobile,avatar')->where('mobile',$keyword)->where('id','neq',$this->auth->id)->select();
|
|
|
$list = list_domain_image($list,['avatar']);
|
|
|
|
|
|
if(!empty($list)){
|
|
@@ -173,6 +173,10 @@ class Friend extends Api
|
|
|
$user_id = input('user_id',0);
|
|
|
if(!$user_id){$this->error();}
|
|
|
|
|
|
+ if($user_id == $this->auth->id){
|
|
|
+ $this->error('不能添加自己为好友');
|
|
|
+ }
|
|
|
+
|
|
|
$check = Db::name('friend_apply')->where('user_id',$this->auth->id)->where('to_user_id',$user_id)->find();
|
|
|
if(!$check){
|
|
|
$data = [
|