Welfare.php 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\common\controller\Backend;
  4. /**
  5. * 新人福利管理
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class Welfare extends Backend
  10. {
  11. /**
  12. * Welfare模型对象
  13. * @var \app\admin\model\user\Welfare
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\common\model\UserWelfare;
  20. }
  21. /**
  22. * 查看
  23. */
  24. public function index()
  25. {
  26. $row = $this->model->get(1);
  27. if ($this->request->isPost()) {
  28. $params = $this->request->post("row/a");
  29. $result = $row->allowField(true)->save($params);
  30. $this->success("提交成功", null, ['data' => json_encode($this->request->post("row/a"), JSON_UNESCAPED_UNICODE)]);
  31. }
  32. $this->view->assign('row', $row);
  33. return $this->view->fetch();
  34. }
  35. }