1 Star 0 Fork 0

i-hea / models

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
bills.go 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
Peter 提交于 2021-04-22 19:18 . update bills.go.
package models
import (
"time"
"github.com/astaxie/beego/orm"
"github.com/astaxie/beego"
)
type IpccBillsTts struct {
Id int
Text string
Appid string
CreatTime time.Time
CallId string
TextCount int
BillTimes int
}
func SaveTtsRecordToDb(records []*IpccBillsTts) bool {
num := len(records)
if 0 == num || nil == records {
return false
}
o := orm.NewOrm()
o.Using("default")
succNum, err := o.InsertMulti(num, records)
if err != nil || num != int(succNum) {
beego.Error("insert to db failed :%v,success:%v,want to:%v!", err, succNum, num)
return false
}
return true
}
func RegIpccBillsTtsRecord() {
orm.RegisterModel(new(IpccBillsTts))
}
type TWebankBill struct {
Id int
Callid string
appid string `orm:"appid"`
caller string `orm:"caller"`
called string `orm:"callid"`
ivtTime int `orm:"ivtTime"`
totalTime int `orm:"totalTime"`
billTime int `orm:"billTime"`
callTime time.Time `orm:"callTime";type(datetime)`
creatTime time.Time `orm:"creatTime";type(datetime)`
}
func GetBillByCallId(callid string) (TWebankBill, error) {
bill := TWebankBill{
Callid: callid,
}
o := orm.NewOrm()
o.Using("default")
err := o.Read(&bill, "callid")
return bill, err
}
func RegIpccBillsRecord() {
orm.RegisterModel(new(TWebankBill))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/i-hea/models.git
git@gitee.com:i-hea/models.git
i-hea
models
models
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891