1 1 месяц назад
Родитель
Сommit
c55886fcbe
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      common/utils.go

+ 15 - 0
common/utils.go

@@ -4,6 +4,7 @@ import (
 	"crypto/md5"
 	"encoding/hex"
 	"fmt"
+	"git.listensoft.net/tool/jspkit/common/lxhttp"
 	"git.listensoft.net/tool/jspkit/common/variable"
 	"git.listensoft.net/tool/jspkit/taxerr"
 	"github.com/go-kratos/kratos/v2/log"
@@ -131,3 +132,17 @@ func CheckMobile(mobile string) bool {
 func NewWebStuckTitle() *taxerr.SystemErr {
 	return taxerr.NewSystemV3("电子税局页面卡顿", "系统将于30分钟后重试(可在\"通用设置\"关闭)")
 }
+
+// 查看设备是否在线
+func CheckEqmLive(tel string) bool {
+	client := lxhttp.NewHttpClient()
+	defer client.CloseIdleConnections()
+	bys, err := lxhttp.POSTJson(client, "https://keep.jsptax.com"+"/api/v1/telDeviceStatus", map[string]string{"mobiles": tel}, map[string]string{})
+	if err != nil {
+		return false
+	}
+	if gjson.GetBytes(bys, `data.status`).Bool() {
+		return true
+	}
+	return false
+}