Pārlūkot izejas kodu

修改包名wechat-eta_mini_ht_api

kobe6258 8 mēneši atpakaļ
vecāks
revīzija
e830de3e07

+ 2 - 2
component/cache/redis.go

@@ -2,12 +2,12 @@ package cache
 
 import (
 	"context"
+	logger "eta_mini_ht_api/component/log"
+	redisConfig "eta_mini_ht_api/config"
 	"github.com/go-redis/redis/v8"
 	"log"
 	"strings"
 	"time"
-	logger "wechat/component/log"
-	redisConfig "wechat/config"
 )
 
 func GetInstance(config string) (redisCache *RedisCache, err error) {

+ 2 - 2
component/component.go

@@ -1,6 +1,6 @@
 package component
 
 import (
-	_ "wechat/component/cache"
-	_ "wechat/component/log"
+	_ "eta_mini_ht_api/component/cache"
+	_ "eta_mini_ht_api/component/log"
 )

+ 1 - 1
component/log/log_plugin.go

@@ -2,12 +2,12 @@ package logger
 
 import (
 	"encoding/json"
+	stringUtils "eta_mini_ht_api/common/utils"
 	"fmt"
 	"github.com/beego/beego/v2/core/logs"
 	"log"
 	"os"
 	"path"
-	stringUtils "wechat/common/utils"
 )
 
 const (

+ 1 - 1
controllers/user.go

@@ -1,7 +1,7 @@
 package controllers
 
 import (
-	"wechat/models"
+	"eta_mini_ht_api/models"
 
 	beego "github.com/beego/beego/v2/server/web"
 )

+ 1 - 1
go.mod

@@ -1,4 +1,4 @@
-module wechat
+module eta_mini_ht_api
 
 go 1.21
 

+ 5 - 5
main.go

@@ -1,12 +1,12 @@
 package main
 
 import (
+	"eta_mini_ht_api/common/exception/panic_recover"
+	_ "eta_mini_ht_api/component"
+	logger "eta_mini_ht_api/component/log"
+	"eta_mini_ht_api/middleware"
+	_ "eta_mini_ht_api/routers"
 	"github.com/beego/beego/v2/server/web"
-	"wechat/common/exception/panic_recover"
-	_ "wechat/component"
-	logger "wechat/component/log"
-	"wechat/middleware"
-	_ "wechat/routers"
 )
 
 func main() {

+ 1 - 10
routers/commentsRouter.go

@@ -7,16 +7,7 @@ import (
 
 func init() {
 
-    beego.GlobalControllerRouter["wechat/controllers/app:WechatController"] = append(beego.GlobalControllerRouter["wechat/controllers/app:WechatController"],
-        beego.ControllerComments{
-            Method: "GetUserInfo",
-            Router: `/getUserInfo`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["wechat/controllers:UserController"] = append(beego.GlobalControllerRouter["wechat/controllers:UserController"],
+    beego.GlobalControllerRouter["eta_mini_ht_api/controllers:UserController"] = append(beego.GlobalControllerRouter["eta_mini_ht_api/controllers:UserController"],
         beego.ControllerComments{
             Method: "GetAll",
             Router: `/`,

+ 1 - 1
routers/router.go

@@ -1,8 +1,8 @@
 package routers
 
 import (
+	"eta_mini_ht_api/controllers"
 	beego "github.com/beego/beego/v2/server/web"
-	"wechat/controllers"
 )
 
 func init() {

+ 71 - 0
swagger/swagger.json

@@ -0,0 +1,71 @@
+{
+    "swagger": "2.0",
+    "info": {
+        "contact": {}
+    },
+    "basePath": "/v1",
+    "paths": {
+        "/user/": {
+            "get": {
+                "tags": [
+                    "user"
+                ],
+                "description": "get all Users\n\u003cbr\u003e",
+                "operationId": "UserController.GetAll",
+                "responses": {
+                    "200": {
+                        "description": "",
+                        "schema": {
+                            "$ref": "#/definitions/models.User"
+                        }
+                    }
+                }
+            }
+        }
+    },
+    "definitions": {
+        "models.Profile": {
+            "title": "Profile",
+            "type": "object",
+            "properties": {
+                "Address": {
+                    "type": "string"
+                },
+                "Age": {
+                    "type": "integer",
+                    "format": "int64"
+                },
+                "Email": {
+                    "type": "string"
+                },
+                "Gender": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.User": {
+            "title": "User",
+            "type": "object",
+            "properties": {
+                "Id": {
+                    "type": "string"
+                },
+                "Password": {
+                    "type": "string"
+                },
+                "Profile": {
+                    "$ref": "#/definitions/models.Profile"
+                },
+                "Username": {
+                    "type": "string"
+                }
+            }
+        }
+    },
+    "tags": [
+        {
+            "name": "user",
+            "description": "Operations about Users\n"
+        }
+    ]
+}

+ 47 - 0
swagger/swagger.yml

@@ -0,0 +1,47 @@
+swagger: "2.0"
+info: {}
+basePath: /v1
+paths:
+  /user/:
+    get:
+      tags:
+      - user
+      description: |-
+        get all Users
+        <br>
+      operationId: UserController.GetAll
+      responses:
+        "200":
+          description: ""
+          schema:
+            $ref: '#/definitions/models.User'
+definitions:
+  models.Profile:
+    title: Profile
+    type: object
+    properties:
+      Address:
+        type: string
+      Age:
+        type: integer
+        format: int64
+      Email:
+        type: string
+      Gender:
+        type: string
+  models.User:
+    title: User
+    type: object
+    properties:
+      Id:
+        type: string
+      Password:
+        type: string
+      Profile:
+        $ref: '#/definitions/models.Profile'
+      Username:
+        type: string
+tags:
+- name: user
+  description: |
+    Operations about Users