From d83f5863d6c675d6aed09cfe7bfdaadc0c6221d9 Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期五, 05 七月 2019 18:32:05 +0800 Subject: [PATCH] fix enable and add update dbtable enable value --- models/vssLocalSettingTbl.go | 61 ++++++------------------------ 1 files changed, 13 insertions(+), 48 deletions(-) diff --git a/models/vssLocalSettingTbl.go b/models/vssLocalSettingTbl.go index 57456b8..1e44700 100644 --- a/models/vssLocalSettingTbl.go +++ b/models/vssLocalSettingTbl.go @@ -1,50 +1,15 @@ package models -import ( - "time" -) - -type VSSLocalSettingTbl struct { - ID int `json:"ID,omitempty" gorm:"primary_key" ` - ServerIp string `json:"ServerIp,omitempty" example:"SIP鏈嶅姟鍣↖P" gorm:"column:ServerIp"` - ServerPort int `json:"ServerPort,omitempty" example:"21231" gorm:"column:ServerPort"` - ServerId string `json:"ServerId,omitempty" example:"SIP鏈嶅姟鍣↖d" gorm:"column:ServerId"` - UserAuthId string `json:"UserAuthId,omitempty" example:"SIP鐢ㄦ埛璁よ瘉ID" gorm:"column:UserAuthId"` - Password string `json:"Password,omitempty" example:"瀵嗙爜" gorm:"column:Password"` - UpdateTime time.Time `json:"-" gorm:"column:UpdateTime"` -} - -func (VSSLocalSettingTbl)TableName() string { - return "VSSLocalSettingTbl" -} - - -func (vst *VSSLocalSettingTbl) Select() (err error) { - if err = db.Table("VSSLocalSettingTbl").First(&vst).Error; err != nil { - if err.Error() == "record not found"{ vst = nil; return nil } - return err - } - return nil -} - -/*func (vst *VSSLocalSettingTbl) Insert() (err error) { - tx := db.Table("VSSLocalSettingTbl").Begin() - if tx.Error != nil { - return err - } - fmt.Println(vst) - if err := tx.Create(&vst).Error; err != nil { - tx.Rollback() - return err - } - return tx.Commit().Error -}*/ - -func (vst *VSSLocalSettingTbl) Update() error { // cid int - // find record by id - vst.UpdateTime = time.Now() - if err := db.Save(&vst).Error; err != nil { - return err - } - return nil -} +//import ( +// "time" +//) +// +//type VSSLocalSettingTbl struct { +// ID int `json:"ID,omitempty" gorm:"primary_key" ` +// ServerIp string `json:"ServerIp,omitempty" example:"SIP鏈嶅姟鍣↖P" gorm:"column:ServerIp"` +// ServerPort int `json:"ServerPort,omitempty" example:"21231" gorm:"column:ServerPort"` +// ServerId string `json:"ServerId,omitempty" example:"SIP鏈嶅姟鍣↖d" gorm:"column:ServerId"` +// UserAuthId string `json:"UserAuthId,omitempty" example:"SIP鐢ㄦ埛璁よ瘉ID" gorm:"column:UserAuthId"` +// Password string `json:"Password,omitempty" example:"瀵嗙爜" gorm:"column:Password"` +// UpdateTime time.Time `json:"-" gorm:"column:UpdateTime"` +//} \ No newline at end of file -- Gitblit v1.8.0