|
@@ -36,7 +36,7 @@ func (e EggSignInDb) EggSignInFindByParams(params map[string]interface{}) ([]*mo |
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
//指定In查询 |
|
|
//指定In查询 |
|
|
if err := e.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(m); err != nil { |
|
|
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) |
|
|
|
|
|
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
@@ -47,3 +47,43 @@ func (e EggSignInDb) EggSignInFindByParams(params map[string]interface{}) ([]*mo |
|
|
} |
|
|
} |
|
|
return m, nil |
|
|
return m, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (e EggSignInDb) EggSignINGetOneByTimeAndUid(startAt, endAt string, uid int64, isCompleted int) (bool, *model.EggSignIn, error) { |
|
|
|
|
|
var eggSignIn model.EggSignIn |
|
|
|
|
|
session := e.Db.Where("uid = ?", uid).And("is_completed = ?", isCompleted) |
|
|
|
|
|
if startAt != "" { |
|
|
|
|
|
session = session.And("start_time > ?", startAt) |
|
|
|
|
|
} |
|
|
|
|
|
if endAt != "" { |
|
|
|
|
|
session = session.And("end_time < ?", endAt) |
|
|
|
|
|
} |
|
|
|
|
|
has, err := session.Get(&eggSignIn) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return false, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return has, &eggSignIn, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (e EggSignInDb) EggSignInFindByTimeAndParams(startAt, endAt string, isCompleted int, params map[string]interface{}) ([]*model.EggSignIn, error) { |
|
|
|
|
|
var m []*model.EggSignIn |
|
|
|
|
|
session := e.Db.Where("is_completed > ?", isCompleted) |
|
|
|
|
|
if startAt != "" { |
|
|
|
|
|
session = session.And("start_time > ?", startAt) |
|
|
|
|
|
} |
|
|
|
|
|
if endAt != "" { |
|
|
|
|
|
session = session.And("end_time < ?", endAt) |
|
|
|
|
|
} |
|
|
|
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
|
|
|
//指定In查询 |
|
|
|
|
|
session = session.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]) |
|
|
|
|
|
} else { |
|
|
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
|
|
session = session.Where(query, params["value"]) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err := session.Find(m) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
|
|
} |
|
|
|
|
|
return m, nil |
|
|
|
|
|
} |