acb.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace WY\app\controller\derpay;
  3. use WY\app\libs\Controller;
  4. if (!defined('WY_ROOT')) {
  5. exit;
  6. }
  7. class acb extends CheckAdmin
  8. {
  9. public function index()
  10. {
  11. $lists = $this->model()->select()->from('acb')->orderby('sortid asc,id asc')->fetchAll();
  12. $data = array('title' => '网银列表', 'lists' => $lists);
  13. $this->put('acb.php', $data);
  14. }
  15. public function save()
  16. {
  17. $data = isset($_POST) ? $_POST : false;
  18. if ($data && $this->model()->from('acb')->insertData($data)->insert()) {
  19. echo json_encode(array('status' => 1, 'msg' => '设置保存成功', 'url' => $this->dir . 'acb'));
  20. exit;
  21. }
  22. echo json_encode(array('status' => 0, 'msg' => '设置保存失败'));
  23. exit;
  24. }
  25. public function edit()
  26. {
  27. $id = isset($this->action[3]) ? intval($this->action[3]) : 0;
  28. $acb = $this->model()->select()->from('acb')->where(array('fields' => 'id=?', 'values' => array($id)))->fetchRow();
  29. $data = array('title' => '编辑网银', 'data' => $acb);
  30. $this->put('acbedit.php', $data);
  31. }
  32. public function editsave()
  33. {
  34. $id = isset($this->action[3]) ? intval($this->action[3]) : 0;
  35. $data = isset($_POST) ? $_POST : false;
  36. if ($data && $this->model()->from('acb')->updateSet($data)->where(array('fields' => 'id=?', 'values' => array($id)))->update()) {
  37. echo json_encode(array('status' => 1, 'msg' => '设置保存成功', 'url' => $this->dir . 'acb'));
  38. exit;
  39. }
  40. echo json_encode(array('status' => 0, 'msg' => '设置保存失败'));
  41. exit;
  42. }
  43. public function del()
  44. {
  45. $id = $this->req->get('id');
  46. if ($id) {
  47. if ($this->model()->from('acb')->where(array('fields' => 'id=?', 'values' => array($id)))->delete()) {
  48. echo json_encode(array('status' => 1));
  49. exit;
  50. }
  51. }
  52. echo json_encode(array('status' => 0));
  53. exit;
  54. }
  55. }