signature_gen_handler.go 689 B

12345678910111213141516171819202122232425262728293031
  1. package xiaoice
  2. import (
  3. "net/http"
  4. "github.com/zeromicro/go-zero/rest/httpx"
  5. "wechat-api/internal/logic/xiaoice"
  6. "wechat-api/internal/svc"
  7. )
  8. // swagger:route post /api/xiaoice/signature xiaoice SignatureGen
  9. //
  10. // get xiaoice signature | 获取小冰签名
  11. //
  12. // get xiaoice signature | 获取小冰签名
  13. //
  14. // Responses:
  15. // 200: SignatureResp
  16. func SignatureGenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  17. return func(w http.ResponseWriter, r *http.Request) {
  18. l := xiaoice.NewSignatureGenLogic(r.Context(), svcCtx)
  19. resp, err := l.SignatureGen()
  20. if err != nil {
  21. httpx.ErrorCtx(r.Context(), w, err)
  22. } else {
  23. httpx.OkJsonCtx(r.Context(), w, resp)
  24. }
  25. }
  26. }