瀏覽代碼

更新快递接口

yuliang1112 2 年之前
父節點
當前提交
163f7d5309
共有 2 個文件被更改,包括 20 次插入14 次删除
  1. 18 12
      db/talent.go
  2. 2 2
      service/kuaiDi100.go

+ 18 - 12
db/talent.go

@@ -64,6 +64,7 @@ func AccountIncome(ctx context.Context, talentId string) (*http_model.TalentInfo
 		err = db1.Debug().Model(gorm_model.YoungeeTalentDeliveryAddress{}).
 			Where("talent_id = ? AND default_tag = ?", talentId, 1).
 			First(&deliveryInfo).Error
+		fmt.Printf("deliveryInfo%+v\n", deliveryInfo)
 		if err != nil {
 			if err == gorm.ErrRecordNotFound {
 				return nil, nil
@@ -94,20 +95,25 @@ func AccountIncome(ctx context.Context, talentId string) (*http_model.TalentInfo
 	db3 := GetReadDB(ctx)
 	var infoBank *gorm_model.InfoBank
 	db3.Debug().Model(gorm_model.InfoBank{}).Where("id = ?", talentBankInfo.BankID).First(&infoBank)
-	db4 := GetReadDB(ctx)
-	var infoRegion *gorm_model.InfoRegion
-	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", talentBankInfo.BankOpenAddress).First(&infoRegion)
-
-	provinceCode := conv.MustString(talentBankInfo.BankOpenAddress, "")[0:2] + "0000"
-	var province *gorm_model.InfoRegion
-	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(provinceCode, 0)).First(&province)
-
-	cityCode := conv.MustString(talentBankInfo.BankOpenAddress, "")[0:4] + "00"
-	var city *gorm_model.InfoRegion
-	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(cityCode, 0)).First(&city)
+	region := ""
+	if talentBankInfo.BankOpenAddress != 0 {
+		region = GetRegion(ctx, talentBankInfo.BankOpenAddress)
+	}
+	//db4 := GetReadDB(ctx)
+	//var infoRegion *gorm_model.InfoRegion
+	//db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", talentBankInfo.BankOpenAddress).First(&infoRegion)
+	//
+	//provinceCode := conv.MustString(talentBankInfo.BankOpenAddress, "")[0:2] + "0000"
+	//var province *gorm_model.InfoRegion
+	//db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(provinceCode, 0)).First(&province)
+	//
+	//cityCode := conv.MustString(talentBankInfo.BankOpenAddress, "")[0:4] + "00"
+	//var city *gorm_model.InfoRegion
+	//db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(cityCode, 0)).First(&city)
 
 	data.Bank = infoBank.Name
-	data.BankOpenAddress = province.RegionName + city.RegionName + infoRegion.RegionName
+	//data.BankOpenAddress = province.RegionName + city.RegionName + infoRegion.RegionName
+	data.BankOpenAddress = region
 	data.BankCardNumber = talentBankInfo.BankCardNumber
 	data.Name = talentBankInfo.Name
 	data.AliPayNumber = talentBankInfo.AlipayNumber

+ 2 - 2
service/kuaiDi100.go

@@ -51,8 +51,8 @@ var KD100Flags = map[string]string{
 // GetKDStatus 获取快递跟踪信息
 func GetKDStatus(com, num string) string {
 	fmt.Printf("查询物流公司为 %v, 快递为编号为 %v 的快递\n", KD100Flags[com], num)
-	key := "jqayXRgj8154"                          //客户授权key
-	customer := "E59437A1C1C69273AEB48F587CEF57B4" //查询公司编号
+	key := "GsCwDkmq1520"                          //客户授权key
+	customer := "F2E05F275D02E5344011B3DCD6FEB80D" //查询公司编号
 
 	postUrl := "https://poll.kuaidi100.com/poll/query.do" //实时查询请求地址