zjxpcyc hace 6 años
padre
commit
df46f969da
Se han modificado 1 ficheros con 10 adiciones y 2 borrados
  1. 10
    2
      service/customer/customer.go

+ 10
- 2
service/customer/customer.go Ver fichero

@@ -278,10 +278,18 @@ func (s *CustomerServ) SaveNewCustomer(wxInfo map[string]interface{}, caseID, ar
278 278
 
279 279
 	// 微信相关字段
280 280
 	nickyName := wxInfo["nickname"].(string)
281
-	sex := wxInfo["sex"].(string)
282 281
 	headimgurl := wxInfo["headimgurl"].(string)
283 282
 
284
-	sexInt, _ := strconv.Atoi(sex)
283
+	var sexInt int
284
+	switch val := wxInfo["sex"].(type) {
285
+	case string:
286
+		sexInt, _ = strconv.Atoi(val)
287
+	case float64:
288
+		sexInt = int(val)
289
+	default:
290
+		sexInt = 1
291
+	}
292
+
285 293
 	if sexInt == 0 {
286 294
 		sexInt = 1 // 默认男性
287 295
 	}