- 添加 debug 模式配置,用于控制数据库查询时是否开启调试 -修复获取偷卡记录时的状态过滤逻辑,支持多个状态 -优化创建隐藏订单的流程,先创建新订单再更新原订单- 新增系统配置字典模型,用于获取偷卡规则状态- 移除不必要的日志输出,简化代码
34 lines
903 B
Go
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
|
|
}
|