PlanRecord.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 PlanRecord 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('WechatPlanRecord');
  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('paid',1)
  36. ->where($where)->where($where1)
  37. ->order($sort, $order)
  38. ->paginate($limit);
  39. // foreach ($list as $k => $v) {
  40. //
  41. // }
  42. $result = array("total" => $list->total(), "rows" => $list->items());
  43. return json($result);
  44. }
  45. return $this->view->fetch();
  46. }
  47. /**
  48. * 编辑
  49. */
  50. public function edit($ids = null)
  51. {
  52. $row = $this->model->get(['id' => $ids]);
  53. if (!$row) {
  54. $this->error(__('No Results were found'));
  55. }
  56. if ($this->request->isPost()) {
  57. $params = $this->request->post("row/a");
  58. if ($params) {
  59. $row->save($params);
  60. $this->success();
  61. }
  62. $this->error();
  63. }
  64. $this->view->assign("row", $row);
  65. return $this->view->fetch();
  66. }
  67. //
  68. // /**
  69. // * 判断价格是否唯一
  70. // * @internal
  71. // */
  72. // public function check_text_unique()
  73. // {
  74. // $row = $this->request->post("row/a");
  75. // $except = $this->request->post("except");
  76. // $text = isset($row['price']) ? $row['price'] : '';
  77. // if ($this->model->where('price', $text)->where(function ($query) use ($except) {
  78. // if ($except) {
  79. // $query->where('price', '<>', $except);
  80. // }
  81. // })->count() == 0) {
  82. // $this->success();
  83. // } else {
  84. // $this->error(__('Text already exists'));
  85. // }
  86. // }
  87. }