| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\controller\api;
- use app\extra\basic\Base;
- use app\extra\dyLife\data\BaseData;
- use app\middleware\AuthMiddleware;
- use app\model\saas\SaasGoods;
- use app\model\saas\SaasStore;
- use LinFly\Annotation\Attributes\Route\Controller;
- use LinFly\Annotation\Attributes\Route\GetMapping;
- use LinFly\Annotation\Attributes\Route\Middleware;
- use support\Request;
- use support\Response;
- use Webman\RedisQueue\Redis;
- #[Controller("/dy/home"),Middleware(AuthMiddleware::class)]
- class Home extends Base
- {
- /**
- * @var array|string[]
- */
- protected array $noNeedLogin = ["getHomeData","getLicense"];
- #[GetMapping("data")]
- public function getHomeData(Request $request): Response
- {
- try {
- $param = $this->_valid([
- "store.require" => trans("empty.require")
- ],$request->method());
- if (!is_array($param)) return error($param);
- $banner = [
- [
- "cover" => "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/dc7fd761c2e2af9c340f20677f8f115d942f0bde.png"
- ]
- ];
- $store = (new SaasStore)->where("poi_id",$param['store'])->field("poi_name,start_at,end_at,longitude,latitude,service_mobile,poi_id")->findOrEmpty();
- $goods = (new SaasGoods)->where("poi_id",$param['store'])->where("status",1)->field("product_id,product_name,image_list,category,price,line_price,sale_stock,id")->limit(10)->select()->toArray();
- return success("ok",compact('banner','store','goods'));
- } catch (\Throwable $th) {
- return error($th->getMessage());
- }
- }
- #[GetMapping("license")]
- public function getLicense(): Response
- {
- try {
- return success("ok",['img' => sConf("service.license")]);
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|