You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.8 KiB
97 lines
2.8 KiB
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\controller;
|
|
|
|
use app\BaseController;
|
|
use think\facade\Db;
|
|
use think\facade\Request;
|
|
use think\facade\Session;
|
|
use app\model\AdminUser as AdminModel;
|
|
|
|
class AdminUser extends BaseController
|
|
{
|
|
protected $relationType = [1 => '用户', 2 => '代理'];
|
|
/**
|
|
* 管理员信息
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function userInfo()
|
|
{
|
|
|
|
$adminData = Session::get('login_admin_user_data');
|
|
|
|
$data = AdminModel::field('id,avatar')->where('id',$adminData['id'])->find();
|
|
$data['avatar'] = get_image_url($data['avatar']);
|
|
return $this->renderSuccess('数据返回成功',['data' => $data]);
|
|
}
|
|
|
|
/**
|
|
* 上分记录
|
|
* @return array
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
public function upScoresList()
|
|
{
|
|
$adminData = Session::get('login_admin_user_data');
|
|
|
|
$data = Request::param();
|
|
|
|
$limit = $data['limit'] ?: 10;
|
|
|
|
$list = Db::name('admin_up_scores_records')
|
|
->where('admin_id',$adminData['id'])
|
|
->field('relation_id,relation_type,balance,residue_amount,create_time')
|
|
->order('id' ,'desc')
|
|
->paginate($limit);
|
|
|
|
$listArr = $list->items();
|
|
|
|
foreach ($listArr as &$item) {
|
|
$item['relation_type'] = $this->relationType[$item['relation_type']];
|
|
give_symbol($item['balance']);
|
|
$item['create_time'] = date("m月d日 H:i",strtotime($item['create_time']));
|
|
}
|
|
|
|
return $this->renderSuccess('数据获取成功',[
|
|
'list' => $listArr,
|
|
'total' => $list->total()
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 下分记录
|
|
* @return array
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
public function downScoresList()
|
|
{
|
|
$adminData = Session::get('login_admin_user_data');
|
|
|
|
$data = Request::param();
|
|
|
|
$limit = $data['limit'] ?: 10;
|
|
|
|
$list = Db::name('admin_down_scores_records')
|
|
->where('admin_id',$adminData['id'])
|
|
->field('relation_id,relation_type,withdrawal_amount,withdrawal_balance,create_time')
|
|
->order('id' ,'desc')
|
|
->paginate($limit);
|
|
|
|
$listArr = $list->items();
|
|
|
|
foreach ($listArr as &$item) {
|
|
$item['relation_type'] = $this->relationType[$item['relation_type']];
|
|
give_symbol($item['withdrawal_amount'],'-');
|
|
$item['create_time'] = date("m月d日 H:i",strtotime($item['create_time']));
|
|
}
|
|
|
|
return $this->renderSuccess('数据获取成功',[
|
|
'list' => $listArr,
|
|
'total' => $list->total()
|
|
]);
|
|
}
|
|
}
|
|
|