91 lines
2.4 KiB
PHP
91 lines
2.4 KiB
PHP
|
|
<?php
|
|||
|
|
declare (strict_types=1);
|
|||
|
|
|
|||
|
|
namespace app\controller;
|
|||
|
|
|
|||
|
|
use app\model\Access;
|
|||
|
|
use think\exception\ValidateException;
|
|||
|
|
use think\facade\Db;
|
|||
|
|
use think\facade\Validate;
|
|||
|
|
use think\Request;
|
|||
|
|
use app\validate\Admin as AdminValidate;
|
|||
|
|
use app\model\Admin as AdminModel;
|
|||
|
|
|
|||
|
|
// 新系统接口都整合在此文件夹 企业在Enterprise.php,EnterpriseCar.php,EnterpriseUser.php
|
|||
|
|
class Auth
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
// 权限
|
|||
|
|
public function getRoleList(){
|
|||
|
|
$where = [];
|
|||
|
|
$list = Db::table('zxc_role')
|
|||
|
|
->paginate([
|
|||
|
|
'list_rows' => 20,
|
|||
|
|
'query' => request()->param()
|
|||
|
|
]);
|
|||
|
|
return json($list);
|
|||
|
|
}
|
|||
|
|
// 菜单
|
|||
|
|
public function getMenuList(){
|
|||
|
|
$list = Db::table('zxc_menu')->where('pid',0)->select()->toArray();
|
|||
|
|
foreach ($list as $key=>&$value){
|
|||
|
|
$value['title'] = $value['name'];
|
|||
|
|
$value['children'] = Db::table('zxc_menu')->where('pid',$value['id'])->select()->toArray();
|
|||
|
|
|
|||
|
|
if(!empty($value['children'])){
|
|||
|
|
foreach ($value['children'] as $kk =>&$vv){
|
|||
|
|
$vv['title'] = $vv['name'];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return json($list);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 优惠券相关
|
|||
|
|
public function getCouponList(){
|
|||
|
|
$where = [];
|
|||
|
|
$list = Db::table('zxc_coupon')
|
|||
|
|
->paginate([
|
|||
|
|
'list_rows' => 20,
|
|||
|
|
'query' => request()->param()
|
|||
|
|
]);
|
|||
|
|
return json($list);
|
|||
|
|
}
|
|||
|
|
// 获取日志
|
|||
|
|
public function getLogList(){
|
|||
|
|
$where = [];
|
|||
|
|
$list = Db::table('system_request_logs')
|
|||
|
|
->order('id desc')
|
|||
|
|
->paginate([
|
|||
|
|
'list_rows' => 20,
|
|||
|
|
'query' => request()->param()
|
|||
|
|
]);
|
|||
|
|
return json($list);
|
|||
|
|
}
|
|||
|
|
//运营数据
|
|||
|
|
public function getYunYingData(){
|
|||
|
|
return json([]);
|
|||
|
|
}
|
|||
|
|
//财务数据
|
|||
|
|
public function getCaiWuData(){
|
|||
|
|
$where = [];
|
|||
|
|
$list = Db::table('zxc_user_money_log')
|
|||
|
|
->order('id desc')
|
|||
|
|
->paginate([
|
|||
|
|
'list_rows' => 20,
|
|||
|
|
'query' => request()->param()
|
|||
|
|
]);
|
|||
|
|
$typeMap = [
|
|||
|
|
'1'=>'充电订单',
|
|||
|
|
'2'=>'充值',
|
|||
|
|
'3'=>'提现'
|
|||
|
|
];
|
|||
|
|
$list->each(function($item, $key) use ($typeMap) {
|
|||
|
|
$item['type_text'] = $typeMap[$item['type']];
|
|||
|
|
return $item;
|
|||
|
|
});
|
|||
|
|
return json($list);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|