You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
package commCloud
|
|
|
|
import (
|
|
"GoClouds/core/bean/sysBean"
|
|
"fmt"
|
|
hbtp "github.com/mgr9525/HyperByte-Transfer-Protocol"
|
|
)
|
|
|
|
func ClearCache(key string) error {
|
|
code, bts, err := DoString("ClearCache", key)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if code != hbtp.ResStatusOk {
|
|
return fmt.Errorf("%s", string(bts))
|
|
}
|
|
return nil
|
|
}
|
|
func ClearUserCache(uid string) error {
|
|
code, bts, err := DoString("ClearUserCache", uid)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if code != hbtp.ResStatusOk {
|
|
return fmt.Errorf("%s", string(bts))
|
|
}
|
|
return nil
|
|
}
|
|
func CheckPermission(uid, perm string) bool {
|
|
code, bts, err := DoString("CheckPermission", &sysBean.CheckPermissionReq{Uid: uid, Perm: perm})
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if code == hbtp.ResStatusOk && string(bts) == "true" {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
func SendSms(phone, ips string) error {
|
|
code, bts, err := DoString("SendSms", &sysBean.SendSmsReq{Phone: phone, Ips: ips})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if code != hbtp.ResStatusOk {
|
|
return fmt.Errorf("%s", string(bts))
|
|
}
|
|
return nil
|
|
}
|
|
func ValidSms(phone, codes string) error {
|
|
code, bts, err := DoString("ValidSms", &sysBean.VaildSmsReq{Phone: phone, Code: codes})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if code != hbtp.ResStatusOk {
|
|
return fmt.Errorf("%s", string(bts))
|
|
}
|
|
return nil
|
|
}
|