zoujiajian 2 роки тому
батько
коміт
68a9e08557

+ 6 - 2
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsPopularizeController.java

@@ -310,7 +310,7 @@ public class CpsPopularizeController {
 	 * 用户下载海报记录
 	 */
 	@PostMapping("/poster/record/{posterId}")
-	public Result<String> posterRecord(@PathVariable Long posterId) {
+	public Result<Long> posterRecord(@PathVariable Long posterId) {
 		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
 		DistributePosterGoods distributePosterGoods = distributePosterGoodsMapper.selectById(posterId);
 		if (distributePosterGoods == null) {
@@ -322,8 +322,12 @@ public class CpsPopularizeController {
 		try {
 			userDistributePosterRecordMapper.insert(distributePosterRecord);
 		} catch (DuplicateKeyException e) {
+			distributePosterRecord = userDistributePosterRecordMapper.selectOne(Wrappers.lambdaQuery(UserDistributePosterRecord.class)
+					.eq(UserDistributePosterRecord::getUserId, cpsUserId)
+					.eq(UserDistributePosterRecord::getPosterId, posterId)
+					.last("limit 1"));
 		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
+		return GatewayResponse.SUCCESS.newBuilder().toResult(distributePosterRecord.getId());
 	}
 
 	/**