|
|
@@ -16,6 +16,7 @@ use App\Models\AccountLogModel;
|
|
|
use App\Models\BalanceLogModel;
|
|
|
use App\Models\BonusLogModel;
|
|
|
use App\Models\CityModel;
|
|
|
+use App\Models\LiveModel;
|
|
|
use App\Models\MechanicModel;
|
|
|
use App\Models\MemberBankModel;
|
|
|
use App\Models\MemberCollectModel;
|
|
|
@@ -136,6 +137,31 @@ class MemberService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取主页信息
|
|
|
+ * @param $where
|
|
|
+ * @param array $field
|
|
|
+ */
|
|
|
+ public function getHomeInfo($id, $userId=0)
|
|
|
+ {
|
|
|
+ $field = ['id', 'username','email', 'realname', 'mobile','gender', 'nickname', 'code','supper_point', 'parent_id','province_id','city_id','signature','power_num','trade_state', 'point_id', 'balance','trx','usdt','wait_score', 'score','realname', 'member_level', 'status', 'avatar'];
|
|
|
+ $info = $this->model->where('mark',1)->where(['id' => $id])->select($field)->first();
|
|
|
+
|
|
|
+ $info = $info ? $info->toArray() : [];
|
|
|
+ if ($info) {
|
|
|
+ $info['avatar'] = $info['avatar'] ? get_image_url($info['avatar']) : get_image_url('/images/member/logo.png');
|
|
|
+ $info['fans'] = (int)MemberCollectService::make()->getCount($info['id'], 1,1); // 粉丝数量(被关注)
|
|
|
+ $info['follow'] = (int)MemberCollectService::make()->getCount($info['id'], 1,2); // 关注数量
|
|
|
+ $info['like'] = (int)MemberCollectService::make()->getCount($info['id'], 3,2); // 点赞喜欢数
|
|
|
+
|
|
|
+ $info['is_follow'] = (int)MemberCollectService::make()->checkCollect($userId, $info['id'],1); // 是否关注了
|
|
|
+ $info['is_fans'] = (int)MemberCollectService::make()->checkCollect($info['id'], $userId,1); // 是否我的粉丝
|
|
|
+ $info['live_id'] = (int)LiveModel::where(['user_id'=> $info['id'],'status'=>1,'mark'=>1])->orderBy('create_time','desc')->value('id'); // 是否正在直播
|
|
|
+ }
|
|
|
+
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取用户缓存信息
|
|
|
* @param $where
|
|
|
* @param array $field
|