AgencyRankController.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020-09-12
  6. * Time: 17:01
  7. */
  8. namespace app\back\controller;
  9. use app\back\model\AgencyRankModel;
  10. use cmf\controller\AdminBaseController;
  11. /**
  12. * Class AgencyRankController
  13. * @package app\back\controller
  14. * @adminMenuRoot(
  15. * 'name' =>'代理管理',
  16. * 'action' =>'agency',
  17. * 'parent' =>'',
  18. * 'display'=> true,
  19. * 'order' => 10000,
  20. * 'icon' =>'address-book-o',
  21. * 'remark' =>'代理管理'
  22. * )
  23. */
  24. class AgencyRankController extends AdminBaseController
  25. {
  26. /**
  27. * 添加页
  28. * @adminMenu(
  29. * 'name' => '添加页',
  30. * 'parent' => 'agency',
  31. * 'display'=> true,
  32. * 'hasView'=> true,
  33. * 'order' => 10000,
  34. * 'icon' => '',
  35. * 'remark' => '级别添加页',
  36. * 'param' => ''
  37. * )
  38. */
  39. public function index()
  40. {
  41. $list = AgencyRankModel::order('id','asc')->select();
  42. $this->assign('list',$list);
  43. return $this->fetch();
  44. }
  45. /**
  46. * 添加页
  47. * @adminMenu(
  48. * 'name' => '添加页',
  49. * 'parent' => 'index',
  50. * 'display'=> false,
  51. * 'hasView'=> true,
  52. * 'order' => 10000,
  53. * 'icon' => '',
  54. * 'remark' => '级别添加页',
  55. * 'param' => ''
  56. * )
  57. */
  58. public function add()
  59. {
  60. return $this->fetch();
  61. }
  62. public function addPost()
  63. {
  64. $data = $this->request->param();
  65. $agencyRankModel = new AgencyRankModel();
  66. $agencyRankModel->allowField(true)->isUpdate(false)->save($data);
  67. $this->success('添加成功');
  68. }
  69. public function edit()
  70. {
  71. $id = $this->request->param('id');
  72. $info = AgencyRankModel::get($id);
  73. $this->assign('info',$info);
  74. return $this->fetch();
  75. }
  76. public function editPost()
  77. {
  78. $data = $this->request->param();
  79. $agencyRankModel = new AgencyRankModel();
  80. $agencyRankModel->allowField(true)->isUpdate(true)->save($data);
  81. $this->success('修改成功');
  82. }
  83. }