From c4eb1e95374d51e9c56acc63890520334462ead9 Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 18 Oct 2023 09:00:17 +0800 Subject: [PATCH] 1 --- .../Api/V1/Group/GiftController.php | 52 ++++++++++++++----- app/Service/GiftService.php | 15 ++++-- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/app/Controller/Api/V1/Group/GiftController.php b/app/Controller/Api/V1/Group/GiftController.php index 6822da6..7bf086a 100644 --- a/app/Controller/Api/V1/Group/GiftController.php +++ b/app/Controller/Api/V1/Group/GiftController.php @@ -101,6 +101,7 @@ class GiftController extends CController $idnum = data_get($v, 'id_num', ''); $follow_status = 1; + $is_fans = 0; // 关注状态 if ($user_id) { $mine_id = data_get($v, 'mine_id', 0); @@ -108,14 +109,21 @@ class GiftController extends CController ->where('user_id',$user_id) ->where('to_user_id',$mine_id) ->first(); + + $to_follow_user = DB::table('user_follow') + ->where('to_user_id',$user_id) + ->where('user_id',$mine_id) + ->first(); if (!empty($follow_user)) { $follow_status = 2; } + + if (!empty($to_follow_user)) { + $is_fans = 1; + } + if ($follow_status == 2) { - $to_follow_user = DB::table('user_follow') - ->where('to_user_id',$user_id) - ->where('user_id',$mine_id) - ->first(); + if (!empty($to_follow_user)) { $follow_status = 3; } @@ -127,6 +135,7 @@ class GiftController extends CController $idnums[$idnum]['points'] = '0'; $idnums[$idnum]['player_id'] = $playerId; $idnums[$idnum]['head_img'] = $headImg; + $idnums[$idnum]['is_fans'] = $is_fans; $idnums[$idnum]['follow_status'] = $follow_status; if (!isset($idnums[$idnum]['order'])) { $idnums[$idnum]['order'] = $order; @@ -139,6 +148,7 @@ class GiftController extends CController $idnums[$k]['points'] = empty($points)? 0: $points; $idnums[$k]['player_id'] = $playerId; $idnums[$k]['head_img'] = $headImg; + $idnums[$k]['is_fans'] = $is_fans; $idnums[$k]['follow_status'] = $follow_status; $idnums[$k]['order'] = $order; $idnums[$k]['name'] = data_get($v, 'name'); @@ -179,20 +189,28 @@ class GiftController extends CController ->first(); $follow_status = 1; + $is_fans = 0; // 关注状态 if ($user_id) { $follow_user = DB::table('user_follow') ->where('user_id', $user_id) ->where('to_user_id', data_get($model, 'mine_id','')) ->first(); + + $to_follow_user = DB::table('user_follow') + ->where('to_user_id', $user_id) + ->where('user_id', data_get($model, 'mine_id','')) + ->first(); if (!empty($follow_user)) { $follow_status = 2; } + + if (!empty($to_follow_user)) { + $is_fans = 1; + } + if ($follow_status == 2) { - $to_follow_user = DB::table('user_follow') - ->where('to_user_id', $user_id) - ->where('user_id', data_get($model, 'mine_id','')) - ->first(); + if (!empty($to_follow_user)) { $follow_status = 3; } @@ -200,6 +218,7 @@ class GiftController extends CController } $j['follow_status'] = $follow_status; + $j['is_fans'] = $is_fans; $return[] = $j; } } else { @@ -217,6 +236,7 @@ class GiftController extends CController ->first(); $follow_status = 1; + $is_fans = 0; // 关注状态 if ($user_id) { $follow_user = DB::table('user_follow') @@ -226,11 +246,18 @@ class GiftController extends CController if (!empty($follow_user)) { $follow_status = 2; } + + $to_follow_user = DB::table('user_follow') + ->where('to_user_id', $user_id) + ->where('user_id', data_get($model, 'mine_id')) + ->first(); + + if (!empty($to_follow_user)) { + $is_fans = 1; + } + if ($follow_status == 2) { - $to_follow_user = DB::table('user_follow') - ->where('to_user_id', $user_id) - ->where('user_id', data_get($model, 'mine_id')) - ->first(); + if (!empty($to_follow_user)) { $follow_status = 3; } @@ -238,6 +265,7 @@ class GiftController extends CController } $j['follow_status'] = $follow_status; + $j['is_fans'] = $is_fans; $return[] = $j; } } diff --git a/app/Service/GiftService.php b/app/Service/GiftService.php index 529cfc3..24c86c9 100644 --- a/app/Service/GiftService.php +++ b/app/Service/GiftService.php @@ -108,6 +108,7 @@ class GiftService extends BaseService } $idnum = data_get($v, 'id_num', ''); $follow_status = 1; + $is_fans = 0; // 关注状态 if ($user_id) { $mine_id = data_get($v, 'mine_id', 0); @@ -118,11 +119,15 @@ class GiftService extends BaseService if (!empty($follow_user)) { $follow_status = 2; } + $to_follow_user = DB::table('user_follow') + ->where('to_user_id',$user_id) + ->where('user_id',$mine_id) + ->first(); + if (!empty($to_follow_user)) { + $is_fans = 1; + } if ($follow_status == 2) { - $to_follow_user = DB::table('user_follow') - ->where('to_user_id',$user_id) - ->where('user_id',$mine_id) - ->first(); + if (!empty($to_follow_user)) { $follow_status = 3; } @@ -134,6 +139,7 @@ class GiftService extends BaseService $idnums[$idnum]['player_id'] = $playerId; $idnums[$idnum]['head_img'] = $headImg; $idnums[$idnum]['follow_status'] = $follow_status; + $idnums[$idnum]['is_fans'] = $is_fans; $idnums[$idnum]['name'] = data_get($v, 'name'); } $idnums[$idnum]['points'] += $points; @@ -141,6 +147,7 @@ class GiftService extends BaseService $idnums[$k]['points'] = empty($points)? 0: $points; $idnums[$k]['player_id'] = $playerId; $idnums[$k]['head_img'] = $headImg; + $idnums[$k]['is_fans'] = $is_fans; $idnums[$k]['follow_status'] = $follow_status; $idnums[$k]['name'] = data_get($v, 'name'); } -- Gitee