Supervise.php 968 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\App;
  6. use think\Db;
  7. class Supervise extends Base
  8. {
  9. public function list(){
  10. $page = input('page',1);
  11. $size= input('size',20);
  12. $list = Db::name('supervise')
  13. ->field('id,title,create_time,content,remark')
  14. ->where('del',0)
  15. ->where('enable',1)
  16. ->page($page,$size)
  17. ->order('id desc')
  18. ->select();
  19. foreach ($list as $k=>$v){
  20. $list[$k]['content'] = json_decode($v['content'],true);
  21. }
  22. HelpHander::success($list);
  23. }
  24. public function detail(){
  25. $id = input('id',0);
  26. $info = Db::name('supervise')->where('id',$id)->find();
  27. if(!$info){
  28. HelpHander::success('参数错误');
  29. }
  30. $info['content'] = json_decode($info['content'],true);
  31. HelpHander::success($info);
  32. }
  33. }