UpdateAuthInit.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\services;
  12. use app\common\repositories\system\config\ConfigClassifyRepository;
  13. use app\common\repositories\system\groupData\GroupDataRepository;
  14. use app\common\repositories\system\groupData\GroupRepository;
  15. use crmeb\interfaces\RouteParserInterface;
  16. use think\Exception;
  17. use think\exception\ValidateException;
  18. use think\facade\Log;
  19. class UpdateAuthInit implements RouteParserInterface
  20. {
  21. public function create($route, $method = 'config')
  22. {
  23. return $this->{$method}($route);
  24. }
  25. public function config($route)
  26. {
  27. $resp[] = $route;
  28. $append = $route['option']['_append'] ?? [];
  29. try {
  30. $data = app()->make(ConfigClassifyRepository::class)->getSearch(['status' => 1])
  31. ->field('classify_name _alias,classify_key _params')
  32. ->select()->toArray();
  33. foreach ($data as $k => $v) {
  34. if ($v['_params'] == 'distribution_tabs') continue;
  35. $v['_path'] = '/systemForm/Basics/'.$v['_params'];
  36. $v['_name'] = $route['name'];
  37. $v['_alias'] = $route['option']['_alias'];
  38. $v['_repeat'] = true;
  39. $v['_append'] = $append;
  40. $resp[]['option'] = $v;
  41. }
  42. }catch (Exception $e) {
  43. throw new ValidateException('配置路由执行失败:' .$e->getMessage());
  44. }
  45. return $resp;
  46. }
  47. public function groupData($route)
  48. {
  49. $resp[] = $route;
  50. $append = $route['option']['_append'] ?? [];
  51. try {
  52. $data = app()->make(GroupRepository::class)->getSearch([])
  53. ->field('group_name _alias,group_id _params')
  54. ->select()->toArray();
  55. foreach ($data as $k => $v) {
  56. $v['_path'] = '/group/config/'.$v['_params'];
  57. $v['_name'] = $route['name'];
  58. $v['_alias'] = $route['option']['_alias'];
  59. $v['_repeat'] = true;
  60. $v['_append'] = $append;
  61. $resp[]['option'] = $v;
  62. $v['_path'] = '/group/topic/'.$v['_params'];
  63. $resp[]['option'] = $v;
  64. }
  65. }catch (Exception $e) {
  66. throw new ValidateException('组合数据路由执行失败:' .$e->getMessage());
  67. }
  68. return $resp;
  69. }
  70. public function agreement($route)
  71. {
  72. $resp[] = $route;
  73. try {
  74. $resp = [
  75. [
  76. 'option' => [
  77. '_name' =>'systemAgreeSave',
  78. '_path' =>'/marketing/presell/agreement',
  79. '_alias' => '预售协议',
  80. '_repeat'=> true,
  81. '_auth' => true,
  82. ],
  83. ],
  84. [
  85. 'option' => [
  86. '_name' =>'systemAgreeSave',
  87. '_path' =>'/promoter/commission',
  88. '_alias' => '奖金说明',
  89. '_repeat'=> true,
  90. '_auth' => true,
  91. ],
  92. ],
  93. [
  94. 'option' => [
  95. '_name' =>'systemAgreeSave',
  96. '_path' =>'/promoter/distribution',
  97. '_alias' => '等级规则',
  98. '_repeat'=> true,
  99. '_auth' => true,
  100. ],
  101. ],
  102. [
  103. 'option' => [
  104. '_name' =>'systemAgreeSave',
  105. '_path' =>'/marketing/platform_coupon/instructions',
  106. '_alias' => '使用说明',
  107. '_repeat'=> true,
  108. '_auth' => true,
  109. ],
  110. ],
  111. [
  112. 'option' => [
  113. '_name' =>'systemAgreeSave',
  114. '_path' =>'/user/agreement',
  115. '_alias' => '用户协议',
  116. '_repeat'=> true,
  117. '_auth' => true,
  118. ],
  119. ],
  120. [
  121. 'option' => [
  122. '_name' =>'systemAgreeSave',
  123. '_path' =>'/user/member/description',
  124. '_alias' => '会员等级规则',
  125. '_repeat'=> true,
  126. '_auth' => true,
  127. ],
  128. ],
  129. [
  130. 'option' => [
  131. '_name' => 'systemAgreeSave',
  132. '_path' => '/setting/agreements',
  133. '_alias' => '商户入住申请协议',
  134. '_repeat'=> true,
  135. '_auth' => true,
  136. ],
  137. ],
  138. [
  139. 'option' => [
  140. '_name' => 'systemAgreeSave',
  141. '_path' => '/merchant/type/description',
  142. '_alias' => '店铺类型说明 ',
  143. '_repeat'=> true,
  144. '_auth' => true,
  145. ],
  146. ],
  147. [
  148. 'option' => [
  149. '_name' => 'systemAgreeSave',
  150. '_path' => '/accounts/invoiceDesc',
  151. '_alias' => '发票说明 ',
  152. '_repeat'=> true,
  153. '_auth' => true,
  154. ],
  155. ],
  156. ];
  157. }catch (Exception $e) {
  158. throw new ValidateException('协议路由执行失败:' .$e->getMessage());
  159. }
  160. return $resp;
  161. }
  162. }