Home.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\controller\api;
  3. use app\extra\basic\Base;
  4. use app\extra\dyLife\data\BaseData;
  5. use app\middleware\AuthMiddleware;
  6. use LinFly\Annotation\Attributes\Route\Controller;
  7. use LinFly\Annotation\Attributes\Route\GetMapping;
  8. use LinFly\Annotation\Attributes\Route\Middleware;
  9. use support\Request;
  10. use support\Response;
  11. use Webman\RedisQueue\Redis;
  12. #[Controller("/dy/home"),Middleware(AuthMiddleware::class)]
  13. class Home extends Base
  14. {
  15. /**
  16. * @var array|string[]
  17. */
  18. protected array $noNeedLogin = ["getHomeData"];
  19. #[GetMapping("data")]
  20. public function getHomeData(Request $request): Response
  21. {
  22. try {
  23. $resp = (new BaseData)->config([
  24. "appid" => sConf("wechat.appid"),
  25. "secret" => sConf("wechat.secret"),
  26. "account" => sConf("wechat.shop_id"),
  27. ])->token()->getStoreCategoryTemplate(6005001);
  28. return $this->success("ok",$resp);
  29. } catch (\Throwable $th) {
  30. return error($th->getMessage());
  31. }
  32. }
  33. }