Batch.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\BatchApi;
  5. /**
  6. * Description of Batch
  7. *
  8. * @author sgq
  9. */
  10. class Batch extends AdminController {
  11. /**
  12. * @@auth {{/batch}}
  13. * @return type
  14. */
  15. public function index() {
  16. return view();
  17. }
  18. /**
  19. * @@auth {{/batch/list}}
  20. * @return type
  21. */
  22. public function list() {
  23. return json(BatchApi::getList($this->request));
  24. }
  25. /**
  26. * @@auth {{/batch/add}}
  27. * @return type
  28. */
  29. public function add() {
  30. if ($this->request->isPost()) {
  31. return json(BatchApi::create($this->request->param()));
  32. }
  33. return view();
  34. }
  35. /**
  36. * @@auth {{/batch/update}}
  37. * @return type
  38. */
  39. public function edit() {
  40. if ($this->request->isPost()) {
  41. return json(BatchApi::update($this->request->param()));
  42. }
  43. $batch = BatchApi::getOne($this->request->param("id"));
  44. return view("", ["batch" => $batch]);
  45. }
  46. /**
  47. * @@auth {{/batch/delete}}
  48. * @return type
  49. */
  50. public function delete() {
  51. if ($this->request->isPost()) {
  52. return json(BatchApi::delete($this->request->param("batchId")));
  53. }
  54. }
  55. /**
  56. * @@auth {{/batch/setActive}}
  57. * @return type
  58. */
  59. public function setActive() {
  60. if ($this->request->isPost()) {
  61. return json(BatchApi::setActive($this->request->param("batchId"), 1));
  62. }
  63. }
  64. /**
  65. * @@auth {{/batch/setNotActive}}
  66. * @return type
  67. */
  68. public function setNotActive() {
  69. if ($this->request->isPost()) {
  70. return json(BatchApi::setActive($this->request->param("batchId"), 2));
  71. }
  72. }
  73. /**
  74. * @@auth {{/batch/detail}}
  75. * @return type
  76. */
  77. public function detail() {
  78. return view();
  79. }
  80. }