refreshauthkuaishou.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "youngee_m_api/consts"
  5. "youngee_m_api/model/http_model"
  6. )
  7. func WrapRefreshAuthorizationHandler(ctx *gin.Context) {
  8. handler := newRefreshAuthorizationHandler(ctx)
  9. BaseRun(handler)
  10. }
  11. type RefreshAuthorizationHandler struct {
  12. ctx *gin.Context
  13. req *http_model.RefreshAuthorizationRequest
  14. resp *http_model.CommonResponse
  15. }
  16. func (c RefreshAuthorizationHandler) getContext() *gin.Context { return c.ctx }
  17. func (c RefreshAuthorizationHandler) getResponse() interface{} { return c.resp }
  18. func (c RefreshAuthorizationHandler) getRequest() interface{} {
  19. return c.req
  20. }
  21. func (c RefreshAuthorizationHandler) run() {
  22. data := http_model.RefreshAuthorizationRequest{}
  23. data = *c.req
  24. res := http_model.RefreshAuthkuaishouResponse{
  25. Url: "https://open.kuaishou.com/oauth2/connect?app_id=ks651333097154138217&redirect_uri=https://younggee.com/kuaishouauth&scope=merchant_distribution,merchant_refund,merchant_item,merchant_order,user_info,merchant_servicemarket,merchant_user,merchant_logistics&response_type=code&state=" + data.PhoneNumber,
  26. }
  27. c.resp.Message = "已返回授权码"
  28. c.resp.Status = consts.ErrorSuccess
  29. c.resp.Data = res
  30. }
  31. func (c RefreshAuthorizationHandler) checkParam() error {
  32. return nil
  33. }
  34. func newRefreshAuthorizationHandler(ctx *gin.Context) *RefreshAuthorizationHandler {
  35. return &RefreshAuthorizationHandler{
  36. ctx: ctx,
  37. req: http_model.NewRefreshAuthorizationRequest(),
  38. resp: http_model.NewRefreshAuthorizationResponse(),
  39. }
  40. }