From 542b106b3e1b6adfa71c0c0e6007609d09549cdd Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 5 Aug 2023 14:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/zhimeng_internal/hdl_playlet_order.go | 38 +++++++++++++++++++ app/router/router.go | 1 + go.mod | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/hdl/zhimeng_internal/hdl_playlet_order.go b/app/hdl/zhimeng_internal/hdl_playlet_order.go index 6e97cdf..d81368b 100644 --- a/app/hdl/zhimeng_internal/hdl_playlet_order.go +++ b/app/hdl/zhimeng_internal/hdl_playlet_order.go @@ -1,10 +1,48 @@ package hdl import ( + "applet/app/db" + "applet/app/e" "applet/app/svc" + svc2 "applet/app/task/svc" + "applet/app/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tpdaren" "github.com/gin-gonic/gin" + "github.com/tidwall/gjson" ) func GetPlayletOrder(c *gin.Context) { svc.GetPlayletOrder(c) } +func GetShortLink(c *gin.Context) { + var args map[string]string + if err := c.ShouldBindJSON(&args); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + sysCfgDb := db.MasterListCfgDb{} + sysCfgDb.Set() + uid := "0" + tpdarenAppidData, _ := sysCfgDb.MasterListCfgGetOne(uid, "tpdaren_appid") + tpdarenAppsecretData, _ := sysCfgDb.MasterListCfgGetOne(uid, "tpdaren_appsecret") + if tpdarenAppidData == nil || tpdarenAppsecretData == nil { + return + } + token := svc2.GetTpdarenToken(uid) + var res = map[string]string{"word": ""} + if token == "" { + e.OutSuc(c, res, nil) + return + } + param := map[string]interface{}{ + "theater_id": utils.StrToInt(args["theater_id"]), + "episode": utils.StrToInt(args["episode"]), + "message_id": args["message_id"], + } + paging, _ := tpdaren.ShortLinkCreate(token, param) + if gjson.Get(paging, "data").String() != "" { + res["word"] = gjson.Get(paging, "data").String() + } + e.OutSuc(c, res, nil) + return +} diff --git a/app/router/router.go b/app/router/router.go index bbf2c90..9feb1d4 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -49,6 +49,7 @@ func routeInternal(r *gin.RouterGroup) { r.Use(mw.DB) // 以下接口需要用到数据库 { r.POST("/playlet_order", internalHdl.GetPlayletOrder) + r.POST("/playlet_short_link", internalHdl.GetShortLink) } r.Use(mw.Checker) // 以下接口需要检查Header: platform diff --git a/go.mod b/go.mod index e26ccf7..f9af474 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20230707081910-52e70aa52998 - code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20230703061209-fc6ac71cc155 + code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20230805060535-47d3fd8bc8d7 github.com/360EntSecGroup-Skylar/excelize v1.4.1 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/boombuler/barcode v1.0.1