first commit
This commit is contained in:
90
app/api/lists/team/TeamUserLists.php
Normal file
90
app/api/lists/team/TeamUserLists.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
namespace app\api\lists\team;
|
||||
|
||||
use app\api\lists\BaseApiDataLists;
|
||||
use app\common\model\user\{User,UserRelation};
|
||||
use app\common\model\setting\Language;
|
||||
use app\common\service\{UtilsService,FileService};
|
||||
|
||||
/**
|
||||
* 抢单记录列表
|
||||
* Class TeamUserLists
|
||||
* @package app\api\lists\team
|
||||
*/
|
||||
class TeamUserLists extends BaseApiDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取抢单记录列表
|
||||
* @return array
|
||||
*@author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$distributeLevel = UtilsService::get_distribute_level();
|
||||
|
||||
$level = $this->params['level'] ;
|
||||
$where = " ur.level = $level ";
|
||||
|
||||
$field = 'ur.id as ur_id,ur.level,ur.create_time';
|
||||
$field .= ',u.id,u.sn,u.mobile,u.total_income_invest,u.total_recharge,u.total_withdraw';
|
||||
$lists = User::alias('u')
|
||||
->join('user_relation ur', 'u.id = ur.user_id')
|
||||
->field($field)
|
||||
->append(['team_num','item_num'])
|
||||
->where($where)
|
||||
->where([
|
||||
'ur.parent_id' => $this->userId,
|
||||
])
|
||||
->where(" level <= $distributeLevel ")
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['ur.create_time' => 'desc','ur.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
//查询语言
|
||||
$timeFormat = 'Y-m-d H:i:s';
|
||||
$language = Language::where(['symbol' => $this->params['lang']])->findOrEmpty();
|
||||
if (!$language->isEmpty()) {
|
||||
$timeFormat = $language['time_format'];
|
||||
}
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
if($level != 1){
|
||||
$item['mobile'] = substr_replace($item['mobile'], str_repeat('*', 4), 2, 4);
|
||||
}
|
||||
|
||||
$item['create_time'] = date($timeFormat, strtotime($item['create_time']));
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取抢单记录数量
|
||||
* @return int
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$distributeLevel = UtilsService::get_distribute_level();
|
||||
|
||||
$where = '1 = 1';
|
||||
|
||||
if( $this->params['level'] != 0){
|
||||
$level = $this->params['level'] ;
|
||||
$where = " ur.level = $level ";
|
||||
}
|
||||
|
||||
return User::alias('u')
|
||||
->join('user_relation ur', 'u.id = ur.user_id')
|
||||
->where($where)
|
||||
->where([
|
||||
'ur.parent_id' => $this->userId,
|
||||
])
|
||||
->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user