|
|
|
@ -9,6 +9,7 @@ use app\model\AgentUpScoresRecords; |
|
|
|
use app\model\AgentUser; |
|
|
|
use app\model\RechargeRecords; |
|
|
|
use app\model\User; |
|
|
|
use app\model\User as UserModel; |
|
|
|
use app\model\WithdrawalRecords; |
|
|
|
use app\validate\Agent; |
|
|
|
use think\exception\ValidateException; |
|
|
|
@ -18,6 +19,56 @@ use think\facade\Session; |
|
|
|
|
|
|
|
class AgentTeam extends BaseController |
|
|
|
{ |
|
|
|
/** |
|
|
|
* 获取用户列表 |
|
|
|
* @return array |
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
*/ |
|
|
|
public function userList() |
|
|
|
{ |
|
|
|
$request = Request::param(); |
|
|
|
|
|
|
|
$limit = $request['limit'] ?? 10; |
|
|
|
|
|
|
|
# 代理id查询 |
|
|
|
$agentData = Session::get('login_agent_user_data'); |
|
|
|
$where = ['aid' => $agentData['id']]; |
|
|
|
|
|
|
|
$UserModel = new UserModel(); |
|
|
|
|
|
|
|
# 用户id / 手机号码查询 |
|
|
|
if (isset($request['title']) && !empty($request['title'])) { |
|
|
|
$queryUser = $UserModel |
|
|
|
->whereOr(['phone' => $request['title'], 'id' => $request['title']]) |
|
|
|
->field('id') |
|
|
|
->select() |
|
|
|
->toArray(); |
|
|
|
if ($queryUser) { |
|
|
|
foreach ($queryUser as $queryUserRow) { |
|
|
|
$where['id'][] = $queryUserRow['id']; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$where['id'] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# 查询用户列表 |
|
|
|
$field = 'id,aid,phone,avatar,balance,withdrawal_balance'; |
|
|
|
$userRes = $UserModel->field($field)->where($where)->order('id desc')->paginate($limit); |
|
|
|
|
|
|
|
$list = $userRes->items(); |
|
|
|
$total = $userRes->total(); |
|
|
|
|
|
|
|
foreach ($list as &$item) { |
|
|
|
|
|
|
|
$item['phone'] = format_phone_number($item['phone']); |
|
|
|
$item['avatar'] = get_image_url($item['avatar']); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderSuccess('数据返回成功',['list' => $list, 'total' => $total]); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 上分 |
|
|
|
|