mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2025-12-13 20:49:57 +08:00
添加分区逻辑代码
This commit is contained in:
@@ -55,6 +55,7 @@ func initLegend() {
|
||||
orm.RegisterModel(new(legend.ScalePresent))
|
||||
orm.RegisterModel(new(legend.ScaleTemplate))
|
||||
orm.RegisterModel(new(legend.Group))
|
||||
orm.RegisterModel(new(legend.Area))
|
||||
|
||||
logs.Info("init legend success ......")
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ type AnyMoney struct {
|
||||
GameMoneyName string
|
||||
GameMoneyScale int
|
||||
LimitLow float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const ANYMONEY = "legend_any_money"
|
||||
|
||||
92
legend/models/legend/legendAreaDao.go
Normal file
92
legend/models/legend/legendAreaDao.go
Normal file
@@ -0,0 +1,92 @@
|
||||
package legend
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
type Area struct {
|
||||
Id int `orm:"pk;column(id)"`
|
||||
AreaName string
|
||||
Uid string
|
||||
GroupName string
|
||||
TemplateName string
|
||||
NotifyUrl string
|
||||
AttachParams string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const AREA = "legend_area"
|
||||
|
||||
func (c *Area) TableName() string {
|
||||
return AREA
|
||||
}
|
||||
|
||||
func InsertArea(area *Area) bool {
|
||||
o := orm.NewOrm()
|
||||
if _, err := o.Insert(area); err != nil {
|
||||
logs.Error("insert area err: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func GetAreaByName(name string) *Area {
|
||||
o := orm.NewOrm()
|
||||
area := new(Area)
|
||||
if _, err := o.QueryTable(AREA).Filter("area_name", name).Limit(1).All(area); err != nil {
|
||||
logs.Error("get area by name err:", err)
|
||||
}
|
||||
|
||||
return area
|
||||
}
|
||||
|
||||
func GetAreaAllCount() int {
|
||||
o := orm.NewOrm()
|
||||
count, err := o.QueryTable(AREA).Count()
|
||||
if err != nil {
|
||||
logs.Error("get area all count err:", err)
|
||||
}
|
||||
|
||||
return int(count)
|
||||
}
|
||||
|
||||
func GetAreaList(offset, limit int) []Area {
|
||||
o := orm.NewOrm()
|
||||
var areas []Area
|
||||
if _, err := o.QueryTable(AREA).Limit(limit, offset).OrderBy("-create_time").All(&areas); err != nil {
|
||||
logs.Error(" get area list err:", err)
|
||||
}
|
||||
|
||||
return areas
|
||||
}
|
||||
|
||||
func GetAreaByUid(uid string) *Area {
|
||||
o := orm.NewOrm()
|
||||
area := new(Area)
|
||||
if _, err := o.QueryTable(AREA).Filter("uid", uid).Limit(1).All(area); err != nil {
|
||||
logs.Error(" get area by uid err : ", err)
|
||||
}
|
||||
|
||||
return area
|
||||
}
|
||||
|
||||
func UpdateArea(area *Area) bool {
|
||||
o := orm.NewOrm()
|
||||
if _, err := o.Update(area); err != nil {
|
||||
logs.Error("update area err:", err)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func DeleteAreaByUid(uid string) bool {
|
||||
o := orm.NewOrm()
|
||||
if _, err := o.QueryTable(AREA).Filter("uid", uid).Delete(); err != nil {
|
||||
logs.Error(" delete area by uid err:", err)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
6
legend/models/legend/legendBaseDao.go
Normal file
6
legend/models/legend/legendBaseDao.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package legend
|
||||
|
||||
type BaseDao struct {
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
}
|
||||
@@ -13,8 +13,7 @@ type FixMoney struct {
|
||||
GoodsName string
|
||||
GoodsNo string
|
||||
BuyTimes int
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const FIXMONEY = "legend_fix_money"
|
||||
|
||||
@@ -11,8 +11,7 @@ type FixPresent struct {
|
||||
TemplateName string
|
||||
Money float64
|
||||
PresentMoney float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const FIXPRESENT = "legend_fix_present"
|
||||
|
||||
@@ -6,11 +6,10 @@ import (
|
||||
)
|
||||
|
||||
type Group struct {
|
||||
Id int `orm:"pk;column(id)"`
|
||||
GroupName string
|
||||
Uid string
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
Id int `orm:"pk;column(id)"`
|
||||
GroupName string
|
||||
Uid string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const GROUP = "legend_group"
|
||||
|
||||
@@ -11,8 +11,7 @@ type ScalePresent struct {
|
||||
TemplateName string
|
||||
Money float64
|
||||
PresentScale float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const SCALEPRESENT = "legend_scale_present"
|
||||
|
||||
@@ -13,8 +13,7 @@ type ScaleTemplate struct {
|
||||
UserWarn string
|
||||
MoneyType string
|
||||
PresentType string
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
BaseDao
|
||||
}
|
||||
|
||||
const SCALETMPLETE = "legend_scale_template"
|
||||
|
||||
Reference in New Issue
Block a user