ApplicationController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/9/22
  8. * Time: 13:37
  9. */
  10. namespace business\admin\controllers;
  11. use business\common\controllers\components\BaseController;
  12. use business\common\services\BusinessService;
  13. use business\common\services\SettingService;
  14. class ApplicationController extends BaseController
  15. {
  16. public $type = [
  17. ['name' => '办公管理', 'key' => 'businessApplicationWork'],
  18. ['name' => '销售管理', 'key' => 'businessApplicationSales'],
  19. ['name' => '工具软件', 'key' => 'businessApplicationTool'],
  20. ];
  21. public function getApplicationList()
  22. {
  23. $plugin_function = \app\common\modules\shop\ShopConfig::current()->get(SettingService::BUSINESS_PLUGIN_KEY) ?: [];
  24. $type_key = array_column($this->type, 'key');
  25. $return_data = [];
  26. $auth = BusinessService::checkBusinessRight();
  27. foreach ($plugin_function as $v) {
  28. $class = $v['class'];
  29. $function = $v['function'];
  30. if (!method_exists($class, $function)) continue;
  31. $res = $class::$function();
  32. if (!$res || !in_array($res['type'], $type_key)) continue;
  33. if (!$this_page_route = $auth['page_route'][$res['plugin']]) continue;
  34. foreach ($this_page_route as $vv) {
  35. // if ($vv['route'] == $res['route']) {
  36. if ($vv['can'] || $auth['identity'] > 1) {
  37. $res['icon'] = file_exists(base_path('static/yunshop/plugins/list-icon/img/' . $res['icon'] . '.png')) ? static_url("yunshop/plugins/list-icon/img/{$res['icon']}.png") : static_url("yunshop/plugins/list-icon/img/default2.png");
  38. $res['icon'] = request()->getSchemeAndHttpHost() . $res['icon'];
  39. $return_data[$res['type']][] = $res;
  40. break;
  41. }
  42. // }
  43. }
  44. }
  45. return $this->successJson('成功', ['plugin_list' => $return_data, 'type' => $this->type]);
  46. }
  47. }