| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace crmeb\services;
- use app\common\repositories\system\config\ConfigClassifyRepository;
- use app\common\repositories\system\groupData\GroupDataRepository;
- use app\common\repositories\system\groupData\GroupRepository;
- use crmeb\interfaces\RouteParserInterface;
- use think\Exception;
- use think\exception\ValidateException;
- use think\facade\Log;
- class UpdateAuthInit implements RouteParserInterface
- {
- public function create($route, $method = 'config')
- {
- return $this->{$method}($route);
- }
- public function config($route)
- {
- $resp[] = $route;
- $append = $route['option']['_append'] ?? [];
- try {
- $data = app()->make(ConfigClassifyRepository::class)->getSearch(['status' => 1])
- ->field('classify_name _alias,classify_key _params')
- ->select()->toArray();
- foreach ($data as $k => $v) {
- if ($v['_params'] == 'distribution_tabs') continue;
- $v['_path'] = '/systemForm/Basics/'.$v['_params'];
- $v['_name'] = $route['name'];
- $v['_alias'] = $route['option']['_alias'];
- $v['_repeat'] = true;
- $v['_append'] = $append;
- $resp[]['option'] = $v;
- }
- }catch (Exception $e) {
- throw new ValidateException('配置路由执行失败:' .$e->getMessage());
- }
- return $resp;
- }
- public function groupData($route)
- {
- $resp[] = $route;
- $append = $route['option']['_append'] ?? [];
- try {
- $data = app()->make(GroupRepository::class)->getSearch([])
- ->field('group_name _alias,group_id _params')
- ->select()->toArray();
- foreach ($data as $k => $v) {
- $v['_path'] = '/group/config/'.$v['_params'];
- $v['_name'] = $route['name'];
- $v['_alias'] = $route['option']['_alias'];
- $v['_repeat'] = true;
- $v['_append'] = $append;
- $resp[]['option'] = $v;
- $v['_path'] = '/group/topic/'.$v['_params'];
- $resp[]['option'] = $v;
- }
- }catch (Exception $e) {
- throw new ValidateException('组合数据路由执行失败:' .$e->getMessage());
- }
- return $resp;
- }
- public function agreement($route)
- {
- $resp[] = $route;
- try {
- $resp = [
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/marketing/presell/agreement',
- '_alias' => '预售协议',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/promoter/commission',
- '_alias' => '奖金说明',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/promoter/distribution',
- '_alias' => '等级规则',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/marketing/platform_coupon/instructions',
- '_alias' => '使用说明',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/user/agreement',
- '_alias' => '用户协议',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' =>'systemAgreeSave',
- '_path' =>'/user/member/description',
- '_alias' => '会员等级规则',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' => 'systemAgreeSave',
- '_path' => '/setting/agreements',
- '_alias' => '商户入住申请协议',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' => 'systemAgreeSave',
- '_path' => '/merchant/type/description',
- '_alias' => '店铺类型说明 ',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- [
- 'option' => [
- '_name' => 'systemAgreeSave',
- '_path' => '/accounts/invoiceDesc',
- '_alias' => '发票说明 ',
- '_repeat'=> true,
- '_auth' => true,
- ],
- ],
- ];
- }catch (Exception $e) {
- throw new ValidateException('协议路由执行失败:' .$e->getMessage());
- }
- return $resp;
- }
- }
|