Explorar el Código

Merge remote-tracking branch 'origin/master'

master
huangjiajun hace 2 días
padre
commit
cc669feddd
Se han modificado 3 ficheros con 51 adiciones y 0 borrados
  1. +8
    -0
      src/dao/egg_energy_recruit_new_user_reward_dao.go
  2. +33
    -0
      src/implement/egg_energy_recruit_new_user_reward_implement.go
  3. +10
    -0
      src/model/egg_energy_recruit_new_user_reward.go

+ 8
- 0
src/dao/egg_energy_recruit_new_user_reward_dao.go Ver fichero

@@ -0,0 +1,8 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyRecruitNewUserRewardDao interface {
EggEnergyRecruitNewUserRewardGet(uid int64) (*model.EggEnergyRecruitNewUserReward, bool, error)
EggEnergyRecruitNewUserRewardInsert(eggEnergyRecruitNewUserReward *model.EggEnergyRecruitNewUserReward) (int64, error)
}

+ 33
- 0
src/implement/egg_energy_recruit_new_user_reward_implement.go Ver fichero

@@ -0,0 +1,33 @@
package implement

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

func NewEggEnergyRecruitNewUserRewardDb(engine *xorm.Engine) dao.EggEnergyRecruitNewUserRewardDao {
return &EggEnergyRecruitNewUserRewardDb{Db: engine}
}

type EggEnergyRecruitNewUserRewardDb struct {
Db *xorm.Engine
}

func (e EggEnergyRecruitNewUserRewardDb) EggEnergyRecruitNewUserRewardGet(uid int64) (*model.EggEnergyRecruitNewUserReward, bool, error) {
var m model.EggEnergyRecruitNewUserReward
exist, err := e.Db.Where("uid =?", uid).Get(&m)
if err != nil {
return nil, false, zhios_order_relate_logx.Error(err.Error())
}
return &m, exist, nil
}

func (e EggEnergyRecruitNewUserRewardDb) EggEnergyRecruitNewUserRewardInsert(eggEnergyRecruitNewUserReward *model.EggEnergyRecruitNewUserReward) (int64, error) {
_, err := e.Db.InsertOne(eggEnergyRecruitNewUserReward)
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return eggEnergyRecruitNewUserReward.Id, nil
}

+ 10
- 0
src/model/egg_energy_recruit_new_user_reward.go Ver fichero

@@ -0,0 +1,10 @@
package model

type EggEnergyRecruitNewUserReward struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"`
RecommendUid int64 `json:"recommend_uid" xorm:"not null default 0 comment('推荐人id') BIGINT(20)"`
Value string `json:"value" xorm:"not null default 0.00000000 comment('奖励值') DECIMAL(20,8)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Cargando…
Cancelar
Guardar