|
|
@@ -593,58 +593,6 @@ class MemberService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 认证
|
|
|
- * @param $userId
|
|
|
- * @param $params
|
|
|
- * @return bool
|
|
|
- */
|
|
|
- public function auth($userId, $params)
|
|
|
- {
|
|
|
- $cacheLockKey = "caches:members:auth_{$userId}";
|
|
|
- if (RedisService::get($cacheLockKey)) {
|
|
|
- $this->error = 1034;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // 用户验证
|
|
|
- RedisService::set($cacheLockKey, ['user_id' => $userId, 'params' => $params], rand(2, 3));
|
|
|
- $info = $this->model->where(['id' => $userId, 'mark' => 1])
|
|
|
- ->select(['id', 'realname','idcard','is_auth', 'status'])
|
|
|
- ->first();
|
|
|
- if (!$info || $info['status'] != 1) {
|
|
|
- $this->error = '账号或已被冻结,请联系客服';
|
|
|
- RedisService::clear($cacheLockKey);
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if($info['is_auth'] == 1 && $info['idcard'] && $info['realname']){
|
|
|
- $this->error = '抱歉,您已完成认证';
|
|
|
- RedisService::clear($cacheLockKey);
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // 认证数据
|
|
|
- $data = [
|
|
|
- 'realname'=> isset($params['realname'])?$params['realname'] : '',
|
|
|
- 'company'=> isset($params['company'])?$params['company'] : '',
|
|
|
- 'idcard'=> isset($params['idcard'])?$params['idcard'] : '',
|
|
|
- 'is_auth'=> 1,
|
|
|
- 'update_time' => time()
|
|
|
- ];
|
|
|
- if (!$this->model->where(['id' => $userId])->update($data)) {
|
|
|
- $this->error = '认证提交失败';
|
|
|
- RedisService::clear($cacheLockKey);
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $this->error = '恭喜您,已完成认证';
|
|
|
- RedisService::clear($cacheLockKey);
|
|
|
- RedisService::clear("caches:members:authInfo:{$userId}");
|
|
|
- RedisService::keyDel("caches:members:teamList*");
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 获取团队列表
|
|
|
* @param $userId
|
|
|
* @param $params
|
|
|
@@ -665,9 +613,8 @@ class MemberService extends BaseService
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- $list = $this->model->with(['account'])->from('member as a')
|
|
|
- ->leftJoin('account_statistics as b','b.user_id','=','a.id')
|
|
|
- ->where(['a.parent_id'=>$userId,'b.state'=>1,'a.mark'=>1])
|
|
|
+ $list = $this->model->from('member as a')
|
|
|
+ ->where(['a.parent_id'=>$userId,'a.mark'=>1])
|
|
|
->where(function($query) use($params){
|
|
|
$keyword = isset($params['keyword'])? $params['keyword'] : '';
|
|
|
if($keyword){
|
|
|
@@ -696,58 +643,6 @@ class MemberService extends BaseService
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 设置账户参数
|
|
|
- * @param $userId
|
|
|
- * @param $params
|
|
|
- * @return array|false|mixed|string
|
|
|
- */
|
|
|
- public function setting($userId, $params)
|
|
|
- {
|
|
|
- $apiUrl = ConfigService::make()->getConfigByCode('bonus_settle_url','');
|
|
|
- if(empty($apiUrl)){
|
|
|
- $this->error = '设置失败,参数错误';
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $token = request()->headers->get('Authorization');
|
|
|
- $token = str_replace("Bearer ", null, $token);
|
|
|
- $header = [
|
|
|
- 'authorization: '.$token
|
|
|
- ];
|
|
|
- $position = isset($params['position'])?trim($params['position']): '';
|
|
|
- $point = isset($params['commission_point'])?floatval($params['commission_point']): 0;
|
|
|
- $result = httpRequest($apiUrl.'/team/setting',['id'=>$userId,'position'=>$position,'point'=>$point],'post','',5,$header);
|
|
|
- $err = isset($result['err']) && $result['err']?$result['err'] : -1;
|
|
|
- $msg = isset($result['msg']) && $result['msg']?$result['msg'] : '1003';
|
|
|
- $data = isset($result['data']) && $result['data']?$result['data'] : [];
|
|
|
- if($err==0){
|
|
|
- $this->error = '操作成功';
|
|
|
- return $data;
|
|
|
- }else{
|
|
|
- $this->error = $msg;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 验证操作用户权限
|
|
|
- * @param $userId
|
|
|
- * @param $actId
|
|
|
- * @return bool
|
|
|
- */
|
|
|
- public function checkTeamPermission($userId, $actId)
|
|
|
- {
|
|
|
- $parents = $this->model->where(['id'=>$actId])->value('parents');
|
|
|
- $parents = $parents? explode(',',$parents) : [];
|
|
|
- if(!in_array($userId,$parents) && $actId != $userId){
|
|
|
- $this->error = '信息错误,权限不足';
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $this->error = '验证成功';
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 账号注销
|