@@ -7,7 +7,7 @@ REM 假设已经提供了文件名作为参数 | |||||
set "FileName=%~1" | set "FileName=%~1" | ||||
REM 将参数设置最终文件名 | REM 将参数设置最终文件名 | ||||
set "FinalFile=%BasePath%src\super\implement\%FileName%_db.go" | |||||
set "FinalFile=%BasePath%src\super\implement\%FileName%_implement.go" | |||||
REM 将文件名转换成大驼峰格式并设置成最终实现类名 | REM 将文件名转换成大驼峰格式并设置成最终实现类名 | ||||
for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i" | for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i" | ||||
@@ -0,0 +1,7 @@ | |||||
package dao | |||||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
type PlatformSettlementDao interface { | |||||
FindPlatformSettlementList(uuid, date, startDate, endDate string, page, limit int) (list []model.PlatformSettlement, total int64, err error) | |||||
} |
@@ -0,0 +1,37 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewPlatformSettlementDb(engine *xorm.Engine) dao.PlatformSettlementDao { | |||||
return &PlatformSettlementDb{Db: engine} | |||||
} | |||||
type PlatformSettlementDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (m PlatformSettlementDb) FindPlatformSettlementList(uuid, date, startDate, endDate string, page, limit int) (list []model.PlatformSettlement, total int64, err error) { | |||||
sess := m.Db.OrderBy("start_date desc,id desc").Limit(limit, (page-1)*limit) | |||||
if uuid != "" { | |||||
sess.And("uuid = ?", uuid) | |||||
} | |||||
if date != "" { | |||||
sess.And("state_date = ?", date) | |||||
} | |||||
if startDate != "" { | |||||
sess.And("update_at>=", startDate+" 00:00:00") | |||||
} | |||||
if endDate != "" { | |||||
sess.And("update_at<=", endDate+" 23:59:59") | |||||
} | |||||
total, err = sess.FindAndCount(&list) | |||||
if err != nil { | |||||
return nil, 0, err | |||||
} | |||||
return | |||||
} |
@@ -1,19 +0,0 @@ | |||||
package model | |||||
type MediumSettlement struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uuid int `json:"uuid" xorm:"not null default 0 comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` | |||||
MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') unique(IDX_UUID_TYPE) INT(11)"` | |||||
AppId string `json:"app_id" xorm:"not null default '' comment('小程序id') VARCHAR(255)"` | |||||
BusinessKind int `json:"business_kind" xorm:"not null default 1 comment('业务类型(1:广告合作)') TINYINT(1)"` | |||||
Kind int `json:"kind" xorm:"not null default 1 comment('结算单类型(1:日结 2:周结 3:月结 4:预付)') TINYINT(1)"` | |||||
BasicIncome int `json:"basic_income" xorm:"not null default 0 comment('基础收益(分)') INT(11)"` | |||||
OtherIncome int `json:"other_income" xorm:"not null default 0 comment('其他收益(分)') INT(11)"` | |||||
PayState int `json:"pay_state" xorm:"not null default 0 comment('结算单支付状态(0:未开始 1:待审核发票 2:发票审核中 3:发票审核拒绝 4:付款中 5:已付款)') TINYINT(1)"` | |||||
State int `json:"state" xorm:"not null default 0 comment('结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)') TINYINT(1)"` | |||||
StartDate string `json:"start_date" xorm:"not null comment('开始时间') DATE"` | |||||
EndDate string `json:"end_date" xorm:"not null comment('结束时间') DATE"` | |||||
CreateAt string `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||||
UpdateAt string `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||||
SettleFile string `json:"settle_file" xorm:"comment('结算单文件') VARCHAR(255)"` | |||||
} |
@@ -0,0 +1,18 @@ | |||||
package model | |||||
type PlatformSettlement struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uuid int `json:"uuid" xorm:"not null default 0 comment('站长id') index INT(11)"` | |||||
BusinessKind int `json:"business_kind" xorm:"not null default 1 comment('业务类型(1:广告合作)') TINYINT(1)"` | |||||
Kind int `json:"kind" xorm:"not null default 1 comment('结算单类型(1:日结 2:周结 3:月结 4:预付)') TINYINT(1)"` | |||||
OriginalIncome int `json:"original_income" xorm:"default 0 comment('上游结算(原始数据值-分)') INT(11)"` | |||||
MediumIncome int `json:"medium_income" xorm:"not null default 0 comment('媒体收益(分)') INT(11)"` | |||||
AgentIncome int `json:"agent_income" xorm:"not null default 0 comment('代理收益(分)') INT(11)"` | |||||
PlatformRetention int `json:"platform_retention" xorm:"not null default 0 comment('平台留存(分)') INT(11)"` | |||||
PriceAdjustmentRetention int `json:"price_adjustment_retention" xorm:"not null default 0 comment('调价留存(分)') INT(11)"` | |||||
CommissionRetention int `json:"commission_retention" xorm:"not null default 0 comment('佣金留存(分)') INT(11)"` | |||||
StartDate string `json:"start_date" xorm:"not null comment('开始时间') DATE"` | |||||
EndDate string `json:"end_date" xorm:"not null comment('结束时间') DATE"` | |||||
CreateAt string `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||||
UpdateAt string `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||||
} |