|
@@ -1,8 +1,10 @@
|
|
package yidong
|
|
package yidong
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "encoding/json"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/rdlucklib/rdluck_tools/http"
|
|
"hongze/hongze_open_api/models/tables/open_api_user"
|
|
"hongze/hongze_open_api/models/tables/open_api_user"
|
|
"hongze/hongze_open_api/utils"
|
|
"hongze/hongze_open_api/utils"
|
|
"strconv"
|
|
"strconv"
|
|
@@ -45,3 +47,43 @@ func CheckAppidAndIp(appid, ip string) (err error) {
|
|
//}
|
|
//}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// Response 结构体表示整个响应
|
|
|
|
+type CrmApiUserResponse struct {
|
|
|
|
+ Code int `json:"code"`
|
|
|
|
+ Msg string `json:"msg"`
|
|
|
|
+ Data *CrmApiUserData `json:"data"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Data 结构体表示数据部分
|
|
|
|
+type CrmApiUserData struct {
|
|
|
|
+ ContactInfo *CrmApiUserContactInfo `json:"contactInfo"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// ContactInfo 结构体表示联系人信息
|
|
|
|
+type CrmApiUserContactInfo struct {
|
|
|
|
+ Status int `json:"status"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetClptCrmWorkerRule 根据手机号,获取策略平台用户对应的权限
|
|
|
|
+func GetClptCrmWorkerRule(mobile string) (statusResp int, err error) {
|
|
|
|
+ crmUrl := utils.CLPT_CRM_URL + `worker/api/getWorkerRule?phone=%s&token=a2db0ab2ca6367741cab37f34d602987`
|
|
|
|
+ crmUrl = fmt.Sprintf(crmUrl, mobile)
|
|
|
|
+ body, err := http.Get(crmUrl)
|
|
|
|
+ //utils.FileLog.Info("lt result:%s", string(body))
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item := new(CrmApiUserResponse)
|
|
|
|
+ err = json.Unmarshal(body, &item)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //如果状态码不等于1 ,就把直接返回
|
|
|
|
+ codeResp := item.Code
|
|
|
|
+ if codeResp != 1 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ statusResp = item.Data.ContactInfo.Status
|
|
|
|
+ return
|
|
|
|
+}
|