@@ -0,0 +1,7 @@ | |||||
package dao | |||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
type ServiceAwardReturnBaseDao interface { | |||||
GetServiceAwardReturnBase() (m *models.ServiceAwardReturnBase, err error) | |||||
} |
@@ -0,0 +1,8 @@ | |||||
package dao | |||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
type ServiceAwardReturnFlowDao interface { | |||||
GetServiceAwardReturnFlowTotal(types, createTime string) (sum float64, hasReturnMoney float64, err error) | |||||
GetServiceAwardReturnFlowList(types, p, size int, createTime string) (mm *[]models.ServiceAwardReturnFlow, err error) | |||||
} |
@@ -0,0 +1,28 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewServiceAwardReturnBaseDb(engine *xorm.Engine) dao.ServiceAwardReturnBaseDao { | |||||
return &ServiceAwardReturnBaseDb{Db: engine} | |||||
} | |||||
type ServiceAwardReturnBaseDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (s ServiceAwardReturnBaseDb) GetServiceAwardReturnBase() (m *models.ServiceAwardReturnBase, err error) { | |||||
m = new(models.ServiceAwardReturnBase) | |||||
has, err := s.Db.Where("1 = 1").Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} |
@@ -0,0 +1,40 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewServiceAwardReturnFlowDb(engine *xorm.Engine) dao.ServiceAwardReturnFlowDao { | |||||
return &ServiceAwardReturnFlowDb{Db: engine} | |||||
} | |||||
type ServiceAwardReturnFlowDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (s ServiceAwardReturnFlowDb) GetServiceAwardReturnFlowTotal(types, createTime string) (sum float64, hasReturnMoney float64, err error) { | |||||
sess := s.Db.Where("sum-has_return_money>0 and type>?", 0) | |||||
if types != "" { | |||||
sess.And("type=?", types) | |||||
} | |||||
if createTime != "" { | |||||
sess.And("date<?", createTime) | |||||
} | |||||
sum, _ = sess.Sum(&models.ServiceAwardReturnFlow{}, "sum") | |||||
hasReturnMoney, _ = sess.Sum(&models.ServiceAwardReturnFlow{}, "has_return_money") | |||||
return sum, hasReturnMoney, nil | |||||
} | |||||
func (s ServiceAwardReturnFlowDb) GetServiceAwardReturnFlowList(types, p, size int, createTime string) (mm *[]models.ServiceAwardReturnFlow, err error) { | |||||
var m []models.ServiceAwardReturnFlow | |||||
sess := s.Db.Where("sum-has_return_money>0 and type=?", types) | |||||
if createTime != "" { | |||||
sess.And("date<?", createTime) | |||||
} | |||||
err = sess.Limit(size, (p-1)*size).Find(&m) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
return &m, nil | |||||
} |
@@ -0,0 +1,13 @@ | |||||
package models | |||||
type ServiceAwardReturnBase struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
TimeType int `json:"time_type" xorm:"default 0 comment('0.每月统一返还(要选择哪一天) 1.按赠送购物金的具体时间每月返还') INT(1)"` | |||||
Day string `json:"day" xorm:"VARCHAR(255)"` | |||||
ReturnType int `json:"return_type" xorm:"default 0 comment('0系统分期返还方式, 1手动设置返还方式') INT(1)"` | |||||
CpsPeriod int `json:"cps_period" xorm:"default 0 INT(11)"` | |||||
MallPeriod int `json:"mall_period" xorm:"default 0 INT(11)"` | |||||
MemberUplvPeriod int `json:"member_uplv_period" xorm:"INT(11)"` | |||||
NewMemberPeriod int `json:"new_member_period" xorm:"default 0 INT(11)"` | |||||
CoinId int `json:"coin_id" xorm:"default 0 INT(11)"` | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package models | |||||
import ( | |||||
"time" | |||||
) | |||||
type ServiceAwardReturnFlow struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||||
Time time.Time `json:"time" xorm:"DATETIME"` | |||||
UpdateTime time.Time `json:"update_time" xorm:"DATETIME"` | |||||
Sum string `json:"sum" xorm:"default 0.0000 comment('总待返') DECIMAL(30,4)"` | |||||
HasReturnMoney string `json:"has_return_money" xorm:"default 0.0000 comment('已返') DECIMAL(30,4)"` | |||||
Period int `json:"period" xorm:"default 0 comment('期数') INT(11)"` | |||||
EveryMoney string `json:"every_money" xorm:"default 0.0000 comment('平均分配金额') DECIMAL(30,4)"` | |||||
HasPeriod int `json:"has_period" xorm:"default 0 comment('已返期数') INT(11)"` | |||||
Type int `json:"type" xorm:"default 0 comment('0平均分期 1手动分期') INT(1)"` | |||||
Pvd int `json:"pvd" xorm:"default 0 comment('0cps 1自营 2会员升级 3拉新') INT(11)"` | |||||
CoinId int `json:"coin_id" xorm:"default 0 INT(11)"` | |||||
Date int `json:"date" xorm:"default 0 comment('20240814') INT(11)"` | |||||
} |
@@ -0,0 +1,19 @@ | |||||
package models | |||||
import ( | |||||
"time" | |||||
) | |||||
type ServiceAwardReturnFlowRecord struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||||
Time time.Time `json:"time" xorm:"DATETIME"` | |||||
Money string `json:"money" xorm:"default 0.0000 comment('返回金额') DECIMAL(30,4)"` | |||||
FlowId int `json:"flow_id" xorm:"default 0 comment('记录id') INT(11)"` | |||||
BeforeMoney string `json:"before_money" xorm:"default 0.0000 DECIMAL(30,4)"` | |||||
AfterMoney string `json:"after_money" xorm:"DECIMAL(30,4)"` | |||||
Type int `json:"type" xorm:"default 0 comment('0平均分期 1手动分期') INT(1)"` | |||||
Pvd int `json:"pvd" xorm:"default 0 comment('0cps 1自营 2会员升级 3拉新') INT(11)"` | |||||
CoinId int `json:"coin_id" xorm:"default 0 INT(11)"` | |||||
Date int `json:"date" xorm:"default 0 comment('20240814') INT(11)"` | |||||
} |