作者 tangxvhui

调试接口

@@ -3,13 +3,14 @@ package main @@ -3,13 +3,14 @@ package main
3 import ( 3 import (
4 "context" 4 "context"
5 "flag" 5 "flag"
  6 + "net/http"
  7 + "strings"
  8 +
6 "github.com/zeromicro/go-zero/rest/httpx" 9 "github.com/zeromicro/go-zero/rest/httpx"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" 12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
11 - "net/http"  
12 - "strings"  
13 14
14 "github.com/golang-jwt/jwt/v4/request" 15 "github.com/golang-jwt/jwt/v4/request"
15 "github.com/zeromicro/go-zero/core/conf" 16 "github.com/zeromicro/go-zero/core/conf"
@@ -65,7 +66,8 @@ func systemSetup(c config.Config) { @@ -65,7 +66,8 @@ func systemSetup(c config.Config) {
65 66
66 // 默认的token头 Authorization 修改为 x-mmm-accesstoken 67 // 默认的token头 Authorization 修改为 x-mmm-accesstoken
67 request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{ 68 request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{
68 - request.HeaderExtractor{"x-mmm-accesstoken"}, func(tok string) (string, error) { 69 + Extractor: request.HeaderExtractor{"x-mmm-accesstoken"},
  70 + Filter: func(tok string) (string, error) {
69 // Should be a bearer token 71 // Should be a bearer token
70 if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " { 72 if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
71 return tok[7:], nil 73 return tok[7:], nil
@@ -130,7 +130,7 @@ type ( @@ -130,7 +130,7 @@ type (
130 type ( 130 type (
131 MiniSetUserLikeRequset { 131 MiniSetUserLikeRequset {
132 ArticleId int64 `json:"articleId"` //文章id 132 ArticleId int64 `json:"articleId"` //文章id
133 - CommentId int64 `json:"commentId"` //评论id 133 + CommentId int64 `json:"commentId,optional"` //评论id
134 UserId int64 `json:",optional"` //操作人 134 UserId int64 `json:",optional"` //操作人
135 Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞 135 Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
136 } 136 }
@@ -7,7 +7,7 @@ Timeout: 30000 @@ -7,7 +7,7 @@ Timeout: 30000
7 # CertFile: ./key/fjmaimaimai.com_bundle.crt 7 # CertFile: ./key/fjmaimaimai.com_bundle.crt
8 # KeyFile: ./key/fjmaimaimai.com.key 8 # KeyFile: ./key/fjmaimaimai.com.key
9 Log: 9 Log:
10 - #Mode: file 10 + Mode: file
11 Encoding: plain 11 Encoding: plain
12 Level: debug # info 12 Level: debug # info
13 MaxSize: 1 # 2MB 13 MaxSize: 1 # 2MB
@@ -36,4 +36,4 @@ ApiAuth: @@ -36,4 +36,4 @@ ApiAuth:
36 36
37 Wechat: 37 Wechat:
38 AppID: wxae5b305849343ec8 38 AppID: wxae5b305849343ec8
39 - AppSecret: f584adb68f7d784425b60e1ebb2ffd4b  
  39 + AppSecret: f584adb68f7d784425b60e1ebb2ffd4b
@@ -869,10 +869,10 @@ type WhichUserLikeArticle struct { @@ -869,10 +869,10 @@ type WhichUserLikeArticle struct {
869 } 869 }
870 870
871 type MiniSetUserLikeRequset struct { 871 type MiniSetUserLikeRequset struct {
872 - ArticleId int64 `json:"articleId"` //文章id  
873 - CommentId int64 `json:"commentId"` //评论id  
874 - UserId int64 `json:",optional"` //操作人  
875 - Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞 872 + ArticleId int64 `json:"articleId"` //文章id
  873 + CommentId int64 `json:"commentId,optional"` //评论id
  874 + UserId int64 `json:",optional"` //操作人
  875 + Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
876 } 876 }
877 877
878 type MiniSetUserLikeResponse struct { 878 type MiniSetUserLikeResponse struct {