12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare(strict_types=1);
- namespace App\Controller;
- use App\JsonRpc\NewsServiceInterface;
- use App\JsonRpc\WebsiteServiceInterface;
- use App\Tools\PublicData;
- use Hyperf\Di\Annotation\Inject;
- use Hyperf\HttpServer\Annotation\AutoController;
- use App\Tools\Result;
- use Hyperf\Validation\Contract\ValidatorFactoryInterface;
- use App\Constants\ErrorCode;
- use Hyperf\Context\Context;
- /**
- * Class WebController
- * @package App\Controller
- */
- class WebController extends AbstractController
- {
- #[Inject]
- protected ValidatorFactoryInterface $validationFactory;
- /**
- * @var NewsServiceInterface
- */
- #[Inject]
- private $newsServiceClient;
- /**
- * @var WebsiteServiceInterface
- */
- #[Inject]
- private $websiteServiceClient;
-
- /**
- * 获取栏目导航
- * @return array
- */
- public function getWebsiteCategory()
- {
-
- $data = [
- 'website_id'=>Context::get("SiteId")
- ];
- var_dump("网站id:",Context::get("SiteId"));
- $result = $this->websiteServiceClient->getWebsiteCategory($data);
- if ($result['code'] != ErrorCode::SUCCESS) {
- return Result::error($result['message'],0,[]);
- }
- return Result::success($result['data']);
- }
-
- }
|