|
@@ -86,7 +86,10 @@ class UserCenter extends Common
|
|
|
$party = \app\common\model\Party::where('id',$livingUserPartyId)->field('id,room_type')->find();
|
|
|
$userInfo['party_info'] = ['party_id' => $party['id'], 'room_type' => $party['room_type']];
|
|
|
}
|
|
|
-
|
|
|
+ $blackWhere['user_id'] = $this->auth->id;
|
|
|
+ $blackList = model('UserBlacklist')->where($blackWhere)->select();
|
|
|
+ $blackIds = !empty($blackList) ? array_column($blackList,'black_user_id') : [];
|
|
|
+ $userInfo['is_black'] = in_array($user_id,$blackIds) ? 1 : 0;
|
|
|
//访客记录
|
|
|
$visit_data = [
|
|
|
'user_id' => $this->auth->id,
|
|
@@ -728,14 +731,22 @@ class UserCenter extends Common
|
|
|
*/
|
|
|
public function removeUserBlack() {
|
|
|
$id = $this->request->request('id'); // 黑名单ID
|
|
|
- if (!$id) {
|
|
|
+ $userId = $this->request->request('user_id'); // 用户ID
|
|
|
+ if (!$id && !$userId) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
|
|
|
$userblacklistModel = new \app\common\model\UserBlacklist();
|
|
|
$where = [];
|
|
|
- $where["id"] = $id;
|
|
|
- $res = $userblacklistModel->where($where)->delete();
|
|
|
+ $id && $where["id"] = $id;
|
|
|
+ if ($userId) {
|
|
|
+ $where['user_id'] = $this->auth->id;
|
|
|
+ $where['black_user_id'] = $userId;
|
|
|
+ }
|
|
|
+ $res = false;
|
|
|
+ if (!empty($where)) {
|
|
|
+ $res = $userblacklistModel->where($where)->delete();
|
|
|
+ }
|
|
|
if($res) {
|
|
|
$this->success("移除成功!",$res);
|
|
|
} else {
|