37 lines
847 B
Go
37 lines
847 B
Go
package wdtaxmod
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"91porn-server/common/db"
|
|
"91porn-server/common/log"
|
|
"91porn-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
|
|
}
|