|
|
@@ -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). |
|
|
|