AppVersion.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\v1\system;
  12. use app\adminapi\controller\AuthController;
  13. use app\services\system\AppVersionServices;
  14. use think\facade\App;
  15. /**
  16. *
  17. * Class AppVersion
  18. * @package app\adminapi\controller\v1\system
  19. */
  20. class AppVersion extends AuthController
  21. {
  22. /**
  23. * user constructor.
  24. * @param App $app
  25. * @param AppVersionServices $services
  26. */
  27. public function __construct(App $app, AppVersionServices $services)
  28. {
  29. parent::__construct($app);
  30. $this->services = $services;
  31. }
  32. /**
  33. * 版本列表
  34. * @return \think\Response
  35. * @author wuhaotian
  36. * @email 442384644@qq.com
  37. * @date 2024/4/2
  38. */
  39. public function list()
  40. {
  41. [$platform] = $this->request->getMore([
  42. ['platform', '']
  43. ], true);
  44. return app('json')->success($this->services->versionList($platform));
  45. }
  46. /**
  47. * 新增版本表单
  48. * @param $id
  49. * @return \think\Response
  50. * @throws \FormBuilder\Exception\FormBuilderException
  51. * @author wuhaotian
  52. * @email 442384644@qq.com
  53. * @date 2024/4/2
  54. */
  55. public function crate($id)
  56. {
  57. return app('json')->success($this->services->createForm($id));
  58. }
  59. /**
  60. * 保存数据
  61. * @return \think\Response
  62. * @author wuhaotian
  63. * @email 442384644@qq.com
  64. * @date 2024/4/2
  65. */
  66. public function save()
  67. {
  68. $data = $this->request->postMore([
  69. ['id', 0],
  70. ['version', ''],
  71. ['platform', 1],
  72. ['info', ''],
  73. ['is_force', 1],
  74. ['url', ''],
  75. ['is_new', 1],
  76. ]);
  77. $id = $data['id'];
  78. unset($data['id']);
  79. $this->services->versionSave($id, $data);
  80. return app('json')->success(100021);
  81. }
  82. /**
  83. * 删除App版本
  84. * @param $id
  85. * @return \think\Response
  86. * @author wuhaotian
  87. * @email 442384644@qq.com
  88. * @date 2024/4/2
  89. */
  90. public function del($id)
  91. {
  92. $this->services->delete($id);
  93. return app('json')->success('删除成功');
  94. }
  95. }