<?php
namespace app\api\controller;

use app\api\lists\GoodsLists;
use app\api\logic\GoodsLogic;
use app\api\logic\UserCouponLogic;
use app\api\validate\GoodsValidate;
use app\api\validate\UserCouponValidate;

/**
 * 用户控制器
 * Class UserController
 * @package app\api\controller
 */
class GoodsController extends BaseApiController
{
    public array $notNeedLogin = ['lists','hotData','categoryDetail','goodsDetail','categoryCouponList'];


    public function lists()
    {
        return $this->dataLists(new GoodsLists());
    }

    public function hotData(){
        $result = GoodsLogic::getHotData();
        return $this->data($result);
    }

    public function categoryDetail()
    {
        $params = (new GoodsValidate())->goCheck('category');
        $result = GoodsLogic::detail($params['goods_category_id'],'category');
        return $this->data($result);
    }

    public function goodsDetail()
    {
        $params = (new GoodsValidate())->goCheck('goods');
        $result = GoodsLogic::detail($params['id'],'goods');
        return $this->data($result);
    }
}