Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

master
huangjiajun vor 2 Tagen
Ursprung
Commit
5eeb26f6c2
5 geänderte Dateien mit 53 neuen und 16 gelöschten Zeilen
  1. +2
    -2
      src/dao/advertising_callback_dao.go
  2. +3
    -1
      src/dao/egg_energy_team_assistance_dao.go
  3. +14
    -4
      src/implement/advertising_callback_implement.go
  4. +26
    -2
      src/implement/egg_energy_team_assistance_implement.go
  5. +8
    -7
      src/model/egg_energy_team_assistance.go

+ 2
- 2
src/dao/advertising_callback_dao.go Datei anzeigen

@@ -2,10 +2,10 @@ package dao

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

type AdvertisingCallbackDao interface {
FindAdvertisingCallbackAndTotal(page, limit, amount, uid, startTime, endTime, platform, types string) (*[]model.AdvertisingCallback, int64, error)
AdvertisingCallbackCountBySession(session *xorm.Session, uid, startTime, endTime, types string) (int64, error)
AdvertisingCallbackCount(uid, startTime, endTime, typePrefix string) (int64, error)
AdvertisingCallbackDeleteByDateByPage(date string, limit int) (int64, error)
}

+ 3
- 1
src/dao/egg_energy_team_assistance_dao.go Datei anzeigen

@@ -9,5 +9,7 @@ type EggEnergyTeamAssistanceDao interface {
EggEnergyTeamAssistanceInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error)
EggEnergyTeamAssistanceUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error)
EggEnergyTeamAssistanceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceInsert(EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error)
EggEnergyTeamAssistanceUpdate(id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error)
}

+ 14
- 4
src/implement/advertising_callback_implement.go Datei anzeigen

@@ -5,6 +5,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"xorm.io/xorm"
)

@@ -45,13 +46,14 @@ func (a AdvertisingCallbackDb) FindAdvertisingCallbackAndTotal(page, limit, amou
return &m, count, nil
}

func (a AdvertisingCallbackDb) AdvertisingCallbackCountBySession(session *xorm.Session, uid, startTime, endTime, types string) (int64, error) {
sess := session.Where("1=1")
func (a AdvertisingCallbackDb) AdvertisingCallbackCount(uid, startTime, endTime, typePrefix string) (int64, error) {
sess := a.Db.Where("1=1")
if uid != "" {
sess.And("uid=?", uid)
}
if types != "" {
sess.And("type=?", types)
if typePrefix != "" {
types := fmt.Sprintf("type LIKE '%s'", typePrefix+"%")
sess.And(types)
}
if startTime != "" {
sess.And("create_at>=?", startTime)
@@ -65,3 +67,11 @@ func (a AdvertisingCallbackDb) AdvertisingCallbackCountBySession(session *xorm.S
}
return count, nil
}

func (a AdvertisingCallbackDb) AdvertisingCallbackDeleteByDateByPage(date string, limit int) (int64, error) {
affected, err := a.Db.Where("create_at < ?", date).Limit(limit).Delete(&model.AdvertisingCallback{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

+ 26
- 2
src/implement/egg_energy_team_assistance_implement.go Datei anzeigen

@@ -53,9 +53,9 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParamsBySessio
return &m, nil
}

func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error) {
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error) {
var m model.EggEnergyTeamAssistance
has, err := session.Where("uid = ?", uid).And("date = ?", date).Get(&m)
has, err := e.Db.Where("uid = ?", uid).And("date = ?", date).Get(&m)
if err != nil {
return nil, err
}
@@ -64,3 +64,27 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(sessio
}
return &m, nil
}

func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceInsert(EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) {
_, err := e.Db.InsertOne(EggEnergyTeamAssistance)
if err != nil {
return 0, err
}
return EggEnergyTeamAssistance.Id, nil
}

func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceUpdate(id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(EggEnergyTeamAssistance)
} else {
affected, err = e.Db.Where("id=?", id).Update(EggEnergyTeamAssistance)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 8
- 7
src/model/egg_energy_team_assistance.go Datei anzeigen

@@ -1,11 +1,12 @@
package model

type EggEnergyTeamAssistance struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户 ID') BIGINT(20)"`
AssistedNum int `json:"assisted_num" xorm:"not null default 0 comment('助力人数') INT(11)"`
RewardScore string `json:"reward_score" xorm:"not null default 0.00000000 comment('奖励积分数量') DECIMAL(20,8)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户 ID') BIGINT(20)"`
AssistedNum int `json:"assisted_num" xorm:"not null default 0 comment('助力人数') INT(11)"`
AssistedTimes int `json:"assisted_times" xorm:"not null default 0 comment('助力次数') INT(11)"`
RewardScore string `json:"reward_score" xorm:"not null default 0.00000000 comment('奖励积分数量') DECIMAL(20,8)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Laden…
Abbrechen
Speichern