123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\controller\api\pc;
- use app\Request;
- use app\services\other\CityAreaServices;
- use app\services\pc\PublicServices;
- use crmeb\services\SystemConfigService;
- class PublicController
- {
- protected $services;
- public function __construct(PublicServices $services)
- {
- $this->services = $services;
- }
- /**
- * 获取城市数据
- * @param Request $request
- * @return mixed
- */
- public function getCity(Request $request, CityAreaServices $services)
- {
- [$pid] = $request->getMore([
- [['pid', 'd'], 0],
- ], true);
- return app('json')->success($services->getCityTreeList((int)$pid));
- }
- /**
- * 获取公司信息
- * @return mixed
- */
- public function getCompanyInfo()
- {
- $data = SystemConfigService::more(['contact_number', 'links_open', 'links_list', 'company_address', 'copyright', 'record_No', 'site_name', 'site_keywords', 'site_description', 'pc_logo', 'filing_list']);
- $logoUrl = $data['pc_logo'] ?? '';
- if (strstr($logoUrl, 'http') === false && $logoUrl) {
- $logoUrl = sys_config('site_url') . $logoUrl;
- }
- $logoUrl = str_replace('\\', '/', $logoUrl);
- $data['logoUrl'] = $logoUrl;
- if ($data['links_open']) {
- $linksList = $data['links_list'];
- $linksList = is_array($linksList) ? $linksList : [];
- $edition = $volume = [];
- foreach ($linksList as $key => $row) {
- $volume[$key] = $row['sort'];
- $edition[$key] = $row['url'];
- }
- array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $linksList);
- $data['links_list'] = $linksList;
- } else {
- $data['links_list'] = [];
- }
- if ($data['filing_list']) {
- $filingList = $data['filing_list'];
- $filingList = is_array($filingList) ? $filingList : [];
- $edition = $volume = [];
- foreach ($filingList as $key => $row) {
- $volume[$key] = $row['sort'];
- $edition[$key] = $row['url'];
- }
- array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $filingList);
- $data['filing_list'] = $filingList;
- } else {
- $data['filing_list'] = [];
- }
- return app('json')->successful($data);
- }
- /**
- * 获取关注微信二维码
- * @return mixed
- */
- public function getWechatQrcode()
- {
- $data['wechat_qrcode'] = sys_config('wechat_qrcode');
- return app('json')->successful($data);
- }
- }
|