Ver código fonte

update

master
shenjiachi 6 dias atrás
pai
commit
d583849c70
7 arquivos alterados com 38 adições e 14 exclusões
  1. +1
    -0
      src/dao/user_dao.go
  2. +2
    -2
      src/dao/user_level_dao.go
  3. +6
    -2
      src/dao/user_level_task_dao.go
  4. +2
    -2
      src/implement/egg_sign_in_implement.go
  5. +10
    -0
      src/implement/user_implement.go
  6. +5
    -5
      src/implement/user_level_implement.go
  7. +12
    -3
      src/implement/user_level_task_implement.go

+ 1
- 0
src/dao/user_dao.go Ver arquivo

@@ -19,4 +19,5 @@ type UserDao interface {
GetUser(id int64) (m *model.User, err error)
UserCount() (int64, error)
UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error)
UserExistByParams(params map[string]interface{}) (bool, error)
}

+ 2
- 2
src/dao/user_level_dao.go Ver arquivo

@@ -14,7 +14,7 @@ type UserLevelDao interface {
UserLevelAllByAsc() ([]*model.UserLevel, error)
// UserLevelAllByAscByPage 获取所有开启等级升序分页返回
UserLevelAllByAscByPage(page, limit int) ([]*model.UserLevel, int64, error)
UserLevelUpdate(id interface{}, level *model.UserLevel, forceColumns ...string) (int64, error)
UserLevelUpdateBySession(session *xorm.Session, id interface{}, level *model.UserLevel, forceColumns ...string) (int64, error)
UserLevelDeleteBySession(session *xorm.Session, id interface{}) (int64, error)
UserLevelInsert(userLevel *model.UserLevel) (int, error)
UserLevelInsertBySession(session *xorm.Session, userLevel *model.UserLevel) (int, error)
}

+ 6
- 2
src/dao/user_level_task_dao.go Ver arquivo

@@ -1,11 +1,15 @@
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 UserLevelTaskDao interface {
//TODO:: You can add specific method definitions here
UserLevelTaskFindByParams(params map[string]interface{}) ([]model.UserLevelTask, error)
UserLevelTaskInsert(userLevelTask *model.UserLevelTask) (int, error)
UserLevelTaskUpdate(userLevelTask *model.UserLevelTask, forceColumns ...string) (int64, error)
UserLevelTaskDelete(id interface{}) (int64, error)
UserLevelTaskDeleteByParamsBySession(session *xorm.Session, params map[string]interface{}) (int64, error)
UserLevelTaskBatchInsertBySession(session *xorm.Session, UserLevelTasks []model.UserLevelTask) (int64, error)
}

+ 2
- 2
src/implement/egg_sign_in_implement.go Ver arquivo

@@ -83,10 +83,10 @@ func (e EggSignInDb) EggSignINGetOneByTimeAndUid(startAt, endAt string, uid int6
var eggSignIn model.EggSignIn
session := e.Db.Where("uid = ?", uid).And("is_completed = ?", isCompleted)
if startAt != "" {
session = session.And("start_time > ?", startAt)
session = session.And("start_time < ?", startAt)
}
if endAt != "" {
session = session.And("end_time < ?", endAt)
session = session.And("end_time > ?", endAt)
}
has, err := session.Get(&eggSignIn)
if err != nil {


+ 10
- 0
src/implement/user_implement.go Ver arquivo

@@ -176,3 +176,13 @@ func (u UserDb) UserFindNotInByParamsByPage(page int, limit int, params map[stri
}
return m, total, nil
}

func (u UserDb) UserExistByParams(params map[string]interface{}) (bool, error) {
var m model.User
var query = fmt.Sprintf("%s = ?", params["key"])
has, err := u.Db.Where(query, params["value"]).Exist(&m)
if err != nil {
return has, zhios_order_relate_logx.Error(err)
}
return has, nil
}

+ 5
- 5
src/implement/user_level_implement.go Ver arquivo

@@ -59,15 +59,15 @@ func (u UserLevelDb) UserLevelAllByAscByPage(page, limit int) ([]*model.UserLeve
return m, total, nil
}

func (u UserLevelDb) UserLevelUpdate(id interface{}, userLevel *model.UserLevel, forceColumns ...string) (int64, error) {
func (u UserLevelDb) UserLevelUpdateBySession(session *xorm.Session, id interface{}, userLevel *model.UserLevel, forceColumns ...string) (int64, error) {
var (
affected int64
err error
)
if forceColumns != nil {
affected, err = u.Db.Where("id=?", id).MustCols(forceColumns...).Update(userLevel)
affected, err = session.Where("id=?", id).MustCols(forceColumns...).Update(userLevel)
} else {
affected, err = u.Db.Where("id=?", id).Update(userLevel)
affected, err = session.Where("id=?", id).Update(userLevel)
}
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
@@ -83,8 +83,8 @@ func (u UserLevelDb) UserLevelDeleteBySession(session *xorm.Session, id interfac
return affected, nil
}

func (u UserLevelDb) UserLevelInsert(userLevel *model.UserLevel) (int, error) {
_, err := u.Db.InsertOne(userLevel)
func (u UserLevelDb) UserLevelInsertBySession(session *xorm.Session, userLevel *model.UserLevel) (int, error) {
_, err := session.Insert(userLevel)
if err != nil {
return 0, zhios_order_relate_logx.Error(err)
}


+ 12
- 3
src/implement/user_level_task_implement.go Ver arquivo

@@ -49,10 +49,19 @@ func (u UserLevelTaskDb) UserLevelTaskUpdate(userLevelTask *model.UserLevelTask,
return affected, nil
}

func (u UserLevelTaskDb) UserLevelTaskDelete(id interface{}) (int64, error) {
affected, err := u.Db.Where("id = ?", id).Delete(&model.UserLevelTask{})
func (u UserLevelTaskDb) UserLevelTaskDeleteByParamsBySession(session *xorm.Session, params map[string]interface{}) (int64, error) {
var query = fmt.Sprintf("%s = ?", params["key"])
affected, err := session.Where(query, params["value"]).Delete(&model.UserLevelTask{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

func (u UserLevelTaskDb) UserLevelTaskBatchInsertBySession(session *xorm.Session, UserLevelTasks []model.UserLevelTask) (int64, error) {
affected, err := session.Insert(UserLevelTasks)
if err != nil {
return 0, err
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

Carregando…
Cancelar
Salvar