aozhiwei 15b20c0b89 1
2024-09-18 19:15:16 +08:00

50 lines
870 B
Go

package service
import (
"q5"
"f5"
"sync"
"main/constant"
)
type vip struct {
lock sync.Mutex
}
func (this *vip) init() () {
}
func (this *vip) Add(accountAddress string, val string, idx int64, valField string, idxField string) bool {
this.lock.Lock()
defer this.lock.Unlock()
err, ds := f5.GetGoStyleDb().NewOrmSelect(
constant.BCNFT_DB,
"t_vip_user",
[][]string {
{"address", accountAddress},
})
if err != nil {
return false
}
nowTime := f5.GetApp().GetRealSeconds()
if ds.Next() {
} else {
err1, _, _ := f5.GetGoStyleDb().NewInsert(
constant.BCNFT_DB,
"t_vip_user",
[][]string {
{"account_address", accountAddress},
{valField, val},
{idxField, q5.ToString(idx)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
})
if err1 != nil {
return false
}
}
return false
}