LangCountry.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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\setting;
  12. use app\adminapi\controller\AuthController;
  13. use app\services\system\lang\LangCountryServices;
  14. use think\facade\App;
  15. class LangCountry extends AuthController
  16. {
  17. /**
  18. * @param App $app
  19. * @param LangCountryServices $services
  20. */
  21. public function __construct(App $app, LangCountryServices $services)
  22. {
  23. parent::__construct($app);
  24. $this->services = $services;
  25. }
  26. /**
  27. * 国家语言列表
  28. * @return mixed
  29. * @throws \think\db\exception\DataNotFoundException
  30. * @throws \think\db\exception\DbException
  31. * @throws \think\db\exception\ModelNotFoundException
  32. */
  33. public function langCountryList()
  34. {
  35. $where = $this->request->getMore([
  36. ['keyword', ''],
  37. ]);
  38. return app('json')->success($this->services->langCountryList($where));
  39. }
  40. /**
  41. * 设置国家语言类型表单
  42. * @param $id
  43. * @return mixed
  44. * @throws \FormBuilder\Exception\FormBuilderException
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\DbException
  47. * @throws \think\db\exception\ModelNotFoundException
  48. */
  49. public function langCountryForm($id)
  50. {
  51. return app('json')->success($this->services->langCountryForm($id));
  52. }
  53. /**
  54. * 地区语言修改
  55. * @param $id
  56. * @return mixed
  57. */
  58. public function langCountrySave($id)
  59. {
  60. $data = $this->request->postMore([
  61. ['name', ''],
  62. ['code', ''],
  63. ['type_id', 0],
  64. ]);
  65. $this->services->langCountrySave($id, $data);
  66. return app('json')->success(100000);
  67. }
  68. public function langCountryDel($id)
  69. {
  70. $this->services->langCountryDel($id);
  71. return app('json')->success(100002);
  72. }
  73. }