Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1571b5d993
1 changed files with 24 additions and 14 deletions
|
@ -136,13 +136,18 @@ func removeLocalStorageVal(c *gin.Context) {
|
|||
}
|
||||
|
||||
key := arg["key"].(string)
|
||||
|
||||
err := model.RemoveLocalStorageVal(key)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
app := arg["app"].(string)
|
||||
evt := util.NewCmdResult("removeLocalStorageVal", 0, util.PushModeBroadcastMainExcludeSelfApp)
|
||||
evt.AppId = app
|
||||
evt.Data = map[string]interface{}{"key": key}
|
||||
util.PushEvent(evt)
|
||||
}
|
||||
|
||||
func setLocalStorageVal(c *gin.Context) {
|
||||
|
@ -156,26 +161,18 @@ func setLocalStorageVal(c *gin.Context) {
|
|||
|
||||
key := arg["key"].(string)
|
||||
val := arg["val"].(interface{})
|
||||
|
||||
err := model.SetLocalStorageVal(key, val)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func getLocalStorage(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
data, err := model.GetLocalStorage()
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = data
|
||||
app := arg["app"].(string)
|
||||
evt := util.NewCmdResult("setLocalStorageVal", 0, util.PushModeBroadcastMainExcludeSelfApp)
|
||||
evt.AppId = app
|
||||
evt.Data = map[string]interface{}{"key": key, "val": val}
|
||||
util.PushEvent(evt)
|
||||
}
|
||||
|
||||
func setLocalStorage(c *gin.Context) {
|
||||
|
@ -201,3 +198,16 @@ func setLocalStorage(c *gin.Context) {
|
|||
evt.Data = val
|
||||
util.PushEvent(evt)
|
||||
}
|
||||
|
||||
func getLocalStorage(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
data, err := model.GetLocalStorage()
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = data
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue