shenjiachi před 1 dnem
rodič
revize
60ec86c6e2
3 změnil soubory, kde provedl 52 přidání a 0 odebrání
  1. +9
    -0
      src/dao/egg_energy_assistance_detail_dao.go
  2. +33
    -0
      src/implement/egg_energy_assistance_detail_implement.go
  3. +10
    -0
      src/model/egg_energy_assistance_detail.go

+ 9
- 0
src/dao/egg_energy_assistance_detail_dao.go Zobrazit soubor

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

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

type EggEnergyAssistanceDetailDao interface {
//TODO:: You can add specific method definitions here
AssistanceDetailInsert(m *model.EggEnergyAssistanceDetail) (int64, error)
AssistanceDetailExist(uid, assistedUid, signId int64) (bool, error)
}

+ 33
- 0
src/implement/egg_energy_assistance_detail_implement.go Zobrazit soubor

@@ -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"
"xorm.io/xorm"
)

func NewEggEnergyAssistanceDetailDb(engine *xorm.Engine) dao.EggEnergyAssistanceDetailDao {
return &EggEnergyAssistanceDetailDb{Db: engine}
}

type EggEnergyAssistanceDetailDb struct {
Db *xorm.Engine
}

func (e EggEnergyAssistanceDetailDb) AssistanceDetailInsert(m *model.EggEnergyAssistanceDetail) (int64, error) {
_, err := e.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (e EggEnergyAssistanceDetailDb) AssistanceDetailExist(uid, assistedUid, signId int64) (bool, error) {
exist, err := e.Db.Where("uid = ?", uid).
And("assisted_uid = ?", assistedUid).
And("sign_id = ?", signId).Exist(&model.EggEnergyAssistanceDetail{})
if err != nil {
return false, err
}
return exist, nil
}

+ 10
- 0
src/model/egg_energy_assistance_detail.go Zobrazit soubor

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

type EggEnergyAssistanceDetail struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null comment('用户id') BIGINT(20)"`
AssistedUid int64 `json:"assisted_uid" xorm:"not null comment('助力用户id') BIGINT(20)"`
SignId int64 `json:"sign_id" xorm:"not null comment('签到id') BIGINT(20)"`
CreatedAt string `json:"created_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdatedAt string `json:"updated_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

Načítá se…
Zrušit
Uložit