系统架构层面流量控制功能完善

This commit is contained in:
flswld
2023-02-05 07:18:43 +08:00
parent cfb001c18a
commit 94c8db402a
51 changed files with 1049 additions and 2408 deletions

View File

@@ -0,0 +1,25 @@
package dao
import (
"context"
"hk4e/dispatch/model"
"hk4e/pkg/logger"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func (d *Dao) InsertClientLog(clientLog *model.ClientLog) (primitive.ObjectID, error) {
db := d.db.Collection("client_log")
id, err := db.InsertOne(context.TODO(), clientLog)
if err != nil {
return primitive.ObjectID{}, err
} else {
_id, ok := id.InsertedID.(primitive.ObjectID)
if !ok {
logger.Error("get insert id error")
return primitive.ObjectID{}, nil
}
return _id, nil
}
}