package sysCloud import ( "GoBanpen/service/userService" gocloud "github.com/mgr9525/go-cloud" ruisUtil "github.com/mgr9525/go-ruisutil" "gopkg.in/macaron.v1" ) func ClearCache(key string) (rb bool) { defer ruisUtil.Recovers("CheckUPermmsion", func(errs string) { rb = false }) pers := gocloud.GetNewMaps() pers["key"] = key code, _, err := SysCloudExec.ExecJSON("/comm/clearCache", &pers) if err != nil { return false } if code == 200 { return true } return false } func ClearUserCache(uid string) (rb bool) { defer ruisUtil.Recovers("CheckUPermmsion", func(errs string) { rb = false }) pers := gocloud.GetNewMaps() pers["uid"] = uid code, _, err := SysCloudExec.ExecJSON("/comm/clearUserCache", &pers) if err != nil { return false } if code == 200 { return true } return false } func CheckPermission(uid, perm string) (rb bool) { defer ruisUtil.Recovers("CheckUPermmsion", func(errs string) { rb = false }) pers := gocloud.GetNewMaps() pers["uid"] = uid pers["perm"] = perm code, cont, err := SysCloudExec.ExecJSON("/comm/checkPermission", &pers) if err != nil { return false } if code != 200 { return false } return cont == "true" } func CheckUPermission(perm string, c *macaron.Context) (rb bool) { defer ruisUtil.Recovers("CheckUPermmsion", func(errs string) { rb = false }) lguser := userService.GetCurrentUser(c) if lguser == nil { return false } return CheckPermission(lguser.Uuid, perm) } func GetUserPerms(uid string) map[string]bool { ret := make(map[string]bool) pers := gocloud.GetNewMaps() pers["uid"] = uid err := SysCloudExec.ExecObjJSON("/comm/getUserPerms", &pers, &ret) if err != nil { println("getUserPerms err:" + err.Error()) return ret } return ret } func SendSms(phone, ips string) (int, string) { pars := ruisUtil.NewMap() pars.Set("phone", phone) pars.Set("ips", ips) code, conts, err := SysCloudExec.ExecJSON("/comm/sendSms", pars) if err != nil { println("SendSms err:" + err.Error()) } return code, conts } func VaildSms(phone, codes string) (int, string) { pars := ruisUtil.NewMap() pars.Set("phone", phone) pars.Set("code", codes) code, conts, err := SysCloudExec.ExecJSON("/comm/vaildSms", pars) if err != nil { println("VaildSms err:" + err.Error()) } return code, conts }