feat(app): update

This commit is contained in:
Yangtao
2025-11-19 14:24:13 +08:00
parent 1eac66d7fd
commit 0c34585649
329 changed files with 10760 additions and 281 deletions

View File

@ -51,7 +51,7 @@ func Get(url string, headers map[string]string, params map[string]string) (res [
return
}
func Post(url string, headers map[string]string, body map[string]interface{}) (res []byte, e error) {
func Post(url string, headers map[string]string, body map[string]any) (res []byte, e error) {
var (
client = NewClient()
resp *http.Response

View File

@ -47,35 +47,35 @@ func CheckTable(c context.Context, table string) error {
return nil
}
func InsertOne(c context.Context, table string, record interface{}) (*mongo.InsertOneResult, error) {
func InsertOne(c context.Context, table string, record any) (*mongo.InsertOneResult, error) {
if e := CheckTable(c, table); e != nil {
return nil, e
}
return DB.Collection(table).InsertOne(c, record)
}
func SaveOne(c context.Context, table string, filter, record interface{}) (*mongo.UpdateResult, error) {
func SaveOne(c context.Context, table string, filter, record any) (*mongo.UpdateResult, error) {
if e := CheckTable(c, table); e != nil {
return nil, e
}
return DB.Collection(table).ReplaceOne(c, filter, record, options.Replace().SetUpsert(true))
}
func DeleteOne(c context.Context, table string, record interface{}) (*mongo.DeleteResult, error) {
func DeleteOne(c context.Context, table string, record any) (*mongo.DeleteResult, error) {
if e := CheckTable(c, table); e != nil {
return nil, e
}
return DB.Collection(table).DeleteOne(c, record)
}
func UpdateByID(c context.Context, table string, id interface{}, record interface{}) (*mongo.UpdateResult, error) {
func UpdateByID(c context.Context, table string, id any, record any) (*mongo.UpdateResult, error) {
if e := CheckTable(c, table); e != nil {
return nil, e
}
return DB.Collection(table).UpdateByID(c, id, bson.D{{Key: "$set", Value: record}})
}
func Page(c context.Context, table string, page req.Page, filter bson.D, results interface{}) (int64, error) {
func Page(c context.Context, table string, page req.Page, filter bson.D, results any) (int64, error) {
if e := CheckTable(c, table); e != nil {
return 0, e
}

View File

@ -26,15 +26,15 @@ type ImService struct {
// ImMsgBodyAttach IM消息 body对象
type ImMsgBodyAttach struct {
TypeCode string `json:"TypeCode"`
BizData interface{} `json:"BizData"`
Msg string `json:"msg,omitempty"`
TypeCode string `json:"TypeCode"`
BizData any `json:"BizData"`
Msg string `json:"msg,omitempty"`
}
// ChatRoomMsgAttach 聊天室自定义消息
type ChatRoomMsgAttach struct {
TypeCode string `json:"TypeCode"`
BizData interface{} `json:"BizData"`
TypeCode string `json:"TypeCode"`
BizData any `json:"BizData"`
}
// SendCustomMsgToChatroomByChatroomManager 向聊天室发消息

View File

@ -58,7 +58,7 @@ type H5ReCheckLivePersonTokenRsp struct {
IsPayed int64 `json:"isPayed"`
SimilarityScore float64 `json:"similarityScore"`
FaceMatched int64 `json:"faceMatched"`
FaceAttributeInfo interface{} `json:"faceAttributeInfo"`
FaceAttributeInfo any `json:"faceAttributeInfo"`
ExtInfo ExtInfoEntity `json:"extInfo"`
}

View File

@ -13,7 +13,7 @@ import (
sms "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms/v20210111" // 引入sms
)
func _SmsFullContent(template string, param []interface{}) string {
func _SmsFullContent(template string, param []any) string {
var smsTemplateContentMap = map[string]string{
viper.GetString("tencent.smsTemplateCode"): "验证码为:{1},您正在登录,若非本人操作,请勿泄露。",
}

View File

@ -37,7 +37,7 @@ func WeSendMessage(openID, templateID string, message WeSendMessageReq, token st
return
}
}
gotRes, err := Post(strings.ReplaceAll(SendMessageURL, "ACCESS_TOKEN", token), nil, map[string]interface{}{
gotRes, err := Post(strings.ReplaceAll(SendMessageURL, "ACCESS_TOKEN", token), nil, map[string]any{
"template_id": templateID,
"touser": openID,
"data": message,