package com.sqx.modules.activityManage.controller.app;


import com.sqx.common.utils.Result;
import com.sqx.modules.activityManage.entity.ActivityManage;
import com.sqx.modules.activityManage.service.ActivityManageService;
import com.sqx.modules.goods.entity.GoodsShop;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 活动管理
 * </p>
 *
 * @author 吴畅
 * @since 2022-11-04
 */
@RestController
@RequestMapping("/app/activityManage/")
public class AppActivityManageController {
    @Autowired
    private ActivityManageService activityManageService;


    @GetMapping("getActivityList")
    @ApiOperation("获取活动列表")
    public Result getActivityList(Integer page, Integer limit, ActivityManage activityManage) {
        activityManage.setIsEnable(1);
        return Result.success().put("data", activityManageService.getActivityList(page, limit, activityManage));
    }

    @GetMapping("getActivityInfo")
    @ApiOperation("获取活动信息")
    public Result getActivityInfo(Long activityId) {
        return Result.success().put("data", activityManageService.getActivityInfo(activityId));
    }

    @GetMapping("getShoActivityShopList")
    @ApiOperation("根据活动查找商家列表")
    public Result getShoActivityShopList(Integer page, Integer limit,Double lng,Double lat, GoodsShop goodsShop) {
        return Result.success().put("data", activityManageService.getShoActivityShopList(page, limit,lng,lat ,goodsShop));
    }

    @GetMapping("shopJoinActivity")
    @ApiOperation("商户主动加入活动")
    private Result shopJoinActivity(Long shopId, Long activityId) {
        return activityManageService.shopJoinActivity(shopId, activityId,0);
    }
}

