瀏覽代碼

更新

master
huangjiajun 1 年之前
父節點
當前提交
f3ad640ca1
共有 13 個文件被更改,包括 514 次插入6 次删除
  1. +6
    -6
      card_pay/card_pay.go
  2. +10
    -0
      comm/api.go
  3. +41
    -0
      dataoke/api.go
  4. +76
    -0
      dataoke/dataoke.go
  5. +70
    -0
      haodanku/api.go
  6. +77
    -0
      haodanku/haodanku.go
  7. +27
    -0
      jingtuitui/api.go
  8. +39
    -0
      jingtuitui/jingtuitui.go
  9. +43
    -0
      md/dataoke.go
  10. +52
    -0
      md/haodanku.go
  11. +65
    -0
      md/jingtuitui.go
  12. +7
    -0
      md/meituan_fenxiao.go
  13. +1
    -0
      md/provider.go

+ 6
- 6
card_pay/card_pay.go 查看文件

@@ -44,15 +44,15 @@ func UnBindCard(keyArr, param map[string]string) (string, error) {
return CardPaySend("api/txs/protocol/unBindCard", keyArr, param)
}
func Pay(keyArr map[string]string, param map[string]interface{}) (string, error) {
//memberId := "562902003186055"
//ordId := "11111114"
//memberId := "562932003186159"
//ordId := "217021686896757585"
//amount := "100"
//param = map[string]interface{}{
// "version": "2.0",
// "protocol": "p202306084666779900235",
// "protocol": "p202306161003031409342",
// "outTradeNo": ordId,
// "transType": "01",
// "isSendSmsCode": "2",
// "isSendSmsCode": "1",
// "payAmount": amount,
// "payCurrency": "CNY",
// "transactionStartTime": time.Now().Format("20060102150405"),
@@ -79,12 +79,12 @@ func Pay(keyArr map[string]string, param map[string]interface{}) (string, error)
//param["splitModel"] = "5"
//splitInfoList := []map[string]string{
// {
// "amount": "10",
// "amount": "2",
// "customerCode": CustomerCode,
// "isProcedureCustomer": "3",
// },
// {
// "amount": "90",
// "amount": "98",
// "customerCode": memberId,
// "isProcedureCustomer": "0",
// },


+ 10
- 0
comm/api.go 查看文件

@@ -27,6 +27,16 @@ func KsortToStr(params map[string]string) []string {
sort.Strings(keys)
return keys
}
func KsortToStrInterface(params map[string]interface{}) []string {
keys := make([]string, len(params))
i := 0
for k, _ := range params {
keys[i] = k
i++
}
sort.Strings(keys)
return keys
}

// Marshal 序列化参数
func GetSortJson(o interface{}) string {


+ 41
- 0
dataoke/api.go 查看文件

@@ -0,0 +1,41 @@
package dataoke

import (
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"net/url"
"sort"
"strings"
)

var (
Appkey = "5ce66ae30ff54"
Appsecret = "07350d1665e55e1950a26ebb3dde23ed"
)

// url 地址 params 参数
func SendReq(urls string, params map[string]string) ([]byte, error) {
params["appKey"] = Appkey
params["sign"] = Sign(params, Appsecret)
var s url.URL
q := s.Query()
for k, v := range params {
q.Add(k, v)
}
urls += "?" + q.Encode()
return zhios_third_party_utils.CurlGet(urls, nil)
}
func Sign(args map[string]string, secret string) string {
var keys []string
for k := range args {
keys = append(keys, k)
}
sort.Strings(keys)
var str = ""
for _, k := range keys {
//拼接字符串
str += k + "=" + args[k] + "&"
}

str += "key=" + secret
return strings.ToUpper(zhios_third_party_utils.Md5(str))
}

+ 76
- 0
dataoke/dataoke.go 查看文件

@@ -0,0 +1,76 @@
package dataoke

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"encoding/json"
"github.com/tidwall/gjson"
"net/url"
)

func DataokeFriendsCircleList(params map[string]string) []map[string]string {
var goods = make([]map[string]string, 0)
resp, err := SendReq("https://openapi.dataoke.com/api/goods/friends-circle-list", params)
if err != nil {
return goods
}
data := gjson.Get(string(resp), "data").String()
if data == "" {
return goods
}
var oldGoods []md.DataokeFriendCircleList
json.Unmarshal([]byte(data), &oldGoods)
for _, v := range oldGoods {
m, _ := url.QueryUnescape(v.CircleText)
pvd := md.PVD_TB
if v.ShopType == 1 {
pvd = md.PVD_TM
}
var tmp = map[string]string{
"gid": v.GoodsID,
"title": v.Dtitle,
"img": v.MainPic,
"sales": zhios_third_party_utils.IntToStr(v.MonthSales),
"day_sales": zhios_third_party_utils.IntToStr(v.DailySales),
"price": zhios_third_party_utils.Float64ToStr(v.ActualPrice),
"cost_price": zhios_third_party_utils.Float64ToStr(v.OriginalPrice),
"coupon": zhios_third_party_utils.Float64ToStr(v.CouponPrice),
"commission_rate": zhios_third_party_utils.Float64ToStr(v.CommissionRate),
"commission": zhios_third_party_utils.Float64ToStr(v.ActualPrice * (v.CommissionRate / 100)),
"pvd": pvd,
"share_content": m,
}
goods = append(goods, tmp)
}
return goods
}

//func DataokeFriendsCircleList(params map[string]string) []map[string]string {
// var goods = make([]map[string]string, 0)
// resp, err := SendReq("https://openapi.dataoke.com/api/goods/friends-circle-list", params)
// if err != nil {
// return goods
// }
// data := gjson.Get(string(resp), "data").String()
// if data == "" {
// return goods
// }
// var oldGoods []md.HaodankuSelectedItem
// json.Unmarshal([]byte(data), &oldGoods)
// for _, v := range oldGoods {
//var tmp = map[string]string{
// "gid": v.Itemid,
// "title": v.Title,
// "img": img,
// "sales": "",
// "price": v.Itemendprice,
// "cost_price": v.Itemprice,
// "coupon": v.Couponmoney,
// "commission_rate": v.Tkrates,
// "commission": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(v.Itemendprice) * (zhios_third_party_utils.StrToFloat64(v.Tkrates) / 100)),
// "pvd": "taobao",
// "share_content": content,
//}
//goods = append(goods, tmp)
//}
//}

+ 70
- 0
haodanku/api.go
文件差異過大導致無法顯示
查看文件


+ 77
- 0
haodanku/haodanku.go 查看文件

@@ -0,0 +1,77 @@
package haodanku

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"encoding/json"
"github.com/tidwall/gjson"
"strings"
)

func HaodankuFriendsCircleItems(params map[string]string) []map[string]string {
var goods = make([]map[string]string, 0)
reqNew, err := SendReqNew("http://v3.api.haodanku.com/friends_circle_items", params)
if err != nil {
return goods
}
data := gjson.Get(string(reqNew), "data").String()
if data == "" {
return goods
}
var oldGoods []md.HaodankuFriendsCircleItems
json.Unmarshal([]byte(data), &oldGoods)
for _, v := range oldGoods {
v.Comment.CopyContent = strings.ReplaceAll(v.Comment.CopyContent, "<br>", "\r\n")
var tmp = map[string]string{
"gid": v.Items.Itemid,
"title": v.Items.Itemshorttitle,
"img": v.Items.Itempic,
"sales": "",
"price": v.Items.Itemendprice,
"cost_price": v.Items.Itemprice,
"coupon": v.Items.Couponmoney,
"commission_rate": v.Items.Tkrates,
"commission": v.Items.Tkmoney,
"pvd": "taobao",
"share_content": v.Comment.CopyContent,
}
goods = append(goods, tmp)
}
return goods
}
func HaodankuSelectedItem(params map[string]string) []map[string]string {
var goods = make([]map[string]string, 0)
reqNew, err := SendReqNew("http://v2.api.haodanku.com/selected_item", params)
if err != nil {
return goods
}
data := gjson.Get(string(reqNew), "data").String()
if data == "" {
return goods
}
var oldGoods []md.HaodankuSelectedItem
json.Unmarshal([]byte(data), &oldGoods)
for _, v := range oldGoods {
content := v.CopyContent
content = strings.ReplaceAll(content, "&lt;br&gt;", "\r\n")
img := ""
if len(v.Itempic) > 0 {
img = v.Itempic[0]
}
var tmp = map[string]string{
"gid": v.Itemid,
"title": v.Title,
"img": img,
"sales": "",
"price": v.Itemendprice,
"cost_price": v.Itemprice,
"coupon": v.Couponmoney,
"commission_rate": v.Tkrates,
"commission": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(v.Itemendprice) * (zhios_third_party_utils.StrToFloat64(v.Tkrates) / 100)),
"pvd": "taobao",
"share_content": content,
}
goods = append(goods, tmp)
}
return goods
}

+ 27
- 0
jingtuitui/api.go 查看文件

@@ -0,0 +1,27 @@
package jingtuitui

import (
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"net/url"
)

var (
//AppId = "1905100947392483"
//AppKey = "0b01f8443a6045fec070b15ff72f2ade"

AppId = "1808101621139589"
AppKey = "4e15dd15dee97340c364ca678703e2d1"
)

// url 地址 params 参数
func SendReq(urls string, params map[string]string) ([]byte, error) {
params["appid"] = AppId
params["appkey"] = AppKey
var s url.URL
q := s.Query()
for k, v := range params {
q.Add(k, v)
}
urls += "?" + q.Encode()
return zhios_third_party_utils.CurlGet(urls, nil)
}

+ 39
- 0
jingtuitui/jingtuitui.go 查看文件

@@ -0,0 +1,39 @@
package jingtuitui

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"encoding/json"
"github.com/tidwall/gjson"
)

func JingtuituiGetCircleList(params map[string]string) []map[string]string {
var goods = make([]map[string]string, 0)
resp, err := SendReq("http://japi.jingtuitui.com/api/get_circle_list", params)
if err != nil {
return goods
}
data := gjson.Get(string(resp), "data").String()
if data == "" {
return goods
}
var oldGoods []md.JingtuituiGetCircleList
json.Unmarshal([]byte(data), &oldGoods)
for _, v := range oldGoods {
var tmp = map[string]string{
"gid": zhios_third_party_utils.AnyToString(v.GoodsID),
"title": v.GoodsInfo.GoodsName,
"img": v.GoodsInfo.GoodsImg,
"sales": zhios_third_party_utils.IntToStr(v.GoodsInfo.InOrderCount30Days),
"price": zhios_third_party_utils.AnyToString(v.GoodsInfo.FinalPrice),
"cost_price": zhios_third_party_utils.AnyToString(v.GoodsInfo.GoodsPrice),
"coupon": zhios_third_party_utils.AnyToString(v.GoodsInfo.DiscountPrice),
"commission_rate": zhios_third_party_utils.AnyToString(v.GoodsInfo.CommissionShare),
"commission": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.FinalPrice) * (zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.CommissionShare) / 100)),
"pvd": md.PVD_JD,
"share_content": v.CircleContent[0],
}
goods = append(goods, tmp)
}
return goods
}

+ 43
- 0
md/dataoke.go 查看文件

@@ -0,0 +1,43 @@
package md

type DataokeFriendCircleList struct {
QuanMLink int `json:"quanMLink"`
HzQuanOver int `json:"hzQuanOver"`
EstimateAmount int `json:"estimateAmount"`
CircleText string `json:"circleText"`
FreeshipRemoteDistrict int `json:"freeshipRemoteDistrict"`
ID int `json:"id"`
GoodsID string `json:"goodsId"`
Title string `json:"title"`
Dtitle string `json:"dtitle"`
OriginalPrice float64 `json:"originalPrice"`
ActualPrice float64 `json:"actualPrice"`
MonthSales int `json:"monthSales"`
TwoHoursSales int `json:"twoHoursSales"`
DailySales int `json:"dailySales"`
CommissionType int `json:"commissionType"`
Desc string `json:"desc"`
CouponReceiveNum int `json:"couponReceiveNum"`
CouponLink string `json:"couponLink"`
CouponEndTime string `json:"couponEndTime"`
CouponStartTime string `json:"couponStartTime"`
CouponPrice float64 `json:"couponPrice"`
CouponConditions string `json:"couponConditions"`
CreateTime string `json:"createTime"`
MainPic string `json:"mainPic"`
MarketingMainPic string `json:"marketingMainPic"`
Cid int `json:"cid"`
Discounts float64 `json:"discounts"`
CommissionRate float64 `json:"commissionRate"`
CouponTotalNum int `json:"couponTotalNum"`
ShopName string `json:"shopName"`
Brand int `json:"brand"`
BrandID int `json:"brandId"`
BrandName string `json:"brandName"`
ItemLink string `json:"itemLink"`
ShopType int `json:"shopType"`
Subcid []interface{} `json:"subcid"`
ShipaiPic string `json:"shipaiPic"`
ShangchaoPic string `json:"shangchaoPic"`
Tbcid int `json:"tbcid"`
}

+ 52
- 0
md/haodanku.go 查看文件

@@ -0,0 +1,52 @@
package md

type HaodankuFriendsCircleItems struct {
MaterialId string `json:"material_id"`
CopyWriter string `json:"copy_writer"`
FriendsComment string `json:"friends_comment"`
Image []string `json:"image"`
Itemid string `json:"itemid"`
FirstComment string `json:"first_comment"`
ShowTime string `json:"show_time"`
Items struct {
Itemdesc string `json:"itemdesc"`
Couponmoney string `json:"couponmoney"`
Itemendprice string `json:"itemendprice"`
Itemid string `json:"itemid"`
Itempic string `json:"itempic"`
Itemprice string `json:"itemprice"`
Itemshorttitle string `json:"itemshorttitle"`
Tkmoney string `json:"tkmoney"`
Couponurl string `json:"couponurl"`
Tkrates string `json:"tkrates"`
} `json:"items"`
Comment struct {
CopyContent string `json:"copy_content"`
ShowContent string `json:"show_content"`
TklContent string `json:"tkl_content"`
} `json:"comment"`
}

type HaodankuSelectedItem struct {
EditID string `json:"edit_id"`
Itemid string `json:"itemid"`
Itempic []string `json:"itempic"`
Title string `json:"title"`
Couponurl string `json:"couponurl"`
CopyContent string `json:"copy_content"`
Comment string `json:"comment"`
AddTime string `json:"add_time"`
ShowTime string `json:"show_time"`
Itemendprice string `json:"itemendprice"`
Couponmoney string `json:"couponmoney"`
SolaImage string `json:"sola_image"`
DummyClickStatistics string `json:"dummy_click_statistics"`
Tkrates string `json:"tkrates"`
Itemprice string `json:"itemprice"`
Content string `json:"content"`
ShowContent string `json:"show_content"`
CopyComment string `json:"copy_comment"`
ShowComment string `json:"show_comment"`
Itemtitle string `json:"itemtitle"`
AdviseTime string `json:"advise_time"`
}

+ 65
- 0
md/jingtuitui.go 查看文件

@@ -0,0 +1,65 @@
package md

type JingtuituiGetCircleList struct {
ID int `json:"id"`
JState int `json:"J_state"`
JID int `json:"JID"`
GoodsID int64 `json:"goods_id"`
ImgInfo []string `json:"img_info"`
NoShowContent string `json:"no_show_content"`
CircleContent []string `json:"circle_content"`
Time string `json:"time"`
ReleaseDate string `json:"release_date"`
GoodsLink string `json:"goods_link"`
DiscountLink string `json:"discount_link"`
GoodsInfo struct {
ShortName string `json:"short_name"`
GoodsName string `json:"goods_name"`
GoodsContent string `json:"goods_content"`
LinkContent string `json:"link_content"`
CommissionShare interface{} `json:"commissionShare"`
BrandID int `json:"brand_id"`
InOrderCount30Days int `json:"inOrderCount30Days"`
InOrderComm30Days int `json:"inOrderComm30Days"`
BrandCode int `json:"brandCode"`
BrandName string `json:"brandName"`
IsHot int `json:"isHot"`
Comments int `json:"comments"`
GoodCommentsShare int `json:"goodCommentsShare"`
GoodsPrice interface{} `json:"goods_price"`
FinalPrice interface{} `json:"final_price"`
HistoryPriceDay int `json:"historyPriceDay"`
GoodsImg string `json:"goods_img"`
ImageList string `json:"imageList"`
TodayNum int `json:"today_num"`
DiscountPrice interface{} `json:"discount_price"`
GetStartTime int64 `json:"get_start_time"`
GetEndTime int64 `json:"get_end_time"`
ShopID int `json:"shop_id"`
ShopName string `json:"shop_name"`
Score string `json:"score"`
Owner string `json:"owner"`
GoodsType int `json:"goods_type"`
GoodsSecondType int `json:"goods_second_type"`
SpuID int64 `json:"spu_id"`
Cid1 int `json:"cid1"`
Cid1Name string `json:"cid1Name"`
Cid2 int `json:"cid2"`
Cid2Name string `json:"cid2Name"`
Cid3 int `json:"cid3"`
Cid3Name string `json:"cid3Name"`
DeliveryType int `json:"deliveryType"`
JdType int `json:"jd_type"`
PingouPrice interface{} `json:"pingouPrice"`
PingouTmCount interface{} `json:"pingouTmCount"`
PingouURL interface{} `json:"pingouUrl"`
PingouStartTime interface{} `json:"pingouStartTime"`
PingouEndTime interface{} `json:"pingouEndTime"`
JdVideoList interface{} `json:"jd_videoList"`
PcWareStyle string `json:"pc_ware_style"`
DiscountCount int `json:"discount_count"`
IsFlagshipStore int `json:"is_flagship_store"`
IsGoodShop int `json:"is_good_shop"`
IsSubsidyGoods int `json:"is_subsidy_goods"`
} `json:"goods_info"`
}

+ 7
- 0
md/meituan_fenxiao.go 查看文件

@@ -0,0 +1,7 @@
package md

type MeituanFenXiaoGeoInfo struct {
CityId int `json:"cityId"`
Lng string `json:"lng"`
Lat string `json:"lat"`
}

+ 1
- 0
md/provider.go 查看文件

@@ -2,6 +2,7 @@ package md

const (
PVD_TB = "taobao"
PVD_TM = "tmall"
PVD_TIKTOK = "tikTok"
PVD_KUAISHOU = "kuaishou"
PVD_TIKTOKLIVE = "tikTok_live"


Loading…
取消
儲存