Files
hjsq_server/models/v/wdtaxmod/withdrawtariff.go
2026-10-08 16:50:13 +08:00

37 lines
841 B
Go

package wdtaxmod
import (
"fmt"
"91jd-server/common/db"
"91jd-server/common/log"
"91jd-server/models"
"go.mongodb.org/mongo-driver/bson"
)
const table = models.WithdrawTariff
func coll() *db.MongoTool {
return mdb.Coll(table)
}
func GetWithDrawTariff() (wt WithdrawTariff, err error) {
if err = coll().FindOne(&wt, bson.M{"_id": 1}); err != nil {
log.Warn(fmt.Sprintf("[METHOD-%s]==> Model %s %s fail error:%+v:", "GetWithDrawTariff", table, "FindOne", err))
}
return
}
func UpdateWithDrawTariff(set WithdrawTariffSelector) (modifyCount int64, err error) {
res, err := coll().UpsertOne(bson.M{"_id": 1}, bson.M{
"$set": set,
})
if err != nil {
log.Warn(fmt.Sprintf("[METHOD-%s]==> Model %s %s fail error:%+v:", "UpdateWithDrawTariff", table, "UpsertOne", err))
return
}
modifyCount = res.ModifiedCount
return
}