feat: 抖音直连商户认证配置后端新增 appSecret 字段

- 实体/Param/Result 新增 appSecret 字段
- Result 字段标注 @SensitiveInfo 自动脱敏(保留前4后4)
- Service.save 通过 Convert IGNORE 策略处理 appSecret 更新
- update-tables.sql 新增 app_secret 列
This commit is contained in:
DaxPay Dev
2026-06-16 10:54:19 +08:00
parent 2a0441e3d2
commit ccb9b611a1
7 changed files with 24 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
-- 支付宝直连商户应用增加应用类型字段
ALTER TABLE "public"."alipay_direct_app"
ADD COLUMN "app_type" varchar(32);
-- 抖音直连商户应用授权认证配置增加应用密钥字段
ALTER TABLE "public"."douyin_direct_app_auth_config"
ADD COLUMN "app_secret" varchar(512);

View File

@@ -4,6 +4,7 @@ import org.dromara.daxpay.channel.douyin.convert.direct.DouyinDirectAppAuthConfi
import org.dromara.daxpay.channel.douyin.result.direct.DouyinDirectAppAuthConfigResult;
import org.dromara.daxpay.payment.common.entity.merchant.MchBaseEntity;
import org.dromara.daxpay.platform.common.mybatisplus.function.ToResult;
import org.dromara.daxpay.platform.common.mybatisplus.handler.encrypt.DataEncryptTypeHandler;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -13,7 +14,7 @@ import lombok.experimental.Accessors;
/// # 抖音直连商户应用授权认证配置
///
/// 配置直连商户应用的授权回调地址,用于抖音用户授权流程中的回调跳转。
/// 配置直连商户应用的应用密钥和授权回调地址,用于抖音用户授权流程中的身份验证与回调跳转。
///
@EqualsAndHashCode(callSuper = true)
@Data
@@ -29,6 +30,10 @@ public class DouyinDirectAppAuthConfig extends MchBaseEntity implements ToResult
@TableField(updateStrategy = FieldStrategy.NEVER)
private Long douyinDirectAppId;
/// 应用密钥(加密存储)
@TableField(typeHandler = DataEncryptTypeHandler.class)
private String appSecret;
/// 授权回调地址
private String authCallbackUrl;

View File

@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
/// # 抖音直连商户应用授权认证配置保存参数
///
/// 保存/更新抖音直连商户应用授权认证配置时接收的请求参数,含商户号、通道商户号和授权回调地址。
/// 保存/更新抖音直连商户应用授权认证配置时接收的请求参数,含商户号、通道商户号、应用密钥和授权回调地址。
///
@Data
@Accessors(chain = true)
@@ -28,6 +28,10 @@ public class DouyinDirectAppAuthConfigParam {
@Schema(description = "通道商户号")
private String channelMchNo;
@Size(max = 512, message = "{validation.field.appSecret.size}")
@Schema(description = "应用密钥")
private String appSecret;
@Size(max = 512, message = "{validation.field.authCallbackUrl.size}")
@Schema(description = "授权回调地址")
private String authCallbackUrl;

View File

@@ -1,5 +1,6 @@
package org.dromara.daxpay.channel.douyin.result.direct;
import org.dromara.daxpay.platform.common.json.sensitive.SensitiveInfo;
import org.dromara.daxpay.payment.common.result.MchBaseResult;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -20,6 +21,10 @@ public class DouyinDirectAppAuthConfigResult extends MchBaseResult {
@Schema(description = "关联应用ID")
private Long douyinDirectAppId;
@SensitiveInfo
@Schema(description = "应用密钥 (已脱敏)")
private String appSecret;
@Schema(description = "授权回调地址")
private String authCallbackUrl;
}

View File

@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
/// # 抖音直连商户应用授权认证配置
///
/// 管理直连商户应用的授权认证配置,查询时不存在则创建默认记录,保存时校验应用归属关系。
/// 管理直连商户应用的密钥和授权认证配置,查询时不存在则创建默认记录,保存时校验应用归属关系。
///
@Slf4j
@Service
@@ -55,6 +55,7 @@ public class DouyinDirectAppAuthConfigService {
}
var config = this.findByDouyinDirectAppId(param.getDouyinDirectAppId());
config.setAuthCallbackUrl(param.getAuthCallbackUrl());
// Convert copy(IGNORE) 自动处理 appSecretnull 不覆盖,非 null 设置新值
DouyinDirectAppAuthConfigConvert.CONVERT.copy(param, config);
douyinDirectAppAuthConfigManager.updateById(config);
}

View File

@@ -16,7 +16,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@TableName(value = "mch_wechat_direct_channel_merchant", autoResultMap = true)
@TableName(value = "wechat_direct_channel_merchant", autoResultMap = true)
public class WechatDirectChannelMerchant extends MchBaseEntity implements ToResult<WechatDirectChannelMerchantResult> {
/// 通道商户号(系统生成雪花号)

View File

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@TableName(value = "mch_wechat_isv_channel_merchant", autoResultMap = true)
@TableName(value = "wechat_isv_channel_merchant", autoResultMap = true)
public class WechatIsvChannelMerchant extends MchBaseEntity implements ToResult<WechatIsvChannelMerchantResult> {
/// 通道商户号(WISV+雪花)