Kaynağa Gözat

更新

master
huangjiajun 1 yıl önce
ebeveyn
işleme
f6f6020a47
3 değiştirilmiş dosya ile 33 ekleme ve 4 silme
  1. +9
    -0
      tik_tok/svc_tik_tok_team.go
  2. +22
    -0
      utils/file.go
  3. +2
    -4
      utils/uuid.go

+ 9
- 0
tik_tok/svc_tik_tok_team.go Dosyayı Görüntüle

@@ -103,11 +103,17 @@ func ActivityProduct(args map[string]string) ([]TikTokGoods, int64, string) {
params["cursor"] = args["cursor"]
}
send, err := Send(args["appkey"], args["appSecret"], "alliance.colonelActivityProduct", params, args["acctoken"])

fmt.Println(send)
fmt.Println(err)
var goodsList = make([]TikTokGoods, 0)
product := gjson.Get(send, "data.data").String()
if err != nil || product == "" {
zhios_third_party_utils.FilePutContents("tikTokTeam", "args:"+zhios_third_party_utils.SerializeStr(args))
if err != nil {
zhios_third_party_utils.FilePutContents("tikTokTeam", "err:"+err.Error())
}
zhios_third_party_utils.FilePutContents("tikTokTeam", "send:"+send)
return goodsList, 0, ""
}
var lmData struct {
@@ -119,6 +125,9 @@ func ActivityProduct(args map[string]string) ([]TikTokGoods, int64, string) {
}
err = json.Unmarshal([]byte(send), &lmData)
if err != nil {
zhios_third_party_utils.FilePutContents("tikTokTeamJson", "args:"+zhios_third_party_utils.SerializeStr(args))
zhios_third_party_utils.FilePutContents("tikTokTeamJson", "err:"+err.Error())
zhios_third_party_utils.FilePutContents("tikTokTeamJson", "send:"+send)
return goodsList, 0, ""
}
for _, v := range lmData.Data.Data {


+ 22
- 0
utils/file.go Dosyayı Görüntüle

@@ -0,0 +1,22 @@
package zhios_third_party_utils

import (
"os"
"path"
"strings"
"time"
)

// 获取文件后缀
func FileExt(fname string) string {
return strings.ToLower(strings.TrimLeft(path.Ext(fname), "."))
}

func FilePutContents(fileName string, content string) {
fd, _ := os.OpenFile("./tmp/"+fileName+".log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
fd_time := time.Now().Format("2006-01-02 15:04:05")
fd_content := strings.Join([]string{"[", fd_time, "] ", content, "\n"}, "")
buf := []byte(fd_content)
fd.Write(buf)
fd.Close()
}

+ 2
- 4
utils/uuid.go Dosyayı Görüntüle

@@ -1,7 +1,6 @@
package zhios_third_party_utils

import (

"fmt"
"math/rand"
"time"
@@ -24,10 +23,9 @@ func newUUID() *[16]byte {

func UUIDString() string {
u := newUUID()
return fmt.Sprintf("%x-%x-%x-%x-%x", u[:4], u[4:6], u[6:8], u[8:10], u[10:])
return fmt.Sprintf("%x%x%x", u[:4], u[4:6], u[10:])
}


func Krand(size int, kind int) []byte {
ikind, kinds, result := kind, [][]int{[]int{10, 48}, []int{26, 97}, []int{26, 65}}, make([]byte, size)
isAll := kind > 2 || kind < 0
@@ -40,4 +38,4 @@ func Krand(size int, kind int) []byte {
result[i] = uint8(base + rand.Intn(scope))
}
return result
}
}

Yükleniyor…
İptal
Kaydet