PublicController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\v1;
  12. use app\services\activity\combination\StorePinkServices;
  13. use app\services\diy\DiyServices;
  14. use app\services\kefu\service\StoreServiceServices;
  15. use app\services\order\DeliveryServiceServices;
  16. use app\services\other\AgreementServices;
  17. use app\services\other\CacheServices;
  18. use app\services\product\product\StoreCategoryServices;
  19. use app\services\product\product\StoreProductServices;
  20. use app\services\shipping\ExpressServices;
  21. use app\services\shipping\SystemCityServices;
  22. use app\services\system\AppVersionServices;
  23. use app\services\system\attachment\SystemAttachmentServices;
  24. use app\services\system\config\SystemConfigServices;
  25. use app\services\system\store\SystemStoreServices;
  26. use app\services\system\store\SystemStoreStaffServices;
  27. use app\services\user\UserBillServices;
  28. use app\services\user\UserInvoiceServices;
  29. use app\services\user\UserServices;
  30. use app\services\wechat\WechatUserServices;
  31. use app\Request;
  32. use crmeb\services\CacheService;
  33. use app\services\other\UploadService;
  34. use crmeb\services\workerman\ChannelService;
  35. use think\facade\Cache;
  36. /**
  37. * 公共类
  38. * Class PublicController
  39. * @package app\api\controller
  40. */
  41. class PublicController
  42. {
  43. /**
  44. * 主页获取
  45. * @param Request $request
  46. * @return mixed
  47. */
  48. public function index(Request $request)
  49. {
  50. $banner = sys_data('routine_home_banner') ?: [];//TODO 首页banner图
  51. $menus = sys_data('routine_home_menus') ?: [];//TODO 首页按钮
  52. $roll = sys_data('routine_home_roll_news') ?: [];//TODO 首页滚动新闻
  53. $activity = sys_data('routine_home_activity', 3) ?: [];//TODO 首页活动区域图片
  54. $explosive_money = sys_data('index_categy_images') ?: [];//TODO 首页超值爆款
  55. $site_name = sys_config('site_name');
  56. $routine_index_page = sys_data('routine_index_page');
  57. $info['fastInfo'] = $routine_index_page[0]['fast_info'] ?? '';//TODO 快速选择简介
  58. $info['bastInfo'] = $routine_index_page[0]['bast_info'] ?? '';//TODO 精品推荐简介
  59. $info['firstInfo'] = $routine_index_page[0]['first_info'] ?? '';//TODO 首发新品简介
  60. $info['salesInfo'] = $routine_index_page[0]['sales_info'] ?? '';//TODO 促销单品简介
  61. $logoUrl = sys_config('routine_index_logo');//TODO 促销单品简介
  62. if (strstr($logoUrl, 'http') === false && $logoUrl) {
  63. $logoUrl = sys_config('site_url') . $logoUrl;
  64. }
  65. $logoUrl = str_replace('\\', '/', $logoUrl);
  66. $fastNumber = (int)sys_config('fast_number', 0);//TODO 快速选择分类个数
  67. /** @var StoreCategoryServices $categoryService */
  68. $categoryService = app()->make(StoreCategoryServices::class);
  69. $info['fastList'] = $fastNumber ? $categoryService->byIndexList($fastNumber, 'id,cate_name,pid,pic') : [];//TODO 快速选择分类个数
  70. /** @var StoreProductServices $storeProductServices */
  71. $storeProductServices = app()->make(StoreProductServices::class);
  72. //获取推荐商品
  73. [$baseList, $firstList, $benefit, $likeInfo, $vipList] = $storeProductServices->getRecommendProductArr((int)$request->uid(), ['is_best', 'is_new', 'is_benefit', 'is_hot']);
  74. $info['bastList'] = $baseList;//TODO 精品推荐个数
  75. $info['firstList'] = $firstList;//TODO 首发新品个数
  76. $info['bastBanner'] = sys_data('routine_home_bast_banner') ?? [];//TODO 首页精品推荐图片
  77. $lovely = sys_data('routine_home_new_banner') ?: [];//TODO 首发新品顶部图
  78. if ($request->uid()) {
  79. /** @var WechatUserServices $wechatUserService */
  80. $wechatUserService = app()->make(WechatUserServices::class);
  81. $subscribe = (bool)$wechatUserService->value(['uid' => $request->uid()], 'subscribe');
  82. } else {
  83. $subscribe = true;
  84. }
  85. $newGoodsBananr = sys_config('new_goods_bananr');
  86. $tengxun_map_key = sys_config('tengxun_map_key');
  87. return app('json')->success(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'site_name', 'subscribe', 'newGoodsBananr', 'tengxun_map_key', 'explosive_money'));
  88. }
  89. /**
  90. * 获取分享配置
  91. * @return mixed
  92. */
  93. public function share()
  94. {
  95. $data['img'] = sys_config('wechat_share_img');
  96. if (strstr($data['img'], 'http') === false) {
  97. $data['img'] = sys_config('site_url') . $data['img'];
  98. }
  99. $data['img'] = str_replace('\\', '/', $data['img']);
  100. $data['title'] = sys_config('wechat_share_title');
  101. $data['synopsis'] = sys_config('wechat_share_synopsis');
  102. return app('json')->success($data);
  103. }
  104. /**
  105. * 获取网站配置
  106. * @return mixed
  107. */
  108. public function getSiteConfig()
  109. {
  110. $data['record_No'] = sys_config('record_No');
  111. return app('json')->success($data);
  112. }
  113. /**
  114. * 获取个人中心菜单
  115. * @param Request $request
  116. * @return mixed
  117. * @throws \think\db\exception\DataNotFoundException
  118. * @throws \think\db\exception\ModelNotFoundException
  119. * @throws \think\exception\DbException
  120. */
  121. public function menu_user(Request $request)
  122. {
  123. $menusInfo = sys_data('routine_my_menus') ?? [];
  124. $uid = 0;
  125. $userInfo = [];
  126. if ($request->hasMacro('user')) $userInfo = $request->user();
  127. if ($request->hasMacro('uid')) $uid = $request->uid();
  128. $vipOpen = sys_config('member_func_status');
  129. $brokerageFuncStatus = sys_config('brokerage_func_status');
  130. $balanceFuncStatus = sys_config('balance_func_status');
  131. $vipCard = sys_config('member_card_status', 0);
  132. $svipOpen = (bool)sys_config('member_card_status');
  133. $userService = $invoiceStatus = $deliveryUser = $isUserPromoter = $userVerifyStatus = $userOrder = true;
  134. if ($uid && $userInfo) {
  135. /** @var StoreServiceServices $storeService */
  136. $storeService = app()->make(StoreServiceServices::class);
  137. $userService = $storeService->checkoutIsService(['uid' => $uid, 'status' => 1]);
  138. $userOrder = $storeService->checkoutIsService(['uid' => $uid, 'status' => 1, 'customer' => 1]);
  139. /** @var SystemStoreStaffServices $systemStoreStaff */
  140. $systemStoreStaff = app()->make(SystemStoreStaffServices::class);
  141. /** @var UserServices $user */
  142. $user = app()->make(UserServices::class);
  143. /** @var UserInvoiceServices $userInvoice */
  144. $userInvoice = app()->make(UserInvoiceServices::class);
  145. $invoiceStatus = $userInvoice->invoiceFuncStatus(false);
  146. /** @var DeliveryServiceServices $deliveryService */
  147. $deliveryService = app()->make(DeliveryServiceServices::class);
  148. $deliveryUser = $deliveryService->checkoutIsService($uid);
  149. $isUserPromoter = $user->checkUserPromoter($uid, $userInfo);
  150. $userVerifyStatus = $systemStoreStaff->verifyStatus($uid);
  151. }
  152. $auth = [];
  153. $auth['/pages/users/user_vip/index'] = !$vipOpen;
  154. $auth['/pages/users/user_spread_user/index'] = !$brokerageFuncStatus || !$isUserPromoter || $uid == 0;
  155. $auth['/pages/users/user_money/index'] = !$balanceFuncStatus;
  156. $auth['/pages/admin/order/index'] = !$userOrder || $uid == 0;
  157. $auth['/pages/admin/order_cancellation/index'] = (!$userVerifyStatus && !$deliveryUser) || $uid == 0;
  158. $auth['/pages/users/user_invoice_list/index'] = !$invoiceStatus;
  159. $auth['/pages/annex/vip_paid/index'] = !$vipCard || !$svipOpen;
  160. $auth['/kefu/mobile_list'] = !$userService || $uid == 0;
  161. foreach ($menusInfo as $key => &$value) {
  162. if (isset($auth[$value['url']]) && $auth[$value['url']]) {
  163. unset($menusInfo[$key]);
  164. continue;
  165. }
  166. if ($value['url'] == '/kefu/mobile_list') {
  167. $value['url'] = sys_config('site_url') . $value['url'];
  168. if ($request->isRoutine()) {
  169. $value['url'] = str_replace('http://', 'https://', $value['url']);
  170. }
  171. }
  172. }
  173. /** @var SystemConfigServices $systemConfigServices */
  174. $systemConfigServices = app()->make(SystemConfigServices::class);
  175. $bannerInfo = $systemConfigServices->getSpreadBanner() ?? [];
  176. $my_banner = sys_data('routine_my_banner');
  177. $routine_contact_type = sys_config('routine_contact_type', 0);
  178. /** @var DiyServices $diyServices */
  179. $diyServices = app()->make(DiyServices::class);
  180. $diy_data = $diyServices->get(['template_name' => 'member', 'type' => 1], ['value', 'order_status', 'my_banner_status']);
  181. $diy_data = $diy_data ? $diy_data->toArray() : [];
  182. return app('json')->success(['routine_my_menus' => array_merge($menusInfo), 'routine_my_banner' => $my_banner, 'routine_spread_banner' => $bannerInfo, 'routine_contact_type' => $routine_contact_type, 'diy_data' => $diy_data]);
  183. }
  184. /**
  185. * 热门搜索关键字获取
  186. * @return mixed
  187. * @throws \think\db\exception\DataNotFoundException
  188. * @throws \think\db\exception\ModelNotFoundException
  189. * @throws \think\exception\DbException
  190. */
  191. public function search()
  192. {
  193. $routineHotSearch = sys_data('routine_hot_search') ?? [];
  194. $searchKeyword = [];
  195. if (count($routineHotSearch)) {
  196. foreach ($routineHotSearch as $key => &$item) {
  197. array_push($searchKeyword, $item['title']);
  198. }
  199. }
  200. return app('json')->success($searchKeyword);
  201. }
  202. /**
  203. * 图片上传
  204. * @param Request $request
  205. * @return mixed
  206. * @throws \Psr\SimpleCache\InvalidArgumentException
  207. */
  208. public function upload_image(Request $request, SystemAttachmentServices $services)
  209. {
  210. $data = $request->postMore([
  211. ['filename', 'file'],
  212. ]);
  213. if (!$data['filename']) return app('json')->fail(100100);
  214. if (Cache::has('start_uploads_' . $request->uid()) && Cache::get('start_uploads_' . $request->uid()) >= 100) return app('json')->fail(100101);
  215. $upload = UploadService::init();
  216. $info = $upload->to('store/comment')->validate()->move($data['filename']);
  217. if ($info === false) {
  218. return app('json')->fail($upload->getError());
  219. }
  220. $res = $upload->getUploadInfo();
  221. $services->attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, (int)sys_config('upload_type', 1), $res['time'], 3);
  222. if (Cache::has('start_uploads_' . $request->uid()))
  223. $start_uploads = (int)Cache::get('start_uploads_' . $request->uid());
  224. else
  225. $start_uploads = 0;
  226. $start_uploads++;
  227. Cache::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
  228. $res['dir'] = path_to_url($res['dir']);
  229. if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
  230. return app('json')->success(100009, ['name' => $res['name'], 'url' => $res['dir']]);
  231. }
  232. /**
  233. * 物流公司
  234. * @return mixed
  235. */
  236. public function logistics(ExpressServices $services)
  237. {
  238. $expressList = $services->expressList();
  239. return app('json')->success($expressList ?? []);
  240. }
  241. /**
  242. * 短信购买异步通知
  243. *
  244. * @param Request $request
  245. * @return mixed
  246. */
  247. public function sms_pay_notify(Request $request)
  248. {
  249. [$order_id, $price, $status, $num, $pay_time, $attach] = $request->postMore([
  250. ['order_id', ''],
  251. ['price', 0.00],
  252. ['status', 400],
  253. ['num', 0],
  254. ['pay_time', time()],
  255. ['attach', 0],
  256. ], true);
  257. if ($status == 200) {
  258. try {
  259. ChannelService::instance()->send('PAY_SMS_SUCCESS', ['price' => $price, 'number' => $num], [$attach]);
  260. } catch (\Throwable $e) {
  261. }
  262. return app('json')->success(100010);
  263. }
  264. return app('json')->fail(100005);
  265. }
  266. /**
  267. * 记录用户分享
  268. * @param Request $request
  269. * @return mixed
  270. */
  271. public function user_share(Request $request, UserBillServices $services)
  272. {
  273. $uid = (int)$request->uid();
  274. return app('json')->success($services->setUserShare($uid));
  275. }
  276. /**
  277. * 获取图片base64
  278. * @param Request $request
  279. * @return mixed
  280. */
  281. public function get_image_base64(Request $request)
  282. {
  283. [$imageUrl, $codeUrl] = $request->postMore([
  284. ['image', ''],
  285. ['code', ''],
  286. ], true);
  287. if (!preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl) || !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl)) {
  288. return app('json')->fail(100100);
  289. }
  290. try {
  291. $code = CacheService::get($codeUrl, function () use ($codeUrl) {
  292. $codeTmp = $code = $codeUrl ? image_to_base64($codeUrl) : false;
  293. if (!$codeTmp) {
  294. $putCodeUrl = put_image($codeUrl);
  295. $code = $putCodeUrl ? image_to_base64(app()->request->domain(true) . '/' . $putCodeUrl) : false;
  296. $code ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putCodeUrl);
  297. }
  298. return $code;
  299. });
  300. $image = CacheService::get($imageUrl, function () use ($imageUrl) {
  301. $imageTmp = $image = $imageUrl ? image_to_base64($imageUrl) : false;
  302. if (!$imageTmp) {
  303. $putImageUrl = put_image($imageUrl);
  304. $image = $putImageUrl ? image_to_base64(app()->request->domain(true) . '/' . $putImageUrl) : false;
  305. $image ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putImageUrl);
  306. }
  307. return $image;
  308. });
  309. return app('json')->success(compact('code', 'image'));
  310. } catch (\Exception $e) {
  311. return app('json')->fail(100005);
  312. }
  313. }
  314. /**
  315. * 门店列表
  316. * @return mixed
  317. */
  318. public function store_list(Request $request, SystemStoreServices $services)
  319. {
  320. list($latitude, $longitude) = $request->getMore([
  321. ['latitude', ''],
  322. ['longitude', ''],
  323. ], true);
  324. $data['list'] = $services->getStoreList(['type' => 0], ['id', 'name', 'phone', 'address', 'detailed_address', 'image', 'latitude', 'longitude'], $latitude, $longitude);
  325. $data['tengxun_map_key'] = sys_config('tengxun_map_key');
  326. return app('json')->success($data);
  327. }
  328. /**
  329. * 查找城市数据
  330. * @param Request $request
  331. * @return mixed
  332. */
  333. public function city_list(Request $request)
  334. {
  335. /** @var SystemCityServices $systemCity */
  336. $systemCity = app()->make(SystemCityServices::class);
  337. return app('json')->success($systemCity->cityList());
  338. }
  339. /**
  340. * 获取拼团数据
  341. * @return mixed
  342. */
  343. public function pink(StorePinkServices $pink, UserServices $user)
  344. {
  345. $data['pink_count'] = $pink->getCount(['is_refund' => 0]);
  346. $uids = array_flip($pink->getColumn(['is_refund' => 0], 'uid'));
  347. if (count($uids)) {
  348. $uids = array_rand($uids, count($uids) < 3 ? count($uids) : 3);
  349. }
  350. $data['avatars'] = $uids ? $user->getColumn(is_array($uids) ? [['uid', 'in', $uids]] : ['uid' => $uids], 'avatar') : [];
  351. return app('json')->success($data);
  352. }
  353. /**
  354. * 复制口令接口
  355. * @return mixed
  356. */
  357. public function copy_words()
  358. {
  359. $data['words'] = sys_config('copy_words');
  360. return app('json')->success($data);
  361. }
  362. /**生成口令关键字
  363. * @param Request $request
  364. * @return mixed
  365. * @throws \think\db\exception\DataNotFoundException
  366. * @throws \think\db\exception\DbException
  367. * @throws \think\db\exception\ModelNotFoundException
  368. */
  369. public function copy_share_words(Request $request)
  370. {
  371. list($productId) = $request->getMore([
  372. ['product_id', ''],
  373. ], true);
  374. /** @var StoreProductServices $productService */
  375. $productService = app()->make(StoreProductServices::class);
  376. $keyWords['key_words'] = $productService->getProductWords($productId);
  377. return app('json')->success($keyWords);
  378. }
  379. /**
  380. * 获取页面数据
  381. * @return mixed
  382. * @throws \think\db\exception\DataNotFoundException
  383. * @throws \think\db\exception\DbException
  384. * @throws \think\db\exception\ModelNotFoundException
  385. */
  386. public function getDiy(DiyServices $services, $id = 0)
  387. {
  388. return app('json')->success($services->getDiyInfo((int)$id));
  389. }
  390. /**
  391. * 获取底部导航
  392. * @param DiyServices $services
  393. * @param string $template_name
  394. * @return mixed
  395. */
  396. public function getNavigation(DiyServices $services, string $template_name = '')
  397. {
  398. return app('json')->success($services->getNavigation($template_name));
  399. }
  400. /**
  401. * 首页商品数据
  402. * @param Request $request
  403. */
  404. public function home_products_list(Request $request, DiyServices $services)
  405. {
  406. $data = $request->getMore([
  407. ['priceOrder', ''],
  408. ['newsOrder', ''],
  409. ['salesOrder', ''],
  410. [['type', 'd'], 0],
  411. ['ids', ''],
  412. [['selectId', 'd'], ''],
  413. ['selectType', 0],
  414. ['isType', 0],
  415. ]);
  416. $where = [];
  417. $where['is_show'] = 1;
  418. $where['is_del'] = 0;
  419. $where['productId'] = '';
  420. if ($data['selectType'] == 1) {
  421. if (!$data['ids']) {
  422. return app('json')->success(100011);
  423. }
  424. $where['ids'] = $data['ids'] ? explode(',', $data['ids']) : [];
  425. if ($data['type'] != 2 && $data['type'] != 3 && $data['type'] != 8) {
  426. $where['type'] = 0;
  427. } else {
  428. $where['type'] = $data['type'];
  429. }
  430. } else {
  431. $where['priceOrder'] = $data['priceOrder'];
  432. $where['newsOrder'] = $data['newsOrder'];
  433. $where['salesOrder'] = $data['salesOrder'];
  434. $where['type'] = $data['type'];
  435. if ($data['selectId']) {
  436. /** @var StoreCategoryServices $storeCategoryServices */
  437. $storeCategoryServices = app()->make(StoreCategoryServices::class);
  438. if ($storeCategoryServices->value(['id' => $data['selectId']], 'pid')) {
  439. $where['sid'] = $data['selectId'];
  440. } else {
  441. $where['cid'] = $data['selectId'];
  442. }
  443. }
  444. }
  445. return app('json')->success($services->homeProductList($where, $request->uid()));
  446. }
  447. public function getNewAppVersion($platform)
  448. {
  449. /** @var AppVersionServices $appService */
  450. $appService = app()->make(AppVersionServices::class);
  451. return app('json')->success($appService->getNewInfo($platform));
  452. }
  453. public function getCustomerType()
  454. {
  455. $data = [];
  456. $data['customer_type'] = sys_config('customer_type', 0);
  457. $data['customer_phone'] = sys_config('customer_phone', 0);
  458. $data['customer_url'] = sys_config('customer_url', 0);
  459. $data['customer_corpId'] = sys_config('customer_corpId', 0);
  460. return app('json')->success($data);
  461. }
  462. /**
  463. * 统计代码
  464. * @return array|string
  465. */
  466. public function getScript()
  467. {
  468. return sys_config('statistic_script', '');
  469. }
  470. /**
  471. * 获取workerman请求域名
  472. * @return mixed
  473. */
  474. public function getWorkerManUrl()
  475. {
  476. return app('json')->success(getWorkerManUrl());
  477. }
  478. /**
  479. * 首页开屏广告
  480. * @return mixed
  481. */
  482. public function getOpenAdv()
  483. {
  484. /** @var CacheServices $cache */
  485. $cache = app()->make(CacheServices::class);
  486. $data = $cache->getDbCache('open_adv', '');
  487. return app('json')->success($data);
  488. }
  489. /**
  490. * 获取用户协议内容
  491. * @return mixed
  492. */
  493. public function getUserAgreement()
  494. {
  495. /** @var CacheServices $cache */
  496. $cache = app()->make(CacheServices::class);
  497. $content = $cache->getDbCache('user_agreement', '');
  498. return app('json')->success(compact('content'));
  499. }
  500. /**
  501. * 获取协议
  502. * @param AgreementServices $agreementServices
  503. * @param $type
  504. * @return mixed
  505. * @throws \think\db\exception\DataNotFoundException
  506. * @throws \think\db\exception\DbException
  507. * @throws \think\db\exception\ModelNotFoundException
  508. */
  509. public function getAgreement(AgreementServices $agreementServices, $type)
  510. {
  511. $data = $agreementServices->getAgreementBytype($type);
  512. return app('json')->success($data);
  513. }
  514. /**
  515. * 查询版权信息
  516. * @return mixed
  517. */
  518. public function copyright()
  519. {
  520. try {
  521. if (Cache::has('nncnL_crmeb_copyright')) {
  522. $copyrightContext = Cache::get('nncnL_crmeb_copyright');
  523. } else {
  524. /** @var SystemConfigServices $services */
  525. $services = app()->make(SystemConfigServices::class);
  526. $copyrightContext = $services->value(['menu_name' => 'nncnL_crmeb_copyright'], 'value');
  527. $copyrightContext = $copyrightContext ? json_decode($copyrightContext, true) : null;
  528. Cache::set('nncnL_crmeb_copyright', $copyrightContext, 3600);
  529. }
  530. // dump(Cache::has('nncnL_crmeb_copyright_image'));
  531. if (Cache::has('nncnL_crmeb_copyright_image')) {
  532. $copyrightImage = Cache::get('nncnL_crmeb_copyright_image');
  533. } else {
  534. /** @var SystemConfigServices $services */
  535. $services = app()->make(SystemConfigServices::class);
  536. $copyrightImage = $services->value(['menu_name' => 'nncnL_crmeb_copyright_image'], 'value');
  537. $copyrightImage = $copyrightImage ? json_decode($copyrightImage, true) : null;
  538. Cache::set('nncnL_crmeb_copyright_image', $copyrightImage, 3600);
  539. }
  540. } catch (\Throwable $e) {
  541. $copyrightContext = '';
  542. $copyrightImage = '';
  543. }
  544. return app('json')->success(compact('copyrightContext', 'copyrightImage'));
  545. }
  546. }