Browse Source

no message

xingzai 2 years ago
parent
commit
30a9816458
4 changed files with 58 additions and 1 deletions
  1. 4 0
      controllers/activity.go
  2. 1 1
      controllers/yidong.go
  3. 2 0
      models/activity.go
  4. 51 0
      services/yidong.go

+ 4 - 0
controllers/activity.go

@@ -903,6 +903,10 @@ func (this *ActivityCoAntroller) Detail() {
 			}
 		}
 		activityInfo.Listndustrial = industrialList
+		if activityInfo.YidongActivityId != "" {
+			ydTgc, _ := services.GetYiDongCreateUserInfo(user)
+			activityInfo.YidongActivityUrl += "?source=11&fromHz=true&tgc=" + ydTgc
+		}
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)
 	}

+ 1 - 1
controllers/yidong.go

@@ -307,7 +307,7 @@ func (this *BaseYidongController) UserSingnUp() {
 
 	payload := strings.NewReader(`{
     "activityId": "9395325920258067463",
-    "personTelephone": "18767183922",
+    "personTelephone": "15557270714",
     "personName": "沈大爷",
     "companyName": "弘则研究",
     "mobileCountryCode": "+86",

+ 2 - 0
models/activity.go

@@ -176,6 +176,8 @@ type ActivityDetail struct {
 	IsShowSignup            bool                       `description:"是否展示我要报名"`
 	TemporaryLabel          string                     `description:"临时标签"`
 	IsCanAppointmentMinutes int                        `description:"是否可预约纪要 1是 ,0 否 默认0 "`
+	YidongActivityId        string                     `description:"易董活动ID"`
+	YidongActivityUrl       string                     `description:"易董活动跳转地址"`
 }
 
 type CygxActivityResp struct {

+ 51 - 0
services/yidong.go

@@ -59,6 +59,7 @@ func GetActivityTypeIdWithYiDong(industrySwName string) (chartPermissionId int)
 		"商业贸易": utils.CHART_PERMISSION_ID_YANXUAN,
 		//研选
 	}
+	chartPermissionId = mapIndustrySwName[industrySwName]
 	fmt.Println(mapIndustrySwName)
 	return
 }
@@ -104,6 +105,7 @@ func GetActivityTypeNameWithYiDong(industrySwName string) (chartPermissionName s
 		"商业贸易": utils.CHART_PERMISSION_NAME_MF_YANXUAN,
 		//研选
 	}
+	chartPermissionName = mapIndustrySwName[industrySwName]
 	fmt.Println(mapIndustrySwName)
 	return
 }
@@ -304,3 +306,52 @@ func GetYiDongActivityDetail(activityId string) (detail *models.ApifoxModaldetai
 	detail = ApifoxModal
 	return
 }
+
+//生成用户相关信息接口 获取用户tgc
+func GetYiDongCreateUserInfo(user *models.WxUserItem) (userTgc string, err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			utils.FileLog.Info(err.Error())
+		}
+	}()
+	url := utils.YiDongHuaWeiYunUrl + "app/hz/createUserInfo"
+	method := "POST"
+	payload := strings.NewReader(`{
+  "phone": "` + user.Mobile + `",
+  "mobileCountryCode": "+` + user.CountryCode + `",
+  "sourceFrom": "01"
+}`)
+	client := &http.Client{}
+	req, err := http.NewRequest(method, url, payload)
+	if err != nil {
+		fmt.Println(err)
+		utils.FileLog.Info(err.Error())
+		return
+	}
+	req.Header.Add("Content-Type", "application/json")
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		utils.FileLog.Info(err.Error())
+		return
+	}
+	defer res.Body.Close()
+	var ApifoxModal *models.ApifoxModalUserTgc
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		utils.FileLog.Info(err.Error())
+		return
+	}
+	utils.FileLog.Info(string(body))
+	fmt.Println(string(body))
+	err = json.Unmarshal(body, &ApifoxModal)
+	if err != nil {
+		fmt.Println("Getres.PublicGetDate Err:", err.Error())
+		utils.FileLog.Info(err.Error())
+		return
+	}
+	userTgc = ApifoxModal.Result.Tgc
+	return
+}