Browse Source

转链

master
huangjiajun 7 months ago
parent
commit
5e4f947a8f
1 changed files with 10 additions and 20 deletions
  1. +10
    -20
      chain_transfer/chain_transfer.go

+ 10
- 20
chain_transfer/chain_transfer.go View File

@@ -3,12 +3,12 @@ package chain_transfer
import ( import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/chain_transfer/svc" "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/chain_transfer/svc"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db" "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/haodanku"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/taobao" "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/taobao"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok" "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok"
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"fmt" "fmt"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
"strings" "strings"
"xorm.io/xorm" "xorm.io/xorm"
@@ -54,31 +54,21 @@ func ChainTransfer(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]str
return res return res
} }
bizSceneId := "2" bizSceneId := "2"
tbItemInfo, err := taobaoSdk.ItemDetailById(args["gid"], bizSceneId)
if err != nil {
fmt.Println("=======商品1", err)
if php2go.IsNumeric(args["gid"]) {
tbItemInfo, err := taobaoSdk.ItemDetailById(args["gid"], bizSceneId)
if err != nil {
fmt.Println("=======商品1", err)


return res
}
if tbItemInfo != nil {
args["gid"] = zhios_third_party_utils.AnyToString(tbItemInfo.ItemID)
return res
}
if tbItemInfo != nil {
args["gid"] = zhios_third_party_utils.AnyToString(tbItemInfo.ItemID)
}
} }
curls, err := svc.ConvertUrl(eg, officialEg, args) curls, err := svc.ConvertUrl(eg, officialEg, args)
if err != nil || curls == nil { if err != nil || curls == nil {
return res return res
} }
//调用好单库
itemInfo, _ := haodanku.HaodankuDetail(args["gid"])
//如果优惠券高
if zhios_third_party_utils.StrToFloat64(itemInfo.CouponAmount) > zhios_third_party_utils.StrToFloat64(tbItemInfo.CouponAmount) && zhios_third_party_utils.StrToFloat64(itemInfo.CouponAmount) > 0 {
if strings.Contains(curls.ShortenURL, "uland.") {
if strings.Contains(curls.ShortenURL, "?") {
curls.ShortenURL += "&activityId=" + itemInfo.ActivityId
} else {
curls.ShortenURL += "?activityId=" + itemInfo.ActivityId
}
}
}
if curls.Tkl != "" { if curls.Tkl != "" {
curls.TaoBaoWord = curls.Tkl curls.TaoBaoWord = curls.Tkl
} }


Loading…
Cancel
Save