Cash.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Db;
  4. class Cash 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($param['status']!=''){
  17. $where['cash_status'] = ['eq',$param['status']];
  18. }
  19. if(!empty($param['uid'])){
  20. $where['user_id'] = ['eq',$param['uid'] ];
  21. }
  22. if(!empty($param['wd'])){
  23. $param['wd'] = htmlspecialchars(urldecode($param['wd']));
  24. $where['cash_bank_no'] = ['like','%'.$param['wd'].'%' ];
  25. }
  26. $order='cash_id desc';
  27. $res = model('Cash')->listData($where,$order,$param['page'],$param['limit']);
  28. $this->assign('list',$res['list']);
  29. $this->assign('total',$res['total']);
  30. $this->assign('page',$res['page']);
  31. $this->assign('limit',$res['limit']);
  32. $param['page'] = '{page}';
  33. $param['limit'] = '{limit}';
  34. $this->assign('param',$param);
  35. $this->assign('title',lang('admin/cash/title'));
  36. return $this->fetch('admin@cash/index');
  37. }
  38. public function del()
  39. {
  40. $param = input();
  41. $ids = $param['ids'];
  42. $all = $param['all'];
  43. if(!empty($ids)){
  44. $where=[];
  45. $where['cash_id'] = ['in',$ids];
  46. if($all==1){
  47. $where['cash_id'] = ['gt',0];
  48. }
  49. $res = model('Cash')->delData($where);
  50. if($res['code']>1){
  51. return $this->error($res['msg']);
  52. }
  53. return $this->success($res['msg']);
  54. }
  55. return $this->error(lang('param_err'));
  56. }
  57. public function audit()
  58. {
  59. $param = input();
  60. $ids = $param['ids'];
  61. if(!empty($ids)){
  62. $where=[];
  63. $where['cash_id'] = ['in',$ids];
  64. $res = model('Cash')->auditData($where);
  65. if($res['code']>1){
  66. return $this->error($res['msg']);
  67. }
  68. return $this->success($res['msg']);
  69. }
  70. return $this->error(lang('param_err'));
  71. }
  72. }