Commit a93e50e3 by larosa

add some lines

parent bb6dd43e
package consts package consts
const (
// 接口统计中的用户redisKey
API_INTERFACE_USERNAME_KEY = "api_apiKey_interface_user_name_key"
// 接口每天统计上限redisKey
API_INTERFACE_DAYCALLMAX_STATISTICS_KEY = "api_apiKey_interface_dayCallMax_key"
// 接口每分钟统计上限redisKey
API_INTERFACE_MINCALLMAX_STATISTICS_KEY = "api_apiKey_interface_minCallMax_key"
// 接口每天统计情况redisKey
API_INTERFACE_DAYCALL_STATISTICS_KEY = "api_apiKey_interface_dayCall_statistics"
)
...@@ -3,9 +3,13 @@ package service ...@@ -3,9 +3,13 @@ package service
import ( import (
"context" "context"
v1 "dev-ops/api/v1" v1 "dev-ops/api/v1"
"dev-ops/internal/consts"
"dev-ops/utility/response" "dev-ops/utility/response"
"fmt" "fmt"
"github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/frame/g"
"strings"
"time"
) )
type sApiList struct{} type sApiList struct{}
...@@ -20,8 +24,26 @@ func (s *sApiList) GetApiList(ctx context.Context, req *v1.ApiListReq) (interfac ...@@ -20,8 +24,26 @@ func (s *sApiList) GetApiList(ctx context.Context, req *v1.ApiListReq) (interfac
"limit": req.Limit, "limit": req.Limit,
"offset_time": req.OffsetTime, "offset_time": req.OffsetTime,
} }
apiNumsMap := map[string]int{}
fmt.Println(param) fmt.Println(param)
//业务逻辑 先从mongodb中获取全量的openplatform的接口名称,再依次去mysql数据库中查 //业务逻辑 先从mongodb中获取全量的openplatform的接口名称,再依次去mysql数据库中查
interfaceName := "brandgetStandardBrandList" interfaceNameList := []string{"/brand/getStandardBrandList"} //mongodb中获取的接口信息
now := time.Now()
dayStr := now.Format("2006-01-02")
redisDayApiKeyKey := consts.API_INTERFACE_DAYCALL_STATISTICS_KEY + "_" + dayStr
apiKeysData, _ := g.Redis("235").Do(ctx, "SMEMBERS", redisDayApiKeyKey) //先获取所有的apiKey
if nil != apiKeysData && !apiKeysData.IsEmpty() {
for _, apiKey := range apiKeysData.Array() {
redisKey := redisDayApiKeyKey + "_" + apiKey.(string)
interfaceNames, _ := g.Redis("235").Do(ctx, "HKEYS", redisKey)
if interfaceNames != nil {
for _, interfaceItem := range interfaceNameList {
if strings.ReplaceAll(interfaceItem, "/", "") ==
}
}
}
} else {
//redis中暂无数据
}
return "ok", response.CodeSuccess return "ok", response.CodeSuccess
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment