|
@@ -6,21 +6,62 @@ import ( |
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/offical/model" |
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/offical/model" |
|
|
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/tidwall/gjson" |
|
|
"strings" |
|
|
"strings" |
|
|
"time" |
|
|
"time" |
|
|
"xorm.io/xorm" |
|
|
"xorm.io/xorm" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func ShortUrlSend(engine *xorm.Engine, uid string, url string) string { |
|
|
|
|
|
num := KuaizhanShortUrlNumGetSmsNum(engine, uid) |
|
|
|
|
|
|
|
|
func ShortUrlSend(engine *xorm.Engine, mid string, url string) string { |
|
|
|
|
|
num := KuaizhanShortUrlNumGetSmsNum(engine, mid) |
|
|
if num <= 0 { |
|
|
if num <= 0 { |
|
|
return url |
|
|
return url |
|
|
} |
|
|
} |
|
|
|
|
|
shortUrl := "" |
|
|
if strings.Contains(url, "kuaizhan") { |
|
|
if strings.Contains(url, "kuaizhan") { |
|
|
|
|
|
|
|
|
|
|
|
shortUrl = "" |
|
|
|
|
|
} |
|
|
|
|
|
if shortUrl == "" { |
|
|
|
|
|
shortUrl = GetBaiduUrl(url) |
|
|
|
|
|
if shortUrl != "" { |
|
|
|
|
|
args := map[string]interface{}{ |
|
|
|
|
|
"uid": mid, |
|
|
|
|
|
} |
|
|
|
|
|
KuaizhanShortUrlSend(engine, args) |
|
|
|
|
|
url = shortUrl |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return url |
|
|
return url |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func GetBaiduUrl(url string) string { |
|
|
|
|
|
method := "https://dwz.cn/admin/v2/create" |
|
|
|
|
|
arg := map[string]string{ |
|
|
|
|
|
"TermOfValidity": "1-year", // "long-term":永久,默认值 "1-year":1年 |
|
|
|
|
|
"Url": url, |
|
|
|
|
|
} |
|
|
|
|
|
headers := map[string]string{ |
|
|
|
|
|
"Token": "eecdf4b18f416b0cf26fef98f7e1f4ff", |
|
|
|
|
|
} |
|
|
|
|
|
post, err := zhios_third_party_utils.CurlPost(method, zhios_third_party_utils.SerializeStr(arg), headers) |
|
|
|
|
|
fmt.Println(string(post)) |
|
|
|
|
|
fmt.Println(err) |
|
|
|
|
|
return gjson.Get(string(post), "ShortUrl").String() |
|
|
|
|
|
} |
|
|
|
|
|
func GetThreePartUrl(url string) { |
|
|
|
|
|
method := "https://cloud.kuaizhan.com/api/v1/tbk/genShortUrl" |
|
|
|
|
|
appKey := "7w2N8ohpFJxW" |
|
|
|
|
|
appSecret := "11f7fa9a66c75229aca909b6c171cf84fa747ec4" |
|
|
|
|
|
arg := map[string]string{ |
|
|
|
|
|
"appKey": appKey, |
|
|
|
|
|
"url": url, |
|
|
|
|
|
} |
|
|
|
|
|
str := "appKey" + appKey + "url" + url |
|
|
|
|
|
arg["sign"] = zhios_third_party_utils.Md5(appSecret + str + appSecret) |
|
|
|
|
|
post, err := zhios_third_party_utils.CurlPost(method, arg, nil) |
|
|
|
|
|
fmt.Println(string(post)) |
|
|
|
|
|
fmt.Println(err) |
|
|
|
|
|
} |
|
|
func GetKuaizhanUrl(url string) { |
|
|
func GetKuaizhanUrl(url string) { |
|
|
method := "https://cloud.kuaizhan.com/api/v1/tbk/genKzShortUrl" |
|
|
method := "https://cloud.kuaizhan.com/api/v1/tbk/genKzShortUrl" |
|
|
appKey := "7w2N8ohpFJxW" |
|
|
appKey := "7w2N8ohpFJxW" |
|
|