add QCXG9P1C
This commit is contained in:
@@ -73,8 +73,8 @@ CleanTask:
|
||||
Time: "0 3 * * *"
|
||||
Days: 15
|
||||
Tianyuanapi:
|
||||
AccessID: "3c042bb99b240ccc"
|
||||
Key: "2732f526167c2de9b8dc6aa0f24ba8b7"
|
||||
AccessID: "2974d99ddf0b91a7"
|
||||
Key: "c701a573200f64d4ab38b0aa03ae56d2"
|
||||
BaseURL: "https://api.tianyuanapi.com"
|
||||
Timeout: 60
|
||||
VerifyConfig:
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"tyc-server/app/main/api/internal/config"
|
||||
tianyuanapi "tyc-server/app/main/api/internal/service/tianyuanapi_sdk"
|
||||
"tyc-server/app/main/model"
|
||||
"tyc-server/pkg/lzkit/crypto"
|
||||
"tyc-server/pkg/lzkit/lzUtils"
|
||||
@@ -29,12 +30,13 @@ type ApiRequestService struct {
|
||||
westDexService *WestDexService
|
||||
yushanService *YushanService
|
||||
tianjuService *TianjuService
|
||||
tianyuanapiService *tianyuanapi.Client
|
||||
featureModel model.FeatureModel
|
||||
productFeatureModel model.ProductFeatureModel
|
||||
}
|
||||
|
||||
// NewApiRequestService 是一个构造函数,用于初始化 ApiRequestService
|
||||
func NewApiRequestService(c config.Config, westDexService *WestDexService, yushanService *YushanService, tianjuService *TianjuService, featureModel model.FeatureModel, productFeatureModel model.ProductFeatureModel) *ApiRequestService {
|
||||
func NewApiRequestService(c config.Config, westDexService *WestDexService, yushanService *YushanService, tianjuService *TianjuService, tianyuanapiService *tianyuanapi.Client, featureModel model.FeatureModel, productFeatureModel model.ProductFeatureModel) *ApiRequestService {
|
||||
return &ApiRequestService{
|
||||
config: c,
|
||||
featureModel: featureModel,
|
||||
@@ -42,6 +44,7 @@ func NewApiRequestService(c config.Config, westDexService *WestDexService, yusha
|
||||
westDexService: westDexService,
|
||||
yushanService: yushanService,
|
||||
tianjuService: tianjuService,
|
||||
tianyuanapiService: tianyuanapiService,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +248,9 @@ var requestProcessors = map[string]func(*ApiRequestService, context.Context, []b
|
||||
"G10XM02": (*ApiRequestService).ProcessG10XM02Request,
|
||||
"G11BJ06": (*ApiRequestService).ProcessG11BJ06Request,
|
||||
"G29BJ05": (*ApiRequestService).ProcessG29BJ05Request,
|
||||
|
||||
// 天远API
|
||||
"QCXG9P1C": (*ApiRequestService).ProcessQCXG9P1CRequest,
|
||||
}
|
||||
|
||||
// PreprocessRequestApi 调用指定的请求处理函数
|
||||
@@ -2502,3 +2508,27 @@ func (a *ApiRequestService) ProcessG29BJ05Request(ctx context.Context, params []
|
||||
Data: jsonResult,
|
||||
}, nil
|
||||
}
|
||||
func (a *ApiRequestService) ProcessQCXG9P1CRequest(ctx context.Context, params []byte) (*APIInternalResult, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !name.Exists() || !idCard.Exists() {
|
||||
return nil, errors.New("api请求, QCXG9P1C, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapiService.CallInterface("QCXG9P1C", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"authorized": "1",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jsonResult, err := json.Marshal(resp.Data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("处理出境限制查询结果失败: %v", err)
|
||||
}
|
||||
// 直接返回解密后的数据,而不是再次进行JSON编码
|
||||
return &APIInternalResult{
|
||||
Data: jsonResult,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ func initBusinessServices(c config.Config, models *BaseModels, adminModels *Admi
|
||||
westDexService,
|
||||
yushanService,
|
||||
tianjuService,
|
||||
tianyuanapiService,
|
||||
models.FeatureModel,
|
||||
models.ProductFeatureModel,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user