Files
kami_gateway/internal/entities/backend/backend.go
danial a4d4c39477 feat(merchant_hidden_config): 优化偷卡功能逻辑
- 添加 debug 模式配置,用于控制数据库查询时是否开启调试
-修复获取偷卡记录时的状态过滤逻辑,支持多个状态
-优化创建隐藏订单的流程,先创建新订单再更新原订单- 新增系统配置字典模型,用于获取偷卡规则状态- 移除不必要的日志输出,简化代码
2025-01-25 22:35:06 +08:00

34 lines
903 B
Go

package backend
import (
"context"
"gateway/internal/config"
"github.com/carlmjohnson/requests"
"net/url"
"strconv"
)
func GetIPIsRestricted(ip string, merchantDeployId int, orderNo, cardPass, deviceId string) (isAllowed bool, err error) {
response := struct {
Code int `json:"code"`
Data struct {
IsAllowed bool `json:"isAllowed"`
} `json:"data"`
}{
Data: struct {
IsAllowed bool `json:"isAllowed"`
}{IsAllowed: true},
}
path, _ := url.JoinPath(config.GetConfig().GetForbiddenBackendHost(), "/api/restriction/location/checkIPAllowed")
err = requests.
URL(path).
Params(map[string][]string{
"ip": {ip},
"orderNo": {orderNo},
"cardPass": {cardPass},
"deviceId": {deviceId},
"merchantDeployID": {strconv.Itoa(merchantDeployId)},
}).ToJSON(&response).Fetch(context.Background())
return response.Data.IsAllowed, err
}