Browse Source

update

master
dengbiao 11 hours ago
parent
commit
23e95356c2
4 changed files with 40 additions and 3 deletions
  1. +6
    -2
      src/dao/egg_sign_in_dao.go
  2. +31
    -0
      src/implement/egg_sign_in_implement.go
  3. +1
    -1
      src/model/egg_energy_user_activity.go
  4. +2
    -0
      src/model/egg_sign_in.go

+ 6
- 2
src/dao/egg_sign_in_dao.go View File

@@ -1,12 +1,16 @@
package dao

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

type EggSignInDao interface {
//TODO:: You can add specific method definitions here
EggSignInGet(id int64) (*model.EggSignIn, error)
EggSignInGetOne(startAt, endAt string, uid int64) (bool, *model.EggSignIn, error)
EggSignInFindByParams(params map[string]interface{}) ([]*model.EggSignIn, error)
EggSignINGetOneByTimeAndUid(startAt, endAt string, uid int64, isCompleted int) (bool, *model.EggSignIn, error)
EggSignInFindByTimeAndParams(startAt, endAt string, isCompleted int, params map[string]interface{}) ([]*model.EggSignIn, error)
EggSignInInsert(m *model.EggSignIn) (int64, error)
EggSignInUpdateBySession(session *xorm.Session, id interface{}, eggSignIn *model.EggSignIn, forceColums ...string) (int64, error)
}

+ 31
- 0
src/implement/egg_sign_in_implement.go View File

@@ -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"
"errors"
"fmt"
"reflect"
"xorm.io/xorm"
@@ -18,6 +19,36 @@ type EggSignInDb struct {
Db *xorm.Engine
}

func (e EggSignInDb) EggSignInUpdateBySession(session *xorm.Session, id interface{}, eggSignIn *model.EggSignIn, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = session.Where("id=?", id).MustCols(forceColums...).Update(eggSignIn)
} else {
affected, err = session.Where("id=?", id).Update(eggSignIn)
}
if err != nil {
return 0, err
}
//
return affected, nil
}

func (e EggSignInDb) EggSignInGet(id int64) (*model.EggSignIn, error) {
var eggSignIn model.EggSignIn
has, err := e.Db.ID(id).
Get(&eggSignIn)
if err != nil {
return nil, err
}
if !has {
return nil, errors.New("未查询到签到记录")
}
return &eggSignIn, nil
}

func (e EggSignInDb) EggSignInGetOne(startAt, endAt string, uid int64) (bool, *model.EggSignIn, error) {
var eggSignIn model.EggSignIn
has, err := e.Db.Where("start_time > ?", startAt).


+ 1
- 1
src/model/egg_energy_user_activity.go View File

@@ -2,6 +2,6 @@ package model

type EggEnergyUserActivity struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') index(idx_uid_date) INT(11)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') index(idx_uid_date) INT(11)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') index(idx_uid_date) CHAR(50)"`
}

+ 2
- 0
src/model/egg_sign_in.go View File

@@ -9,5 +9,7 @@ type EggSignIn struct {
TotalTeamEggPoints string `json:"total_team_egg_points" xorm:"not null comment('团队蛋蛋积分值') DECIMAL(28,8)"`
EstimatePerSecondPersonEggEnergyValue string `json:"estimate_per_second_person_egg_energy_value" xorm:"not null comment('预估每秒奖励蛋蛋能量值-个人') DECIMAL(28,8)"`
EstimatePerSecondTeamEggEnergyValue string `json:"estimate_per_second_team_egg_energy_value" xorm:"not null comment('预估每秒奖励蛋蛋能量值-团队') DECIMAL(28,8)"`
TotalPersonEggPointsAmountValue string `json:"total_person_egg_points_amount_value" xorm:"not null comment('个人蛋蛋积分值-金额价值') DECIMAL(28,8)"`
TotalTeamEggPointsAmountValue string `json:"total_team_egg_points_amount_value" xorm:"not null comment('团队蛋蛋积分值-金额价值') DECIMAL(28,8)"`
IsCompleted int `json:"is_completed" xorm:"not null default 0 comment('是否完成(0:未完成 1:已完成)') TINYINT(1)"`
}

Loading…
Cancel
Save