Simplify all the context link.

This commit is contained in:
zicla
2018-11-29 17:41:18 +08:00
parent 0d918fbb69
commit cb96b18579
24 changed files with 124 additions and 126 deletions

View File

@ -15,7 +15,7 @@ func (this *PreferenceDao) Fetch() *Preference {
// Read
var preference = &Preference{}
db := this.context.DB.First(preference)
db := CONTEXT.DB.First(preference)
if db.Error != nil {
if db.Error.Error() == "record not found" {
@ -39,7 +39,7 @@ func (this *PreferenceDao) Create(preference *Preference) *Preference {
preference.Uuid = string(timeUUID.String())
preference.CreateTime = time.Now()
preference.UpdateTime = time.Now()
db := this.context.DB.Create(preference)
db := CONTEXT.DB.Create(preference)
this.PanicError(db.Error)
return preference
@ -49,7 +49,7 @@ func (this *PreferenceDao) Create(preference *Preference) *Preference {
func (this *PreferenceDao) Save(preference *Preference) *Preference {
preference.UpdateTime = time.Now()
db := this.context.DB.Save(preference)
db := CONTEXT.DB.Save(preference)
this.PanicError(db.Error)
return preference