PublicController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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 ($imageUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $imageUrl)) {
  288. return app('json')->success(['code' => false, 'image' => false]);
  289. }
  290. if ($codeUrl !== '' && !preg_match('/.*(\.png|\.jpg|\.jpeg|\.gif)$/', $codeUrl)) {
  291. return app('json')->success(['code' => false, 'image' => false]);
  292. }
  293. try {
  294. $code = CacheService::get($codeUrl, function () use ($codeUrl) {
  295. $codeTmp = $code = $codeUrl ? image_to_base64($codeUrl) : false;
  296. if (!$codeTmp) {
  297. $putCodeUrl = put_image($codeUrl);
  298. $code = $putCodeUrl ? image_to_base64(app()->request->domain(true) . '/' . $putCodeUrl) : false;
  299. $code ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putCodeUrl);
  300. }
  301. return $code;
  302. });
  303. $image = CacheService::get($imageUrl, function () use ($imageUrl) {
  304. $imageTmp = $image = $imageUrl ? image_to_base64($imageUrl) : false;
  305. if (!$imageTmp) {
  306. $putImageUrl = put_image($imageUrl);
  307. $image = $putImageUrl ? image_to_base64(app()->request->domain(true) . '/' . $putImageUrl) : false;
  308. $image ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putImageUrl);
  309. }
  310. return $image;
  311. });
  312. return app('json')->success(compact('code', 'image'));
  313. } catch (\Exception $e) {
  314. return app('json')->fail(100005);
  315. }
  316. }
  317. /**
  318. * 门店列表
  319. * @return mixed
  320. */
  321. public function store_list(Request $request, SystemStoreServices $services)
  322. {
  323. list($latitude, $longitude) = $request->getMore([
  324. ['latitude', ''],
  325. ['longitude', ''],
  326. ], true);
  327. $data['list'] = $services->getStoreList(['type' => 0], ['id', 'name', 'phone', 'address', 'detailed_address', 'image', 'latitude', 'longitude'], $latitude, $longitude);
  328. $data['tengxun_map_key'] = sys_config('tengxun_map_key');
  329. return app('json')->success($data);
  330. }
  331. /**
  332. * 查找城市数据
  333. * @param Request $request
  334. * @return mixed
  335. */
  336. public function city_list(Request $request)
  337. {
  338. /** @var SystemCityServices $systemCity */
  339. $systemCity = app()->make(SystemCityServices::class);
  340. return app('json')->success($systemCity->cityList());
  341. }
  342. /**
  343. * 获取拼团数据
  344. * @return mixed
  345. */
  346. public function pink(StorePinkServices $pink, UserServices $user)
  347. {
  348. $data['pink_count'] = $pink->getCount(['is_refund' => 0]);
  349. $uids = array_flip($pink->getColumn(['is_refund' => 0], 'uid'));
  350. if (count($uids)) {
  351. $uids = array_rand($uids, count($uids) < 3 ? count($uids) : 3);
  352. }
  353. $data['avatars'] = $uids ? $user->getColumn(is_array($uids) ? [['uid', 'in', $uids]] : ['uid' => $uids], 'avatar') : [];
  354. return app('json')->success($data);
  355. }
  356. /**
  357. * 复制口令接口
  358. * @return mixed
  359. */
  360. public function copy_words()
  361. {
  362. $data['words'] = sys_config('copy_words');
  363. return app('json')->success($data);
  364. }
  365. /**生成口令关键字
  366. * @param Request $request
  367. * @return mixed
  368. * @throws \think\db\exception\DataNotFoundException
  369. * @throws \think\db\exception\DbException
  370. * @throws \think\db\exception\ModelNotFoundException
  371. */
  372. public function copy_share_words(Request $request)
  373. {
  374. list($productId) = $request->getMore([
  375. ['product_id', ''],
  376. ], true);
  377. /** @var StoreProductServices $productService */
  378. $productService = app()->make(StoreProductServices::class);
  379. $keyWords['key_words'] = $productService->getProductWords($productId);
  380. return app('json')->success($keyWords);
  381. }
  382. /**
  383. * 获取页面数据
  384. * @return mixed
  385. * @throws \think\db\exception\DataNotFoundException
  386. * @throws \think\db\exception\DbException
  387. * @throws \think\db\exception\ModelNotFoundException
  388. */
  389. public function getDiy(DiyServices $services, $id = 0)
  390. {
  391. return app('json')->success($services->getDiyInfo((int)$id));
  392. }
  393. /**
  394. * 获取底部导航
  395. * @param DiyServices $services
  396. * @param string $template_name
  397. * @return mixed
  398. */
  399. public function getNavigation(DiyServices $services, string $template_name = '')
  400. {
  401. return app('json')->success($services->getNavigation($template_name));
  402. }
  403. /**
  404. * 首页商品数据
  405. * @param Request $request
  406. */
  407. public function home_products_list(Request $request, DiyServices $services)
  408. {
  409. $data = $request->getMore([
  410. ['priceOrder', ''],
  411. ['newsOrder', ''],
  412. ['salesOrder', ''],
  413. [['type', 'd'], 0],
  414. ['ids', ''],
  415. [['selectId', 'd'], ''],
  416. ['selectType', 0],
  417. ['isType', 0],
  418. ]);
  419. $where = [];
  420. $where['is_show'] = 1;
  421. $where['is_del'] = 0;
  422. $where['productId'] = '';
  423. if ($data['selectType'] == 1) {
  424. if (!$data['ids']) {
  425. return app('json')->success(100011);
  426. }
  427. $where['ids'] = $data['ids'] ? explode(',', $data['ids']) : [];
  428. if ($data['type'] != 2 && $data['type'] != 3 && $data['type'] != 8) {
  429. $where['type'] = 0;
  430. } else {
  431. $where['type'] = $data['type'];
  432. }
  433. } else {
  434. $where['priceOrder'] = $data['priceOrder'];
  435. $where['newsOrder'] = $data['newsOrder'];
  436. $where['salesOrder'] = $data['salesOrder'];
  437. $where['type'] = $data['type'];
  438. if ($data['selectId']) {
  439. /** @var StoreCategoryServices $storeCategoryServices */
  440. $storeCategoryServices = app()->make(StoreCategoryServices::class);
  441. if ($storeCategoryServices->value(['id' => $data['selectId']], 'pid')) {
  442. $where['sid'] = $data['selectId'];
  443. } else {
  444. $where['cid'] = $data['selectId'];
  445. }
  446. }
  447. }
  448. return app('json')->success($services->homeProductList($where, $request->uid()));
  449. }
  450. public function getNewAppVersion($platform)
  451. {
  452. /** @var AppVersionServices $appService */
  453. $appService = app()->make(AppVersionServices::class);
  454. return app('json')->success($appService->getNewInfo($platform));
  455. }
  456. public function getCustomerType()
  457. {
  458. $data = [];
  459. $data['customer_type'] = sys_config('customer_type', 0);
  460. $data['customer_phone'] = sys_config('customer_phone', 0);
  461. $data['customer_url'] = sys_config('customer_url', 0);
  462. $data['customer_corpId'] = sys_config('customer_corpId', 0);
  463. return app('json')->success($data);
  464. }
  465. /**
  466. * 统计代码
  467. * @return array|string
  468. */
  469. public function getScript()
  470. {
  471. return sys_config('statistic_script', '');
  472. }
  473. /**
  474. * 获取workerman请求域名
  475. * @return mixed
  476. */
  477. public function getWorkerManUrl()
  478. {
  479. return app('json')->success(getWorkerManUrl());
  480. }
  481. /**
  482. * 首页开屏广告
  483. * @return mixed
  484. */
  485. public function getOpenAdv()
  486. {
  487. /** @var CacheServices $cache */
  488. $cache = app()->make(CacheServices::class);
  489. $data = $cache->getDbCache('open_adv', '');
  490. return app('json')->success($data);
  491. }
  492. /**
  493. * 获取用户协议内容
  494. * @return mixed
  495. */
  496. public function getUserAgreement()
  497. {
  498. /** @var CacheServices $cache */
  499. $cache = app()->make(CacheServices::class);
  500. $content = $cache->getDbCache('user_agreement', '');
  501. return app('json')->success(compact('content'));
  502. }
  503. /**
  504. * 获取协议
  505. * @param AgreementServices $agreementServices
  506. * @param $type
  507. * @return mixed
  508. * @throws \think\db\exception\DataNotFoundException
  509. * @throws \think\db\exception\DbException
  510. * @throws \think\db\exception\ModelNotFoundException
  511. */
  512. public function getAgreement(AgreementServices $agreementServices, $type)
  513. {
  514. $data = $agreementServices->getAgreementBytype($type);
  515. return app('json')->success($data);
  516. }
  517. /**
  518. * 查询版权信息
  519. * @return mixed
  520. */
  521. public function copyright()
  522. {
  523. try {
  524. if (Cache::has('nncnL_crmeb_copyright')) {
  525. $copyrightContext = Cache::get('nncnL_crmeb_copyright');
  526. } else {
  527. /** @var SystemConfigServices $services */
  528. $services = app()->make(SystemConfigServices::class);
  529. $copyrightContext = $services->value(['menu_name' => 'nncnL_crmeb_copyright'], 'value');
  530. $copyrightContext = $copyrightContext ? json_decode($copyrightContext, true) : null;
  531. Cache::set('nncnL_crmeb_copyright', $copyrightContext, 3600);
  532. }
  533. // dump(Cache::has('nncnL_crmeb_copyright_image'));
  534. if (Cache::has('nncnL_crmeb_copyright_image')) {
  535. $copyrightImage = Cache::get('nncnL_crmeb_copyright_image');
  536. } else {
  537. /** @var SystemConfigServices $services */
  538. $services = app()->make(SystemConfigServices::class);
  539. $copyrightImage = $services->value(['menu_name' => 'nncnL_crmeb_copyright_image'], 'value');
  540. $copyrightImage = $copyrightImage ? json_decode($copyrightImage, true) : null;
  541. Cache::set('nncnL_crmeb_copyright_image', $copyrightImage, 3600);
  542. }
  543. } catch (\Throwable $e) {
  544. $copyrightContext = '';
  545. $copyrightImage = '';
  546. }
  547. return app('json')->success(compact('copyrightContext', 'copyrightImage'));
  548. }
  549. }