123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\admin\controller;
- use app\BaseController;
- use think\App;
- use think\facade\Db;
- class Conf extends BaseController
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $post =$this->request->post();
- $token = isset($post['token']) ? trim($post['token']) : "";
- // if($token==""){
- // return error_show(101,'token不能为空');
- //
- // }
- // $effetc = VerifyTokens($token);
- // if(!empty($effetc) && $effetc['code']!=0){
- // return error_show($effetc['code'],$effetc['message']);
- //
- // }
- }
- public function list(){
- $post = $this->request->post();
- $condition = [['is_del'=>0]];
- $page = isset($post['page']) &&$post['page']!=='' ?intval($post['page']) :1;
- $size = isset($post['size']) &&$post['size']!=='' ?intval($post['size']) :10;
- $count = Db::name("config")->where($condition)->count();
- $page>=ceil($count/$size) ? $page = ceil($count/$size): '';
- $list = Db::name("config")->where($condition)->page($page,$size)->order("addtime desc")->select();
- return app_show(0,"获取成功",['list'=>$list,"count"=>$count]);
- }
- public function info(){
- $post = $this->request->post();
- $id = isset($post['id']) && $post['id']!==''? intval($post['id']): '';
- if($id==''){
- return error_show(1004,'参数id 不能为空');
- }
- $condition = [['is_del'=>0],['id'=>$id]];
- $info = Db::name("config")->where($condition)->find();
- if(empty($info)){
- return error_show(1004,'未找到数据');
- }
- return app_show(0,"获取成功",$info);
- }
- public function add(){}
- }
|