|
|
@@ -525,11 +525,13 @@ class MemberService extends BaseService
|
|
|
$info['agent'] = isset($info['agent']) ? $info['agent'] : [];
|
|
|
|
|
|
$info['agent_level'] = 0;
|
|
|
+ $info['team_count'] = 0;
|
|
|
$params = request()->all();
|
|
|
$type = isset($params['type'])?$params['type']:'';
|
|
|
if ($type == 'agent' && $info['agent']) {
|
|
|
$info['agent_level'] = $this->getAgentLevel($info['id']);
|
|
|
$info['agent_level'] = $info['agent_level']>=2?2 : 1;
|
|
|
+ $info['team_count'] = $this->getTeamCount($info['id']);
|
|
|
}
|
|
|
|
|
|
RedisService::set($cacheKey, $info, rand(30, 60));
|
|
|
@@ -573,6 +575,30 @@ class MemberService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 团队人数
|
|
|
+ * @param $uid
|
|
|
+ * @return array|int|mixed
|
|
|
+ */
|
|
|
+ public function getTeamCount($uid)
|
|
|
+ {
|
|
|
+ $cacheKey = "caches:members:teamCount:{$uid}";
|
|
|
+ $data = RedisService::get($cacheKey);
|
|
|
+ if ($data) {
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = $this->model->from('member as a')
|
|
|
+ ->where('a.parents', 'like', "%,{$uid},%")
|
|
|
+ ->where(['a.status' => 1, 'a.mark' => 1])
|
|
|
+ ->count('id');
|
|
|
+ if($data){
|
|
|
+ RedisService::set($cacheKey, $data, rand(5,10));
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成普通参数二维码
|
|
|
* @param $str 参数
|
|
|
* @param bool $refresh 是否重新生成
|