|
|
|
@ -4,9 +4,94 @@ 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() |
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
|