package com.cyksj.web.controller.user;

import com.cyksj.dto.Result;
import com.cyksj.enums.GatewayResponse;
import com.cyksj.model.request.DistributePopularizeClickReq;
import com.cyksj.service.click.UserClickRecordService;
import com.cyksj.web.util.StpUserUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目名: yhlxj
 * 文件名: UserClickRecordController
 * 创建者: JavaZou
 * 创建时间:2024/8/14 18:50
 */
@RestController
@RequestMapping("/applets/click")
@RequiredArgsConstructor
public class UserClickRecordController {
	private final UserClickRecordService userClickRecordService;

	/**
	 * 渠道推广链接点击记录
	 */
	@PostMapping("/distribute/popularize/record")
	public Result<String> recordDistributePopularize(@RequestBody DistributePopularizeClickReq clickReq) {
		Long userIdAfterLogin = StpUserUtil.getUserIdAfterLogin();
		userClickRecordService.recordDistributePopularize(userIdAfterLogin, clickReq);
		return GatewayResponse.SUCCESS.newBuilder().toResult();
	}
}
