智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. package hdl
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/svc"
  6. svc2 "applet/app/task/svc"
  7. "applet/app/utils"
  8. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tpdaren"
  9. "github.com/gin-gonic/gin"
  10. "github.com/tidwall/gjson"
  11. )
  12. func GetPlayletOrder(c *gin.Context) {
  13. svc.GetPlayletOrder(c)
  14. }
  15. func GetShortLink(c *gin.Context) {
  16. var args map[string]string
  17. if err := c.ShouldBindJSON(&args); err != nil {
  18. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  19. return
  20. }
  21. sysCfgDb := db.MasterListCfgDb{}
  22. sysCfgDb.Set()
  23. uid := "0"
  24. tpdarenAppidData, _ := sysCfgDb.MasterListCfgGetOne(uid, "tpdaren_appid")
  25. tpdarenAppsecretData, _ := sysCfgDb.MasterListCfgGetOne(uid, "tpdaren_appsecret")
  26. if tpdarenAppidData == nil || tpdarenAppsecretData == nil {
  27. return
  28. }
  29. token := svc2.GetTpdarenToken(uid)
  30. var res = map[string]string{"word": ""}
  31. if token == "" {
  32. e.OutSuc(c, res, nil)
  33. return
  34. }
  35. param := map[string]interface{}{
  36. "theater_id": utils.StrToInt(args["theater_id"]),
  37. "episode": utils.StrToInt(args["episode"]),
  38. "message_id": args["message_id"],
  39. }
  40. paging, _ := tpdaren.ShortLinkCreate(token, param)
  41. if gjson.Get(paging, "data").String() != "" {
  42. res["word"] = gjson.Get(paging, "data").String()
  43. }
  44. e.OutSuc(c, res, nil)
  45. return
  46. }