Kaynağa Gözat

add home page

master
shenjiachi 1 gün önce
ebeveyn
işleme
85252096dc
7 değiştirilmiş dosya ile 66 ekleme ve 5 silme
  1. +1
    -0
      src/dao/egg_energy_price_dao.go
  2. +4
    -0
      src/dao/egg_sign_in_dao.go
  3. +1
    -0
      src/dao/user_dao.go
  4. +9
    -0
      src/implement/egg_energy_price_implement.go
  5. +35
    -0
      src/implement/egg_sign_in_implement.go
  6. +8
    -0
      src/implement/user_implement.go
  7. +8
    -5
      src/model/egg_sign_in.go

+ 1
- 0
src/dao/egg_energy_price_dao.go Dosyayı Görüntüle

@@ -7,4 +7,5 @@ type EggEnergyPriceDao interface {
EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, bool, error)
EggEnergyPriceInsert(eggEnergyPrice *model.EggEnergyPrice) (int64, error)
EggEnergyPriceUpdate(eggEnergyPrice *model.EggEnergyPrice) (int64, error)
EggEnergyPriceGetOneByParams(Date string, Hour int) (*model.EggEnergyPrice, error)
}

+ 4
- 0
src/dao/egg_sign_in_dao.go Dosyayı Görüntüle

@@ -1,5 +1,9 @@
package dao

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

type EggSignInDao interface {
//TODO:: You can add specific method definitions here
EggSignInGetOne(startAt, endAt string, uid int64) (bool, *model.EggSignIn, error)
EggSignInFindByParams(params map[string]interface{}) ([]*model.EggSignIn, error)
}

+ 1
- 0
src/dao/user_dao.go Dosyayı Görüntüle

@@ -17,4 +17,5 @@ type UserDao interface {
UserInsert(m *model.User) (int64, error)
UpdateUser(m *model.User, columns ...string) (int64, error)
GetUser(id int64) (m *model.User, err error)
UserCount() (int64, error)
}

+ 9
- 0
src/implement/egg_energy_price_implement.go Dosyayı Görüntüle

@@ -53,3 +53,12 @@ func (e EggEnergyPriceDb) EggEnergyPriceUpdate(eggEnergyPrice *model.EggEnergyPr
}
return affected, nil
}

func (e EggEnergyPriceDb) EggEnergyPriceGetOneByParams(Date string, Hour int) (*model.EggEnergyPrice, error) {
var m model.EggEnergyPrice
_, err := e.Db.Where("date = ?", Date).And("hour = ?", Hour).Get(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err.Error())
}
return &m, nil
}

+ 35
- 0
src/implement/egg_sign_in_implement.go Dosyayı Görüntüle

@@ -2,6 +2,11 @@

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"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"
"reflect"
"xorm.io/xorm"
)

@@ -12,3 +17,33 @@ func NewEggSignInDb(engine *xorm.Engine) dao.EggSignInDao {
type EggSignInDb struct {
Db *xorm.Engine
}

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).
And("end_time < ?", endAt).
And("uid = ?", uid).
And("is_completed = 0").
Get(&eggSignIn)
if err != nil {
return false, nil, err
}
return has, &eggSignIn, nil
}

func (e EggSignInDb) EggSignInFindByParams(params map[string]interface{}) ([]*model.EggSignIn, error) {
var m []*model.EggSignIn
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice {
//指定In查询
if err := e.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(m); err != nil {
return nil, zhios_order_relate_logx.Warn(err)
}
} else {
var query = fmt.Sprintf("%s =?", params["key"])
err := e.Db.Where(query, params["value"]).Find(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
}
return m, nil
}

+ 8
- 0
src/implement/user_implement.go Dosyayı Görüntüle

@@ -149,3 +149,11 @@ func (u UserDb) UserFindAndCount(uid int64, phone string, nickname string, level
}
return &m, total, nil
}

func (u UserDb) UserCount() (int64, error) {
count, err := u.Db.Count(&model.User{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err)
}
return count, nil
}

+ 8
- 5
src/model/egg_sign_in.go Dosyayı Görüntüle

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

type EggSignIn struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
StartTime string `json:"start_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到开始时间') DATETIME"`
EndTime string `json:"end_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到结束时间') DATETIME"`
IsCompleted int `json:"is_completed" xorm:"not null default 0 comment('是否完成(0:未完成 1:已完成)') TINYINT(1)"`
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') BIGINT(20)"`
StartTime string `json:"start_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到开始时间') DATETIME"`
EndTime string `json:"end_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('签到结束时间') DATETIME"`
TotalPersonEggPoints string `json:"total_person_egg_points" xorm:"not null comment('个人蛋蛋积分值') DECIMAL(28,8)"`
TotalTeamEggPoints string `json:"total_team_egg_points" xorm:"not null comment('团队蛋蛋积分值') DECIMAL(28,8)"`
EstimatePerSecondEggEnergyValue string `json:"estimate_per_second_egg_energy_value" xorm:"not null comment('预估每秒奖励蛋蛋能量值') DECIMAL(28,8)"`
IsCompleted int `json:"is_completed" xorm:"not null default 0 comment('是否完成(0:未完成 1:已完成)') TINYINT(1)"`
}

Yükleniyor…
İptal
Kaydet