生日有礼定时奖励

This commit is contained in:
张松
2025-10-15 11:09:43 +08:00
parent f22f32daf9
commit 86e96d48a4
13 changed files with 236 additions and 21 deletions

View File

@@ -38,4 +38,36 @@ public interface TableValueConstant {
}
}
}
interface BirthdayGiftRecord {
@Getter
enum PushStatus {
WAIT_PUSH("wait_push", "待推送"),
NO_PUSH("no_push", "不用推送"),
SUCCESS("success", "推送成功");
private final String code;
private final String msg;
PushStatus(String code, String msg) {
this.code = code;
this.msg = msg;
}
}
}
interface BirthdayGiftRecordCoupon {
@Getter
enum Type {
GIVE("give", "待推送"),
CONSUME("consume", "推送成功");
private final String code;
private final String msg;
Type(String code, String msg) {
this.code = code;
this.msg = msg;
}
}
}
}

View File

@@ -0,0 +1,32 @@
package com.czg.utils;
import cn.hutool.core.lang.func.Func0;
import lombok.extern.slf4j.Slf4j;
import java.util.function.Consumer;
@Slf4j
public class FunUtils {
/**
* 执行方法并捕获异常
* @param func 方法
* @param value 失败的值
*/
public static <T> T safeRun(Func0<T> func, T value) {
try {
return func.call();
} catch (Exception e) {
log.warn("方法执行失败: {}", e.getMessage());
}
return value;
}
public static void safeRunVoid(Runnable func, String... msg) {
try {
func.run();
} catch (Exception e) {
log.warn(msg.length > 0 ? msg[0] : "方法执行失败: {}", e.getMessage());
}
}
}