You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.3 KiB
77 lines
3.3 KiB
package user
|
|
|
|
//
|
|
//const (
|
|
// RecookUserTeamIncomeIsSettlementFalse = 0 // 未结算
|
|
// RecookUserTeamIncomeIsSettlementTrue = 1 // 已结算
|
|
//)
|
|
//
|
|
////type RecookUserTeamIncomeModel struct {
|
|
//// db.BaseModel
|
|
//// Id uint `gorm:"column:id;primary_key" json:"id"`
|
|
//// UserId uint `json:"userId"`
|
|
//// Date int `json:"date"`
|
|
//// Amount decimal.Decimal `json:"amount"`
|
|
//// OrderCount int `json:"orderCount"`
|
|
//// PurchaseAmount decimal.Decimal `json:"purchase_amount"`
|
|
//// GuideAmount decimal.Decimal `json:"guide_amount"`
|
|
//// IsSettlement int `json:"isSettlement"`
|
|
//// TeamAmount decimal.Decimal `json:"teamAmount"`
|
|
//// RecommendAmount decimal.Decimal `json:"recommendAmount"`
|
|
//// RewardAmount decimal.Decimal `json:"rewardAmount"`
|
|
//// TeamSalesVolume decimal.Decimal `json:"teamSalesVolume"`
|
|
//// RecommendSalesVolume decimal.Decimal `json:"recommendSalesVolume"`
|
|
//// RewardSalesVolume decimal.Decimal `json:"rewardSalesVolume"`
|
|
//// RoleId uint `json:"roleId"`
|
|
//// TeamCount decimal.Decimal `json:"teamCount"`
|
|
//// RecommendCount decimal.Decimal `json:"recommendCount"`
|
|
//// RewardCount decimal.Decimal `json:"rewardCount"`
|
|
////}
|
|
//
|
|
//// TableName sets the insert table name for this struct type
|
|
//func (r *RecookUserTeamIncomeModel) TableName() string {
|
|
// return "recook_user_team_income"
|
|
//}
|
|
//
|
|
//// @Style 查询单条信息
|
|
//func (r *RecookUserTeamIncomeModel) FindByUserIdAndDate(userId uint, date int) (info RecookUserTeamIncomeModel) {
|
|
// r.GetDb().First(&info, "user_id = ? and date = ?", userId, date)
|
|
// return
|
|
//}
|
|
//
|
|
//// @Style 添加
|
|
//func (r *RecookUserTeamIncomeModel) Create(data *RecookUserTeamIncomeModel) {
|
|
// r.GetDb().Create(data)
|
|
//}
|
|
//
|
|
//// @Style 添加
|
|
//func (r *RecookUserTeamIncomeModel) CreateSubQuery(fields string, sql *gorm.SqlExpr) error {
|
|
// return r.GetDb().Exec("insert into recook_user_team_income("+fields+") ?", sql).Error
|
|
//}
|
|
//
|
|
//// @Style 编辑
|
|
//func (r *RecookUserTeamIncomeModel) Updates(value interface{}, query interface{}, args ...interface{}) error {
|
|
// return r.GetDb().Model(&RecookUserTeamIncomeModel{}).Where(query, args...).Updates(value).Error
|
|
//}
|
|
//
|
|
//// @Style 根据userId 和 date获取数据
|
|
//func (r *RecookUserTeamIncomeModel) FindByUserIdYear(userId uint, year int) (result []RecookUserTeamIncomeModel) {
|
|
// r.GetDb().Model(&RecookUserTeamIncomeModel{}).Order("id desc").Find(&result, "user_id = ? and date between ? and ?", userId, year*100, year*100+12)
|
|
// return
|
|
//}
|
|
//
|
|
//// @Style 获取列表
|
|
//func (r *RecookUserTeamIncomeModel) GetLists(start, limit int, query interface{}, args ...interface{}) (result []RecookUserTeamIncomeModel) {
|
|
// r.GetDb().Model(&RecookUserTeamIncomeModel{}).Where(query, args...).Offset(start).Limit(limit).Find(&result)
|
|
// return
|
|
//}
|
|
//
|
|
//// @Style 统计团队总销售额
|
|
//func (r *RecookUserTeamIncomeModel) GetTeamAmoutSum(query interface{}, args ...interface{}) (result RecookUserTeamIncomeModel) {
|
|
// r.GetDb().Model(RecookUserTeamIncomeModel{}).
|
|
// Select("sum(amount) as amount,sum(order_count) as order_count").
|
|
// Where(query, args...).
|
|
// First(&result)
|
|
// return
|
|
//}
|