LaveMonth.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace app\admin\controller\wechat;
  3. use app\common\controller\Backend;
  4. use app\admin\model\WechatResponse;
  5. /**
  6. * 扣款服务签约列表
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class LaveMonth extends Backend
  11. {
  12. protected $model = null;
  13. // protected $noNeedRight = ['check_text_unique'];
  14. public function _initialize()
  15. {
  16. parent::_initialize();
  17. $this->model = model('LaveMonth');
  18. }
  19. public function index()
  20. {
  21. //设置过滤方法
  22. $this->request->filter(['strip_tags', 'trim']);
  23. if ($this->request->isAjax()) {
  24. //如果发送的来源是Selectpage,则转发到Selectpage
  25. if ($this->request->request('keyField')) {
  26. $data = $this->selectpage()->getData();
  27. return $data;
  28. }
  29. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  30. /**
  31. * 获取企业信息
  32. */
  33. $where1 = is_sys_admin();
  34. $list = $this->model
  35. ->where($where)->where($where1)
  36. ->order($sort, $order)
  37. ->paginate($limit);
  38. foreach ($list as $k => $v) {
  39. }
  40. $result = array("total" => $list->total(), "rows" => $list->items());
  41. return json($result);
  42. }
  43. return $this->view->fetch();
  44. }
  45. /**
  46. * 编辑
  47. */
  48. public function edit($ids = null)
  49. {
  50. $row = $this->model->get(['id' => $ids]);
  51. if (!$row) {
  52. $this->error(__('No Results were found'));
  53. }
  54. if ($this->request->isPost()) {
  55. $params = $this->request->post("row/a");
  56. if ($params) {
  57. $row->save($params);
  58. $this->success();
  59. }
  60. $this->error();
  61. }
  62. $this->view->assign("row", $row);
  63. return $this->view->fetch();
  64. }
  65. //
  66. // /**
  67. // * 判断价格是否唯一
  68. // * @internal
  69. // */
  70. // public function check_text_unique()
  71. // {
  72. // $row = $this->request->post("row/a");
  73. // $except = $this->request->post("except");
  74. // $text = isset($row['price']) ? $row['price'] : '';
  75. // if ($this->model->where('price', $text)->where(function ($query) use ($except) {
  76. // if ($except) {
  77. // $query->where('price', '<>', $except);
  78. // }
  79. // })->count() == 0) {
  80. // $this->success();
  81. // } else {
  82. // $this->error(__('Text already exists'));
  83. // }
  84. // }
  85. }