|
|
@ -3,6 +3,8 @@ package utils |
|
|
|
import ( |
|
|
|
"GoClouds/core/comm" |
|
|
|
"fmt" |
|
|
|
ruisUtil "github.com/mgr9525/go-ruisutil" |
|
|
|
"gopkg.in/macaron.v1" |
|
|
|
"math/rand" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
@ -26,3 +28,17 @@ func HideUserName(name string) string { |
|
|
|
} |
|
|
|
return name |
|
|
|
} |
|
|
|
|
|
|
|
func ResMsg(c *macaron.Context, code int, msg string, desc ...string) { |
|
|
|
rets := ruisUtil.NewMap() |
|
|
|
rets.Set("msg", msg) |
|
|
|
if len(desc) > 0 { |
|
|
|
for i, v := range desc { |
|
|
|
rets.Set(fmt.Sprintf("desc%d", i+1), v) |
|
|
|
} |
|
|
|
} |
|
|
|
c.JSON(code, rets) |
|
|
|
} |
|
|
|
func ResMsgs(c *macaron.Context, code int, msg string) { |
|
|
|
c.PlainText(code, []byte(msg)) |
|
|
|
} |