Files
jx-callback/business/jxstore/financial/bill.go
2020-10-22 15:10:06 +08:00

41 lines
1.4 KiB
Go

package financial
import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
)
func AddBillIncome(db *dao.DaoDB, billID int64, billType, incomePrice int) (err error) {
billIncome := &model.BillIncome{
BillID: billID,
Type: billType,
IncomePrice: incomePrice,
}
dao.WrapAddIDCULEntity(billIncome, jxcontext.AdminCtx.GetUserName())
return dao.CreateEntity(db, billIncome)
}
func AddBillExpend(db *dao.DaoDB, billID int64, billType, expendPrice int) (err error) {
billExpend := &model.BillExpend{
BillID: billID,
Type: billType,
ExpendPrice: expendPrice,
}
dao.WrapAddIDCULEntity(billExpend, jxcontext.AdminCtx.GetUserName())
return dao.CreateEntity(db, billExpend)
}
func AddUserBill(db *dao.DaoDB, billID int64, userID string) (err error) {
userBillInsert := &model.UserBill{
BillID: billID,
UserID: userID,
}
dao.WrapAddIDCULDEntity(userBillInsert, jxcontext.AdminCtx.GetUserName())
return dao.CreateEntity(db, userBillInsert)
}
func GetUserBillDetail(ctx *jxcontext.Context, userID, fromTime, toTime string, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
return dao.GetUserBillDetail(dao.GetDB(), userID, utils.Str2Time(fromTime), utils.Str2Time(toTime), pageSize, offset)
}