LangCode.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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\setting;
  12. use app\adminapi\controller\AuthController;
  13. use app\services\system\lang\LangCodeServices;
  14. use think\facade\App;
  15. class LangCode extends AuthController
  16. {
  17. /**
  18. * @param App $app
  19. * @param LangCodeServices $services
  20. */
  21. public function __construct(App $app, LangCodeServices $services)
  22. {
  23. parent::__construct($app);
  24. $this->services = $services;
  25. }
  26. /**
  27. * 获取语言列表
  28. * @return mixed
  29. * @throws \ReflectionException
  30. * @throws \think\db\exception\DataNotFoundException
  31. * @throws \think\db\exception\DbException
  32. * @throws \think\db\exception\ModelNotFoundException
  33. */
  34. public function langCodeList()
  35. {
  36. $where = $this->request->getMore([
  37. ['is_admin', 0],
  38. ['type_id', 0],
  39. ['code', ''],
  40. ['remarks', '']
  41. ]);
  42. return app('json')->success($this->services->langCodeList($where));
  43. }
  44. /**
  45. * 获取语言详情
  46. * @return mixed
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\DbException
  49. * @throws \think\db\exception\ModelNotFoundException
  50. */
  51. public function langCodeInfo()
  52. {
  53. [$code] = $this->request->getMore([
  54. ['code', ''],
  55. ], true);
  56. return app('json')->success($this->services->langCodeInfo($code));
  57. }
  58. /**
  59. * 新增编辑语言
  60. * @return mixed
  61. * @throws \Exception
  62. */
  63. public function langCodeSave()
  64. {
  65. $data = $this->request->postMore([
  66. ['is_admin', 0],
  67. ['code', ''],
  68. ['remarks', ''],
  69. ['edit', 0],
  70. ['list', []]
  71. ]);
  72. $this->services->langCodeSave($data);
  73. return app('json')->success(100000);
  74. }
  75. /**
  76. * 删除语言
  77. * @param $id
  78. * @return mixed
  79. */
  80. public function langCodeDel($id)
  81. {
  82. $this->services->langCodeDel($id);
  83. return app('json')->success(100002);
  84. }
  85. }