1
0

Plog.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Db;
  4. class Plog extends Base
  5. {
  6. public function __construct()
  7. {
  8. parent::__construct();
  9. }
  10. public function index()
  11. {
  12. $param = input();
  13. $param['page'] = intval($param['page']) <1 ? 1 : $param['page'];
  14. $param['limit'] = intval($param['limit']) <1 ? $this->_pagesize : $param['limit'];
  15. $where=[];
  16. if(!empty($param['type'])){
  17. $where['plog_type'] = ['eq',$param['type']];
  18. }
  19. if(!empty($param['uid'])){
  20. $where['user_id'] = ['eq',$param['uid'] ];
  21. }
  22. $order='plog_id desc';
  23. $res = model('Plog')->listData($where,$order,$param['page'],$param['limit']);
  24. $this->assign('list',$res['list']);
  25. $this->assign('total',$res['total']);
  26. $this->assign('page',$res['page']);
  27. $this->assign('limit',$res['limit']);
  28. $param['page'] = '{page}';
  29. $param['limit'] = '{limit}';
  30. $this->assign('param',$param);
  31. $this->assign('title',lang('admin/plog/title'));
  32. return $this->fetch('admin@plog/index');
  33. }
  34. public function del()
  35. {
  36. $param = input();
  37. $ids = $param['ids'];
  38. $all = $param['all'];
  39. if(!empty($ids)){
  40. $where=[];
  41. $where['plog_id'] = ['in',$ids];
  42. if($all==1){
  43. $where['plog_id'] = ['gt',0];
  44. }
  45. $res = model('Plog')->delData($where);
  46. if($res['code']>1){
  47. return $this->error($res['msg']);
  48. }
  49. return $this->success($res['msg']);
  50. }
  51. return $this->error(lang('param_err'));
  52. }
  53. }