Compare commits

2 Commits

Author SHA1 Message Date
4c284c422c fix: 移除 IoT 卡导入 ICCID 长度限制
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m29s
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-17 12:04:44 +08:00
44e4f03957 docs: 补充微信 JSSDK 配置接口 OpenAPI 文档
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-17 12:04:35 +08:00
2 changed files with 69 additions and 25 deletions

View File

@@ -4514,6 +4514,21 @@ components:
description: 总数
type: integer
type: object
DtoJSSDKConfigResponse:
properties:
app_id:
description: 公众号 AppID
type: string
nonce_str:
description: 随机字符串
type: string
signature:
description: 签名SHA1
type: string
timestamp:
description: 时间戳(秒)
type: integer
type: object
DtoLinkedPackageInfo:
properties:
force_recharge_amount:
@@ -23900,6 +23915,59 @@ paths:
summary: 钱包流水列表
tags:
- 个人客户 - 钱包
/api/c/v1/wechat/jssdk-config:
get:
description: 前端调用 wx.config() 初始化微信 JS-SDK 时所需的签名参数,需传入当前页面完整 URL
parameters:
- description: '当前页面完整 URL含协议和路径不含 # 及其后内容)'
in: query
name: url
required: true
schema:
description: '当前页面完整 URL含协议和路径不含 # 及其后内容)'
type: string
responses:
"200":
content:
application/json:
schema:
properties:
code:
description: 响应码
example: 0
type: integer
data:
$ref: '#/components/schemas/DtoJSSDKConfigResponse'
msg:
description: 响应消息
example: success
type: string
timestamp:
description: 时间戳
format: date-time
type: string
required:
- code
- msg
- data
- timestamp
type: object
description: 成功
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 请求参数错误
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: 服务器内部错误
summary: 获取微信 JSSDK 签名配置
tags:
- 个人客户 - 微信
/api/callback/alipay:
post:
responses:

View File

@@ -2,8 +2,6 @@ package validator
import (
"regexp"
"github.com/break/junhong_cmp_fiber/pkg/constants"
)
var iccidRegex = regexp.MustCompile(`^[0-9A-Za-z]+$`)
@@ -15,7 +13,6 @@ type ICCIDValidationResult struct {
// ValidateICCID 根据运营商类型验证 ICCID 格式
// carrierType: 运营商类型编码 (CMCC/CUCC/CTCC/CBN)
// 电信(CTCC) ICCID 长度为 19 位,其他运营商为 20 位
func ValidateICCID(iccid string, carrierType string) ICCIDValidationResult {
if iccid == "" {
return ICCIDValidationResult{Valid: false, Message: "ICCID 不能为空"}
@@ -25,26 +22,10 @@ func ValidateICCID(iccid string, carrierType string) ICCIDValidationResult {
return ICCIDValidationResult{Valid: false, Message: "ICCID 只能包含字母和数字"}
}
length := len(iccid)
expectedLength := getExpectedICCIDLength(carrierType)
if length != expectedLength {
if carrierType == constants.CarrierCodeCTCC {
return ICCIDValidationResult{Valid: false, Message: "电信 ICCID 必须为 19 位"}
}
return ICCIDValidationResult{Valid: false, Message: "该运营商 ICCID 必须为 20 位"}
}
return ICCIDValidationResult{Valid: true, Message: ""}
}
func getExpectedICCIDLength(carrierType string) int {
if carrierType == constants.CarrierCodeCTCC {
return 19
}
return 20
}
// ValidateICCIDWithoutCarrier 验证 ICCID 格式(不依赖运营商类型)
func ValidateICCIDWithoutCarrier(iccid string) ICCIDValidationResult {
if iccid == "" {
return ICCIDValidationResult{Valid: false, Message: "ICCID 不能为空"}
@@ -54,10 +35,5 @@ func ValidateICCIDWithoutCarrier(iccid string) ICCIDValidationResult {
return ICCIDValidationResult{Valid: false, Message: "ICCID 只能包含字母和数字"}
}
length := len(iccid)
if length != 19 && length != 20 {
return ICCIDValidationResult{Valid: false, Message: "ICCID 长度必须为 19 位或 20 位"}
}
return ICCIDValidationResult{Valid: true, Message: ""}
}