0, 'msg' => 'I am index']); } /** * 测试用 * * @return Json * @throws RepositoryException */ public function test(): Json { $userId = $this->request->middleware('userInfo')['user_id'] ?? 0; $user = AccountRepository::getInstance()->findById($userId, []); return json(['code' => 0, 'msg' => 'I am test ', 'data' => $user]); } public function login(): Json { $userId = $this->request->middleware('userInfo')['user_id'] ?? 0; return json(['code' => 0, 'msg' => 'I am login '.$userId]); } public function notify() { $beginNotifyList = AccountRepository::getInstance()->getBeginNotifyList(); // $res = Queue::later(3, NotifySms::class, $beginNotifyList); // $getSuccessList = AccountRepository::getInstance()->getSuccessList(); return $this->json(0, 'success', $beginNotifyList); } /** * 小程序个性装修配置 */ public function miniProgramSetting(): Json { $conf = ExtraConfig::miniProgram(); return $this->json(0, 'success', $conf); } /** * 基础配置 * * @return Json */ public function baseConfig(): Json { try { CConfig::load('extra/base', 'base'); $res = config('base')['show_video'] ?? 0; return $this->json(0, 'success', ['v' => (int) $res]); } catch (Exception $e) { return $this->json(5000, '获取基础配置失败'); } } /** * 免责声明 * * @return Json */ public function statement(): Json { try { CConfig::load('extra/statement', 'statement'); $content = config('statement')['content'] ?? ''; $pregRule = "/<[img|IMG].*?src=[\'|\"][\/storage]{1}(.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/"; $content = preg_replace($pregRule, '', (string)$content ); return $this->json(0, 'success', ['content' => $content]); } catch (Exception $e) { return $this->json(5000, '获取免责声明失败'); } } /** * 购买须知 * * @return Json */ public function purchaseinstructions(): Json { try { CConfig::load('extra/purchaseinstructions', 'purchaseinstructions'); $content = config('purchaseinstructions')['content'] ?? ''; $pregRule = "/<[img|IMG].*?src=[\'|\"][\/storage]{1}(.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/"; $content = preg_replace($pregRule, '', (string)$content ); return $this->json(0, 'success', ['content' => $content]); } catch (Exception $e) { return $this->json(5000, '获取失败'); } } /** * 添加微信 * * @return Json */ public function addWechat(): Json { try { CConfig::load('extra/addwechat', 'addwechat'); $res = config('addwechat')?? []; $pregRule = "/<[img|IMG].*?src=[\'|\"][\/storage]{1}(.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/"; $res["content"] = preg_replace($pregRule, '', (string)$res["content"] ); return $this->json(0, 'success', $res); } catch (Exception $e) { return $this->json(5000, '获取添加微信失败'); } } /** * 关于我们 * * @return Json */ public function about(): Json { try { CConfig::load('extra/about', 'about'); $res = config('about')?? []; $pregRule = "/<[img|IMG].*?src=[\'|\"][\/storage]{1}(.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/"; $res["content"] = preg_replace($pregRule, '', (string)$res["content"] ); return $this->json(0, 'success', $res); } catch (Exception $e) { return $this->json(5000, '获取关于我们失败'); } } }