package com.flossom.miniProgram.controller;

import com.flossom.common.core.domain.R;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.miniProgram.service.ISiteInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/siteInfo")
public class SiteInfoController extends BaseController {

    @Autowired
    private ISiteInfoService siteInfoService;

    /**
     * 获取弹窗列表
     *
     * @param openType 弹窗列表：首页、发现模块、活动模块
     * @return
     */
    @GetMapping("/popup/{openType}")
    public R popupList(@PathVariable Integer openType) {
        return R.ok(siteInfoService.popupList(openType));
    }

    /**
     * 获取轮播图
     */
    @GetMapping("/carousel")
    public R carousel() {
        return R.ok(siteInfoService.carousel());
    }

    /**
     * 点击轮播图时保存用户标签
     *
     * @param siteInfoId
     * @return
     */
    @GetMapping("/addTag/{siteInfoId}")
    public AjaxResult addTag(@PathVariable("siteInfoId")  Long siteInfoId) {
        siteInfoService.addTag(siteInfoId);
        return AjaxResult.success();
    }

}
