|
@@ -475,3 +475,41 @@ func TimeFormatM(str string, Type int) string {
|
|
|
func DelSpace(str string) string {
|
|
|
return strings.Replace(str, " ", "", -1)
|
|
|
}
|
|
|
+
|
|
|
+// 登录异常统一提示
|
|
|
+func LoginErr() *taxerr.SystemErr {
|
|
|
+ return taxerr.NewSystemV3("登录出现异常", "系统将于30分钟后重试(可在\"通用设置\"关闭)")
|
|
|
+}
|
|
|
+
|
|
|
+func GetMobileOnline(mobile string) bool {
|
|
|
+ type getAppHeartbeatSmsRes struct {
|
|
|
+ Data struct {
|
|
|
+ List []struct {
|
|
|
+ ID int `json:"ID"`
|
|
|
+ CreatedAt time.Time `json:"CreatedAt"`
|
|
|
+ UpdatedAt time.Time `json:"UpdatedAt"`
|
|
|
+ Mobile string `json:"Mobile"`
|
|
|
+ Heartbeat time.Time `json:"Heartbeat"`
|
|
|
+ Status string `json:"status"`
|
|
|
+ } `json:"list"`
|
|
|
+ Total int `json:"total"`
|
|
|
+ } `json:"data"`
|
|
|
+ ErrNo int `json:"errNo"`
|
|
|
+ Msg string `json:"msg"`
|
|
|
+ }
|
|
|
+
|
|
|
+ resp, err := http.Post(`https://public.listensoft.net/api/getAppHeartbeatSms`, "application/json", bytes.NewBufferString(`{"mobile":"`+mobile+`"}`))
|
|
|
+ if err != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ all, err := io.ReadAll(resp.Body)
|
|
|
+ logger.Info("getAppHeartbeatSms:", string(all))
|
|
|
+ res := getAppHeartbeatSmsRes{}
|
|
|
+ _ = json.Unmarshal(all, &res)
|
|
|
+ for _, m := range res.Data.List {
|
|
|
+ if m.Mobile == mobile && m.Status == "ok" {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|