diff --git a/internal/infrastructure/database/repositories/api/gorm_api_call_repository.go b/internal/infrastructure/database/repositories/api/gorm_api_call_repository.go index 7ec6489..a7a5496 100644 --- a/internal/infrastructure/database/repositories/api/gorm_api_call_repository.go +++ b/internal/infrastructure/database/repositories/api/gorm_api_call_repository.go @@ -149,6 +149,28 @@ func (r *GormApiCallRepository) ListByUserIdWithFiltersAndProductName(ctx contex // 应用筛选条件 if filters != nil { + // 产品ID筛选(支持多个) + if productIds, ok := filters["product_ids"].(string); ok && productIds != "" { + // 多个产品ID,逗号分隔 + productIdsList := strings.Split(productIds, ",") + // 去除空白字符 + var cleanProductIds []string + for _, id := range productIdsList { + id = strings.TrimSpace(id) + if id != "" { + cleanProductIds = append(cleanProductIds, id) + } + } + if len(cleanProductIds) > 0 { + placeholders := strings.Repeat("?,", len(cleanProductIds)) + placeholders = placeholders[:len(placeholders)-1] // 移除最后一个逗号 + whereCondition += " AND ac.product_id IN (" + placeholders + ")" + for _, id := range cleanProductIds { + whereArgs = append(whereArgs, id) + } + } + } + // 时间范围筛选 if startTime, ok := filters["start_time"].(time.Time); ok { whereCondition += " AND ac.created_at >= ?" @@ -337,6 +359,28 @@ func (r *GormApiCallRepository) ListWithFiltersAndProductName(ctx context.Contex whereArgs = append(whereArgs, userId) } + // 产品ID筛选(支持多个) + if productIds, ok := filters["product_ids"].(string); ok && productIds != "" { + // 多个产品ID,逗号分隔 + productIdsList := strings.Split(productIds, ",") + // 去除空白字符 + var cleanProductIds []string + for _, id := range productIdsList { + id = strings.TrimSpace(id) + if id != "" { + cleanProductIds = append(cleanProductIds, id) + } + } + if len(cleanProductIds) > 0 { + placeholders := strings.Repeat("?,", len(cleanProductIds)) + placeholders = placeholders[:len(placeholders)-1] // 移除最后一个逗号 + whereCondition += " AND ac.product_id IN (" + placeholders + ")" + for _, id := range cleanProductIds { + whereArgs = append(whereArgs, id) + } + } + } + // 时间范围筛选 if startTime, ok := filters["start_time"].(time.Time); ok { whereCondition += " AND ac.created_at >= ?" diff --git a/internal/infrastructure/external/huibo/2.md b/internal/infrastructure/external/huibo/2.md new file mode 100644 index 0000000..507e5fd --- /dev/null +++ b/internal/infrastructure/external/huibo/2.md @@ -0,0 +1,90 @@ +自然人公开涉诉信息查询接口文档 +接口编码:BHSC-P_004_0271 +版本:V1.0 +实施日期:2026-04-13 +适用场景:合作厂家接入中胜信用平台,用于个人涉诉案件查询(含失信、限高) +1. 通信说明 +请求方式:HTTP POST +数据格式:JSON +编码格式:UTF-8 +安全要求:请求 IP 需提前绑定 +2. 请求信息 +请求地址 +http://host:port/api/data +请求头(Header) +表格 +参数名 含义 必填 类型 备注 +AppCode 接口授权码 Y String 接口服务商提供 +pcode 产品编码 Y String 固定值:P_004_0271 +请求体(Body) +表格 +参数名 含义 必填 类型 说明 +name 姓名 Y String 支持明文 / MD5 加密 +idCard 身份证号 Y String 支持明文 / MD5 加密 +请求示例(明文) +json +{ + "idCard": "2103111*****0", + "name": "*****" +} +请求示例(加密) +json +{ + "name": "MD5:3e29aae20b7b92775*****", + "idCard": "MD5:a0c28f3a5a*****14" +} +3. 响应信息 +表格 +字段名 含义 类型 备注 +code 状态码 String 参考状态码说明 +message 描述信息 String - +orderNo 订单号 String - +pcode 产品编码 String 与请求一致 +param 请求参数 Object 原样返回 +charge 是否收费 Boolean true = 收费;false = 不收费 +time 响应时间戳 String 13 位毫秒 +data 业务数据 Object 涉诉 / 失信 / 限高数据 +响应示例 +json +{ + "code": "100", + "orderNo": "1361269246899077120", + "charge": true, + "data": { + "ss": { + "preservation": { "count": {} }, + "crc": 35****4186, + "cases_tree": {}, + "administrative": {}, + "civil": {}, + "count": {}, + "implement": {}, + "criminal": {}, + "bankrupt": {} + }, + "sxbzxr": [{}], + "xgbzxr": [] + }, + "pcode": "P_004_0271", + "param": null, + "time": "1744593480538", + "message": "查询成功" +} +data 节点说明 +ss:涉诉案件(民事 / 刑事 / 执行 / 行政 / 破产等) +sxbzxr:失信被执行人 +xgbzxr:限制高消费 +4. 状态码说明 +表格 +状态码 描述 +100 查询成功 +101 参数错误 +103 账户不存在 +104 IP 限制 +105 账号已过期 +107 服务不存在 +108 产品通道已关闭 +109 账户资金不足 +110 查询成功,无数据 +500 未知请求错误 +要不要我帮你把这份接口直接写成可上线的小程序请求代码(含加密、header、异常捕获、状态码统一处理)? \ No newline at end of file diff --git a/internal/infrastructure/http/handlers/api_handler.go b/internal/infrastructure/http/handlers/api_handler.go index 9a9bac2..565d900 100644 --- a/internal/infrastructure/http/handlers/api_handler.go +++ b/internal/infrastructure/http/handlers/api_handler.go @@ -426,6 +426,16 @@ func (h *ApiHandler) GetAdminApiCalls(c *gin.Context) { filters["user_id"] = userId } + // 用户ID列表筛选 + if userIds := c.Query("user_ids"); userIds != "" { + filters["user_ids"] = userIds + } + + // 产品ID列表筛选 + if productIds := c.Query("product_ids"); productIds != "" { + filters["product_ids"] = productIds + } + // 时间范围筛选 if startTime := c.Query("start_time"); startTime != "" { if t, err := time.Parse("2006-01-02 15:04:05", startTime); err == nil {