Browse Source

物联智控平台

huangyan 11 months ago
commit
f215153d88

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 9 - 0
.idea/lot_interlligentControl.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="Go" enabled="true" />
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/lot_interlligentControl.iml" filepath="$PROJECT_DIR$/.idea/lot_interlligentControl.iml" />
+    </modules>
+  </component>
+</project>

+ 92 - 0
app/controller/v1/admin/admin.go

@@ -0,0 +1,92 @@
+package admin
+
+import (
+	"errors"
+	"github.com/gin-gonic/gin"
+	"github.com/go-playground/validator"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/app/services"
+	"lot_interlligentControl/app/services/imp"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+	"lot_interlligentControl/utils"
+	"strconv"
+)
+
+var shop services.Shop = &imp.Shop{}
+
+// AdminGetAudit
+// @Tags 管理员
+// @Summary 管理员审核状态
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Param state query string true "状态"
+// @Accept application/json
+// @Router /admin/auditState [put]
+func AdminGetAudit(c *gin.Context) {
+	value := c.Query("id")
+	value1 := c.Query("state")
+	validate := validator.New()
+	err := validate.Var(value, "required,numeric")
+	err = validate.Var(value1, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	uId := utils.GetUId(c)
+	id, _ := strconv.Atoi(value)
+	state, _ := strconv.Atoi(value1)
+	auditState := shop.AuditState(uId, id, state)
+	if errors.Is(auditState, e.SUCCESS) {
+		e.ResponseSuccess(c, "审核成功")
+		return
+	}
+	e.ResponseWithMsg(c, auditState, "参数错误")
+}
+
+// GetServiceNodeAll
+// @Tags 管理员
+// @Summary 管理员查询所有节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /admin/serviceNode [post]
+func GetServiceNodeAll(c *gin.Context) {
+	var pages unity.PageParams
+	err := c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	result, total, err := unity.Paginate(pages, models.ServiceNodes{})
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, result, total, pages)
+}
+
+// GetAllShop
+// @Tags 管理员
+// @Summary 管理员查询所有店铺
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /admin/shop [get]
+func GetAllShop(c *gin.Context) {
+	var pages unity.PageParams
+	err := c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	result, total, err := unity.Paginate(pages, models.Shop{})
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, result, total, pages)
+}

+ 121 - 0
app/controller/v1/admin/producct.go

@@ -0,0 +1,121 @@
+package admin
+
+import (
+	"errors"
+	"github.com/gin-gonic/gin"
+	"github.com/go-playground/validator"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/app/services"
+	"lot_interlligentControl/app/services/imp"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+	"lot_interlligentControl/utils"
+	"strconv"
+)
+
+var product services.Product = &imp.Product{}
+
+// AddProduct
+// @Tags 管理员
+// @Summary 添加产品类型
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body models.ProductDto true "请求参数"
+// @Accept application/json
+// @Router /admin/product [post]
+func AddProduct(c *gin.Context) {
+	var produ models.ProductDto
+	err := c.ShouldBindJSON(&produ)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uid := utils.GetUId(c)
+	rescode := product.AddProduct(uid, produ)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "添加成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// UpdateProduct
+// @Tags 管理员
+// @Summary 修改产品类型
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body models.ProductDto true "请求参数"
+// @Param id query string true "id"
+// @Accept application/json
+// @Router /admin/product [put]
+func UpdateProduct(c *gin.Context) {
+	id := c.Query("id")
+	var produ models.ProductDto
+	validate := validator.New()
+	atoi, _ := strconv.Atoi(id)
+	err := c.ShouldBindJSON(&produ)
+	err = validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uId := utils.GetUId(c)
+	rescode := product.UpdateProduct(uId, atoi, produ)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "修改成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// GetAllProduct
+// @Tags 管理员
+// @Summary 查询所有类型
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /admin/productall [post]
+//func GetAllProduct(c *gin.Context) {
+//	var pages unity.PageParams
+//	err := c.ShouldBindJSON(&pages)
+//	if err != nil {
+//		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+//		return
+//	}
+//	result, total, err := unity.Paginate(pages, models.Product{})
+//	if err != nil {
+//		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+//		return
+//	}
+//	e.ResPonsePage(c, result, total, pages)
+//}
+
+// DeleteProductById
+// @Tags 管理员
+// @Summary 根据ID删除产品类型
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Accept application/json
+// @Router /admin/product [delete]
+func DeleteProductById(c *gin.Context) {
+	id := c.Query("id")
+	validate := validator.New()
+	err := validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	atoi, _ := strconv.Atoi(id)
+	_, rescode := unity.DeleteById(atoi, models.Product{})
+	if rescode != nil {
+		e.ResponseWithMsg(c, e.DeleteFail, e.DeleteFail.GetMsg())
+		return
+	}
+	e.ResponseSuccess(c, "删除成功")
+}

+ 139 - 0
app/controller/v1/serviceNode.go

@@ -0,0 +1,139 @@
+package v1
+
+import (
+	"errors"
+	"github.com/gin-gonic/gin"
+	"github.com/go-playground/validator"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/app/services"
+	"lot_interlligentControl/app/services/imp"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+	"lot_interlligentControl/utils"
+	"strconv"
+)
+
+var serviceNode services.ServiceNodes = &imp.ServiceNodes{}
+
+// GetServiceNodesById
+// @Tags 节点管理
+// @Summary 查询自己的所有节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /serviceNode [get]
+func GetServiceNodesById(c *gin.Context) {
+	var pages unity.PageParams
+	uId := utils.GetUId(c)
+	err := c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	result, total, err := unity.PaginateByID(uId, pages, models.ServiceNodes{})
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, result, total, pages)
+}
+
+// DeleteServiceNodesById
+// @Tags 节点管理
+// @Summary 根据Id删除节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Accept application/json
+// @Router /serviceNode [delete]
+func DeleteServiceNodesById(c *gin.Context) {
+	id := c.Query("id")
+	validate := validator.New()
+	err := validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	atoi, _ := strconv.Atoi(id)
+	_, rescode := unity.DeleteById(atoi, models.ServiceNodes{})
+	if rescode != nil {
+		e.ResponseWithMsg(c, e.DeleteFail, e.DeleteFail.GetMsg())
+		return
+	}
+	e.ResponseSuccess(c, "删除成功")
+}
+
+// AddServiceNode
+// @Tags 节点管理
+// @Summary 添加节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body models.ServiceNodesDto true "节点数据"
+// @Accept application/json
+// @Router /serviceNode [post]
+func AddServiceNode(c *gin.Context) {
+	var nodes models.ServiceNodesDto
+	err := c.ShouldBindJSON(&nodes)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uid := utils.GetUId(c)
+	rescode := serviceNode.AddServiceNodes(uid, nodes)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "添加成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// UpdateServiceNode
+// @Tags 节点管理
+// @Summary 修改节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Param req body models.ServiceNodesDto true "节点数据"
+// @Accept application/json
+// @Router /serviceNode [put]
+func UpdateServiceNode(c *gin.Context) {
+	id := c.Query("id")
+	var nodes models.ServiceNodesDto
+	validate := validator.New()
+	atoi, _ := strconv.Atoi(id)
+	err := c.ShouldBindJSON(&nodes)
+	err = validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uId := utils.GetUId(c)
+	rescode := serviceNode.UpdateServiceNodes(uId, atoi, nodes)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "修改成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// GetNode
+// @Tags 节点管理
+// @Summary 获取自己节点以及公开节点
+// @Success 200 {object}  []models.ServiceNodes
+// @Fail 400 {object}  e.R
+// @Accept application/json
+// @Router /getNode [get]
+func GetNode(c *gin.Context) {
+	uid := utils.GetUId(c)
+	node, rescode := serviceNode.GetNode(uid)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, node)
+		return
+	}
+	e.ResponseError(c, rescode)
+}

+ 177 - 0
app/controller/v1/shop.go

@@ -0,0 +1,177 @@
+package v1
+
+import (
+	"errors"
+	"github.com/gin-gonic/gin"
+	"github.com/go-playground/validator"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/app/services"
+	"lot_interlligentControl/app/services/imp"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+	"lot_interlligentControl/utils"
+	"strconv"
+)
+
+var shop services.Shop = &imp.Shop{}
+
+// AddShop
+// @Tags 店铺管理
+// @Summary 添加节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body models.ShopDto true "店铺数据"
+// @Accept application/json
+// @Router /shop [post]
+func AddShop(c *gin.Context) {
+	var shops models.ShopDto
+	err := c.ShouldBindJSON(&shops)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uid := utils.GetUId(c)
+	rescode := shop.AddShop(uid, shops)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "添加成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// DeleteShopById
+// @Tags 店铺管理
+// @Summary 根据Id删除节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Accept application/json
+// @Router /shop [delete]
+func DeleteShopById(c *gin.Context) {
+	id := c.Query("id")
+	validate := validator.New()
+	err := validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	atoi, _ := strconv.Atoi(id)
+	_, rescode := unity.DeleteById(atoi, models.Shop{})
+	if rescode != nil {
+		e.ResponseWithMsg(c, e.DeleteFail, e.DeleteFail.GetMsg())
+		return
+	}
+	e.ResponseSuccess(c, "删除成功")
+}
+
+// UpdateShop
+// @Tags 店铺管理
+// @Summary 修改节点
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param id query string true "id"
+// @Param req body models.ShopDto true "店铺数据"
+// @Accept application/json
+// @Router /shop [put]
+func UpdateShop(c *gin.Context) {
+	id := c.Query("id")
+	var shops models.ShopDto
+	validate := validator.New()
+	atoi, _ := strconv.Atoi(id)
+	err := c.ShouldBindJSON(&shops)
+	err = validate.Var(id, "required,numeric")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uId := utils.GetUId(c)
+	rescode := shop.UpdateShop(uId, atoi, shops)
+	if errors.Is(rescode, e.SUCCESS) {
+		e.ResponseSuccess(c, "修改成功")
+		return
+	}
+	e.ResponseError(c, rescode)
+}
+
+// GetShopById
+// @Tags 店铺管理
+// @Summary 获取自己的商品信息
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /shop [get]
+func GetShopById(c *gin.Context) {
+	var pages unity.PageParams
+	uId := utils.GetUId(c)
+	err := c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	result, total, err := unity.PaginateByID(uId, pages, models.Shop{})
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, result, total, pages)
+}
+
+// GetShopByName
+// @Tags 店铺管理
+// @Summary 根据商品名称模糊查询
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Param product_name query string true "product_name"
+// @Accept application/json
+// @Router /shopByName [get]
+func GetShopByName(c *gin.Context) {
+	value := c.Query("product_name")
+	var pages unity.PageParams
+	validate := validator.New()
+	err := validate.Var(value, "required")
+	if err != nil {
+		e.ResponseWithMsg(c, e.TheParameterCannotBeEmpty, e.TheParameterCannotBeEmpty.GetMsg())
+		return
+	}
+	err = c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	uId := utils.GetUId(c)
+	shops, total, err := shop.GetShopByName(uId, value, pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, shops, total, pages)
+}
+
+// GetAllProduct
+// @Tags 店铺管理
+// @Summary 查询所有类型
+// @Success 200 {object}  e.R
+// @Fail 400 {object}  e.R
+// @Param req body unity.PageParams true "分页数据"
+// @Accept application/json
+// @Router /productall [post]
+func GetAllProduct(c *gin.Context) {
+	var pages unity.PageParams
+	err := c.ShouldBindJSON(&pages)
+	if err != nil {
+		e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
+		return
+	}
+	result, total, err := unity.Paginate(pages, models.Product{})
+	if err != nil {
+		e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
+		return
+	}
+	e.ResPonsePage(c, result, total, pages)
+}

+ 46 - 0
app/e/R.go

@@ -0,0 +1,46 @@
+package e
+
+import (
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/unity"
+	"net/http"
+)
+
+type R struct {
+	Code    Rescode     `json:"code"`
+	Message any         `json:"message"`
+	Data    interface{} `json:"data"`
+}
+
+func ResponseError(c *gin.Context, code Rescode) {
+	c.JSON(http.StatusOK, &R{
+		Code:    code,
+		Message: code.GetMsg(),
+		Data:    nil,
+	})
+}
+func ResponseSuccess(c *gin.Context, data interface{}) {
+	c.JSON(http.StatusOK, &R{
+		Code:    SUCCESS,
+		Message: SUCCESS.GetMsg(),
+		Data:    data,
+	})
+}
+func ResponseWithMsg(c *gin.Context, code Rescode, msg any) {
+	c.JSON(http.StatusOK, &R{
+		Code:    code,
+		Message: msg,
+		Data:    nil,
+	})
+}
+func ResPonsePage(c *gin.Context, data interface{}, total int64, params unity.PageParams) {
+	c.JSON(http.StatusOK, &R{
+		Code:    SUCCESS,
+		Message: SUCCESS.GetMsg(),
+		Data: gin.H{
+			"result":    data,
+			"total":     total,
+			"page_size": params.Size,
+		},
+	})
+}

+ 72 - 0
app/e/code_msg.go

@@ -0,0 +1,72 @@
+package e
+
+type Rescode int64
+
+func (c Rescode) Error() string {
+	//TODO implement me
+	panic("implement me")
+}
+
+const (
+	SUCCESS Rescode = 200 + iota
+	ERROR
+)
+
+const (
+	TokenIsInvalid Rescode = 1001 + iota
+	TokenIsExpired
+	DELETEFAIL
+	UPDATEFAIL
+	FINDFAIL
+	DeleteFail
+	PaginationFailed
+	JSONParsingFailed
+	TheUserAlreadyExists
+	AlreadyExists
+	TheSystemIsAbnormal
+	CodeIsError
+	Theuseralreadyexists
+	ThePhoneNumberIsWrong
+	AnExceptionOccursWhenSendingAnSMSVerificationCode
+	TokenIsFaild
+	ThePasswordIsWrongOrThePhoneNumberIsIncorrect
+	HasSend
+	TheUserIsEmpty
+	TheParameterCannotBeEmpty
+)
+
+var MsgFlags = map[Rescode]string{
+	SUCCESS:                   "ok",
+	ERROR:                     "fail",
+	DELETEFAIL:                "删除失败",
+	TheUserAlreadyExists:      "用户已存在",
+	TheSystemIsAbnormal:       "系统异常",
+	CodeIsError:               "验证码错误",
+	UPDATEFAIL:                "更新失败",
+	Theuseralreadyexists:      "用户已存在",
+	JSONParsingFailed:         "json解析失败",
+	ThePhoneNumberIsWrong:     "手机号错误",
+	HasSend:                   "验证码已发送",
+	AlreadyExists:             "手机号已存在",
+	PaginationFailed:          "分页查询失败",
+	FINDFAIL:                  "查询失败",
+	DeleteFail:                "删除失败",
+	TheParameterCannotBeEmpty: "参数不能为空",
+	AnExceptionOccursWhenSendingAnSMSVerificationCode: "发送短信验证码出现异常",
+	ThePasswordIsWrongOrThePhoneNumberIsIncorrect:     "手机号或者密码错误",
+	TokenIsInvalid: "Token 无效",
+	TokenIsExpired: "Token 过期",
+	TokenIsFaild:   "Token 生成失败",
+	TheUserIsEmpty: "用户为空",
+}
+
+func (c Rescode) GetMsg() string {
+	// 检查Rescode是否在MsgFlags中定义,避免返回意外的消息
+	msg, ok := MsgFlags[c]
+	if ok {
+		return msg
+	} else {
+		// 如果Rescode无效,则返回错误消息
+		return MsgFlags[ERROR]
+	}
+}

+ 30 - 0
app/middlewares/admin_middleware.go

@@ -0,0 +1,30 @@
+package middlewares
+
+import (
+	"github.com/bytedance/sonic"
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/nats"
+	"time"
+)
+
+func AdminMiddleware() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		header := c.GetHeader("Authorization")
+		request, err := nats.Nats.Request("login_token_validation", []byte(header), 3*time.Second)
+		if err != nil {
+			e.ResponseWithMsg(c, e.TokenIsInvalid, e.TokenIsInvalid.GetMsg())
+		} else {
+			var response UserResponse
+			sonic.Unmarshal(request.Data, &response)
+			users := response.User.(map[string]interface{})
+			role := users["role"].(string)
+			if role == "admin" {
+				c.Next()
+			} else {
+				e.ResponseWithMsg(c, e.TokenIsInvalid, e.TokenIsInvalid.GetMsg())
+				c.Abort()
+			}
+		}
+	}
+}

+ 24 - 0
app/middlewares/cors.go

@@ -0,0 +1,24 @@
+package middlewares
+
+import (
+	"github.com/gin-gonic/gin"
+	"net/http"
+)
+
+func Cors() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		method := c.Request.Method
+		origin := c.Request.Header.Get("Origin")
+		if origin != "" {
+			c.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名
+			c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
+			c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
+			c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
+			c.Header("Access-Control-Allow-Credentials", "true")
+		}
+		if method == "OPTIONS" {
+			c.AbortWithStatus(http.StatusNoContent)
+		}
+		c.Next()
+	}
+}

+ 103 - 0
app/middlewares/log_middleware.go

@@ -0,0 +1,103 @@
+package middlewares
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	rotatelogs "github.com/lestrrat-go/file-rotatelogs"
+	"github.com/rifflock/lfshook"
+	"github.com/sirupsen/logrus"
+	"os"
+	"path"
+	"time"
+)
+
+// LoggerToFile 日志记录到文件
+func LoggerToFile() gin.HandlerFunc {
+
+	logFilePath := "./log/"
+	logFileName := "log"
+
+	// 日志文件
+	fileName := path.Join(logFilePath, logFileName)
+
+	// 写入文件
+	src, err := os.OpenFile(fileName, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
+	if err != nil {
+		fmt.Println("err", err)
+	}
+
+	// 实例化
+	logger := logrus.New()
+
+	// 设置输出
+	logger.Out = src
+
+	// 设置日志级别
+	logger.SetLevel(logrus.DebugLevel)
+
+	// 设置 rotatelogs
+	logWriter, err := rotatelogs.New(
+		// 分割后的文件名称
+		fileName+".%Y%m%d.log",
+
+		// 生成软链,指向最新日志文件
+		rotatelogs.WithLinkName(fileName),
+
+		// 设置最大保存时间(7天)
+		rotatelogs.WithMaxAge(7*24*time.Hour),
+
+		// 设置日志切割时间间隔(1天)
+		rotatelogs.WithRotationTime(24*time.Hour),
+	)
+
+	writeMap := lfshook.WriterMap{
+		logrus.InfoLevel:  logWriter,
+		logrus.FatalLevel: logWriter,
+		logrus.DebugLevel: logWriter,
+		logrus.WarnLevel:  logWriter,
+		logrus.ErrorLevel: logWriter,
+		logrus.PanicLevel: logWriter,
+	}
+
+	lfHook := lfshook.NewHook(writeMap, &logrus.JSONFormatter{
+		TimestampFormat: "2006-01-02 15:04:05",
+	})
+
+	// 新增 Hook
+	logger.AddHook(lfHook)
+
+	return func(c *gin.Context) {
+		// 开始时间
+		startTime := time.Now()
+
+		// 处理请求
+		c.Next()
+
+		// 结束时间
+		endTime := time.Now()
+
+		// 执行时间
+		latencyTime := endTime.Sub(startTime)
+
+		// 请求方式
+		reqMethod := c.Request.Method
+
+		// 请求路由
+		reqUri := c.Request.RequestURI
+
+		// 状态码
+		statusCode := c.Writer.Status()
+
+		// 请求IP
+		clientIP := c.ClientIP()
+
+		// 日志格式
+		logger.WithFields(logrus.Fields{
+			"status_code":  statusCode,
+			"latency_time": latencyTime,
+			"client_ip":    clientIP,
+			"req_method":   reqMethod,
+			"req_uri":      reqUri,
+		}).Info()
+	}
+}

+ 35 - 0
app/middlewares/login_middleware.go

@@ -0,0 +1,35 @@
+package middlewares
+
+import (
+	"github.com/bytedance/sonic"
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/nats"
+	"time"
+)
+
+type UserResponse struct {
+	Code    int    `json:"code"`
+	Message string `json:"message"`
+	User    any    `json:"user,omitempty"`
+}
+
+func LoginMiddleware() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		header := c.GetHeader("Authorization")
+		request, err := nats.Nats.Request("login_token_validation", []byte(header), 3*time.Second)
+		if err != nil {
+			e.ResponseWithMsg(c, e.TokenIsInvalid, e.TokenIsInvalid.GetMsg())
+		} else {
+			var response UserResponse
+			sonic.Unmarshal(request.Data, &response)
+			if response.Code == 200 {
+				c.Set("user", response.User)
+				c.Next()
+			} else {
+				e.ResponseWithMsg(c, e.TokenIsInvalid, e.TokenIsInvalid.GetMsg())
+				c.Abort()
+			}
+		}
+	}
+}

+ 23 - 0
app/router.go

@@ -0,0 +1,23 @@
+package app
+
+import (
+	"github.com/gin-gonic/gin"
+	swaggerFiles "github.com/swaggo/files"
+	ginSwagger "github.com/swaggo/gin-swagger"
+	"lot_interlligentControl/app/middlewares"
+	"lot_interlligentControl/app/routers"
+	_ "lot_interlligentControl/docs"
+	"lot_interlligentControl/global"
+)
+
+func InitRouter() error {
+	engine := gin.New()
+	engine.GET("/swagger/*any", ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "NAME_OF_ENV_VARIABLE"))
+	engine.Use(middlewares.LoggerToFile())
+	engine.Use(middlewares.Cors())
+	engine.Use(middlewares.LoginMiddleware())
+	routers.ShopInItRouter(engine)
+	routers.ServiceNodeRouter(engine)
+	routers.AdminInirRouter(engine)
+	return engine.Run(global.ServerSetting.Port)
+}

+ 18 - 0
app/routers/admin.go

@@ -0,0 +1,18 @@
+package routers
+
+import (
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/app/controller/v1/admin"
+	"lot_interlligentControl/app/middlewares"
+)
+
+func AdminInirRouter(r *gin.Engine) {
+	group := r.Group("/api/admin")
+	group.Use(middlewares.AdminMiddleware())
+	group.POST("/shopAll", admin.GetAllShop)
+	group.PUT("/auditState", admin.AdminGetAudit)
+	group.POST("/serviceNodeall", admin.GetServiceNodeAll)
+	group.DELETE("/product", admin.DeleteProductById)
+	group.POST("/product", admin.AddProduct)
+	group.PUT("/product", admin.UpdateProduct)
+}

+ 15 - 0
app/routers/serviceNode.go

@@ -0,0 +1,15 @@
+package routers
+
+import (
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/app/controller/v1"
+)
+
+func ServiceNodeRouter(r *gin.Engine) {
+	group := r.Group("/api")
+	group.GET("/serviceNode", v1.GetServiceNodesById)
+	group.DELETE("/serviceNode", v1.DeleteServiceNodesById)
+	group.PUT("/serviceNode", v1.UpdateServiceNode)
+	group.POST("/serviceNode", v1.AddServiceNode)
+	group.GET("/getNode", v1.GetNode)
+}

+ 17 - 0
app/routers/shop.go

@@ -0,0 +1,17 @@
+package routers
+
+import (
+	"github.com/gin-gonic/gin"
+	"lot_interlligentControl/app/controller/v1"
+)
+
+func ShopInItRouter(r *gin.Engine) {
+	group := r.Group("/api")
+	group.POST("/shop", v1.AddShop)
+	group.DELETE("/shop", v1.DeleteShopById)
+	group.PUT("/shop", v1.UpdateShop)
+	group.GET("/shop", v1.GetShopById)
+	group.GET("/shopByName", v1.GetShopByName)
+	group.POST("/productall", v1.GetAllProduct)
+
+}

+ 33 - 0
app/services/imp/product_imp.go

@@ -0,0 +1,33 @@
+package imp
+
+import (
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/global"
+	"lot_interlligentControl/models"
+)
+
+type Product struct{}
+
+func (p Product) UpdateProduct(uid, id int, product models.ProductDto) e.Rescode {
+	//TODO implement me
+	tx := global.DBLink.Model(&models.Product{}).Where("id = ?", id).Updates(models.Product{
+		ProductType: product.ProductType,
+		CreateBy:    uid,
+	})
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}
+
+func (p Product) AddProduct(uid int, product models.ProductDto) e.Rescode {
+	//TODO implement me
+	var produ models.Product
+	produ.ProductType = product.ProductType
+	produ.CreateBy = uid
+	tx := global.DBLink.Create(&produ)
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}

+ 50 - 0
app/services/imp/serviceNode_imp.go

@@ -0,0 +1,50 @@
+package imp
+
+import (
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/global"
+	"lot_interlligentControl/models"
+)
+
+type ServiceNodes struct{}
+
+func (s ServiceNodes) GetNode(uid int) ([]models.ServiceNodes, e.Rescode) {
+	//TODO implement me
+	var node []models.ServiceNodes
+	tx := global.DBLink.Where("id = ?", uid).Or("state=?", true).Find(&node)
+	if tx.RowsAffected > 0 {
+		return node, e.SUCCESS
+	}
+	return node, e.ERROR
+}
+
+func (s ServiceNodes) UpdateServiceNodes(uid, id int, nodes models.ServiceNodesDto) e.Rescode {
+	//TODO implement me
+
+	tx := global.DBLink.Where("id = ?", id).Updates(&models.ServiceNodes{
+		Address:  nodes.Address,
+		NodeName: nodes.NodeName,
+		Tokey:    nodes.Tokey,
+		State:    nodes.State,
+		CreateBy: uid,
+	})
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}
+
+func (s ServiceNodes) AddServiceNodes(uid int, nodes models.ServiceNodesDto) e.Rescode {
+	//TODO implement me
+	var nodesModel models.ServiceNodes
+	nodesModel.Address = nodes.Address
+	nodesModel.NodeName = nodes.NodeName
+	nodesModel.Tokey = nodes.Tokey
+	nodesModel.State = true
+	nodesModel.CreateBy = uid
+	tx := global.DBLink.Create(&nodesModel)
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}

+ 83 - 0
app/services/imp/shop_imp.go

@@ -0,0 +1,83 @@
+package imp
+
+import (
+	"fmt"
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/global"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+)
+
+type Shop struct{}
+
+func (s Shop) AuditState(uid, id, state int) e.Rescode {
+	//TODO implement me
+	tx := global.DBLink.Model(models.Shop{}).
+		Where("id = ?", id).
+		Updates(&models.Shop{
+			ProductState: state,
+			CreateBy:     uid,
+		})
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}
+
+func (s Shop) GetShopByName(uid int, productName string, params unity.PageParams) ([]models.Shop, int64, error) {
+	//TODO implement me
+	var shop []models.Shop
+	var count int64
+	if err := global.DBLink.Model(models.Shop{}).
+		Where("product_name LIKE ?", fmt.Sprintf("%s%s%s", "%", productName, "%")).
+		Where("create_by = ?", uid).
+		Count(&count).Error; err != nil {
+		return nil, 0, err
+	}
+	// 计算偏移量并设置分页大小
+	offset := (params.Page - 1) * params.Size
+	// 执行实际分页查询
+	if err := global.DBLink.
+		Where("product_name LIKE ?", fmt.Sprintf("%s%s%s", "%", productName, "%")).
+		Where("create_by = ?", uid).
+		Offset(offset).Limit(params.Size).
+		Order(params.Desc).
+		Find(&shop).Error; err != nil {
+		return nil, 0, err
+	}
+	return shop, count, nil
+}
+
+func (s Shop) UpdateShop(uid, id int, shop models.ShopDto) e.Rescode {
+	//TODO implement me
+	tx := global.DBLink.Where("id = ?", id).Model(&models.Shop{}).Updates(map[string]interface{}{
+		"product_avatar":      shop.ProductAvatar,
+		"product_name":        shop.ProductName,
+		"product_price":       shop.ProductPrice,
+		"product_description": shop.ProductDescription,
+		"product_type":        shop.ProductType,
+		"create_by":           uid,
+		"product_state":       0,
+	})
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}
+
+func (s Shop) AddShop(uid int, shop models.ShopDto) e.Rescode {
+	//TODO implement me
+	var shops models.Shop
+	shops.ProductAvatar = shop.ProductAvatar
+	shops.ProductType = shop.ProductType
+	shops.ProductDescription = shop.ProductDescription
+	shops.ProductPrice = shop.ProductPrice
+	shops.ProductName = shop.ProductName
+	shops.CreateBy = uid
+	shops.ProductState = 0
+	tx := global.DBLink.Create(&shops)
+	if tx.RowsAffected > 0 {
+		return e.SUCCESS
+	}
+	return e.ERROR
+}

+ 11 - 0
app/services/product_service.go

@@ -0,0 +1,11 @@
+package services
+
+import (
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/models"
+)
+
+type Product interface {
+	AddProduct(uid int, product models.ProductDto) e.Rescode
+	UpdateProduct(uid, id int, product models.ProductDto) e.Rescode
+}

+ 12 - 0
app/services/serviceNode_service.go

@@ -0,0 +1,12 @@
+package services
+
+import (
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/models"
+)
+
+type ServiceNodes interface {
+	AddServiceNodes(uid int, nodes models.ServiceNodesDto) e.Rescode
+	UpdateServiceNodes(uid, id int, nodes models.ServiceNodesDto) e.Rescode
+	GetNode(uid int) ([]models.ServiceNodes, e.Rescode)
+}

+ 14 - 0
app/services/shop_service.go

@@ -0,0 +1,14 @@
+package services
+
+import (
+	"lot_interlligentControl/app/e"
+	"lot_interlligentControl/models"
+	"lot_interlligentControl/unity"
+)
+
+type Shop interface {
+	AddShop(uid int, shop models.ShopDto) e.Rescode
+	UpdateShop(uid, id int, shop models.ShopDto) e.Rescode
+	GetShopByName(uid int, productName string, params unity.PageParams) ([]models.Shop, int64, error)
+	AuditState(uid, id int, state int) e.Rescode
+}

+ 42 - 0
configs/config.yaml

@@ -0,0 +1,42 @@
+database:
+  # 数据库类型
+  dialect: mysql
+  # host地址
+  host: 127.0.0.1
+  # 端口
+  port: 3306
+  # 数据库名称
+  db: lot_interlligentcontrol
+  # 数据库用户名
+  userName: root
+  # 数据库密码
+  password: 123456
+  # 其他配置参数
+  otherParams: charset=utf8mb4&parseTime=True&loc=Local
+  # 最大空闲连接数
+  maxIdleConn: 20
+  # 最大连接数
+  maxOpenConn: 200
+  # 连接超时关闭时间,单位:秒
+  connMaxLifetime: 60
+jwt:
+  secret: "xxxxx"
+  refresh_expire: 168
+  Issuer: "lc_oauth"
+# 服务相关配置
+server:
+  # 启动模式 debug、release
+  mode: debug
+  # http服务信息
+  insecureServingInfo:
+  # 监听端口
+  port: ":8081"
+subMail:
+  appid: "97173"
+  signature: "f639a60e41ee0554921d89884f5ff87e"
+redis:
+  addr: "192.168.0.100:6379"
+  password: ""
+  db: 0
+nats:
+  NatsServer_Url: "nats://127.0.0.1:4222"

+ 46 - 0
configs/setting.go

@@ -0,0 +1,46 @@
+package global
+
+import "github.com/spf13/viper"
+
+type Settings struct {
+	vp *viper.Viper
+}
+
+var sections = make(map[string]interface{})
+
+// NewSetting 读取配置
+func NewSetting() (*Settings, error) {
+	vp := viper.New()
+	vp.SetConfigName("config")
+	vp.AddConfigPath("configs")
+	vp.SetConfigType("yaml")
+	err := vp.ReadInConfig()
+	if err != nil {
+		return nil, err
+	}
+	s := &Settings{vp}
+	return s, nil
+}
+
+// ReadSection 读取指定的一段
+func (s *Settings) ReadSection(k string, v interface{}) error {
+	err := s.vp.UnmarshalKey(k, v)
+	if err != nil {
+		return err
+	}
+	if _, ok := sections[k]; !ok {
+		sections[k] = v
+	}
+	return nil
+}
+
+// ReloadAllSection 重新加载
+func (s *Settings) ReloadAllSection() error {
+	for k, v := range sections {
+		err := s.ReadSection(k, v)
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+}

+ 744 - 0
docs/docs.go

@@ -0,0 +1,744 @@
+// Code generated by swaggo/swag. DO NOT EDIT
+package docs
+
+import "github.com/swaggo/swag"
+
+const docTemplate = `{
+    "schemes": {{ marshal .Schemes }},
+    "swagger": "2.0",
+    "info": {
+        "description": "{{escape .Description}}",
+        "title": "{{.Title}}",
+        "contact": {},
+        "version": "{{.Version}}"
+    },
+    "host": "{{.Host}}",
+    "basePath": "{{.BasePath}}",
+    "paths": {
+        "/admin/auditState": {
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员审核状态",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "状态",
+                        "name": "state",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/product": {
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "修改产品类型",
+                "parameters": [
+                    {
+                        "description": "请求参数",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ProductDto"
+                        }
+                    },
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "添加产品类型",
+                "parameters": [
+                    {
+                        "description": "请求参数",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ProductDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "根据ID删除产品类型",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/serviceNode": {
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员查询所有节点",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/shop": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员查询所有店铺",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/getNode": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "获取自己节点以及公开节点",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ServiceNodes"
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        "/productall": {
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "查询所有类型",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/serviceNode": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "查询自己的所有节点",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "修改节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "description": "节点数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ServiceNodesDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "添加节点",
+                "parameters": [
+                    {
+                        "description": "节点数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ServiceNodesDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "根据Id删除节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/shop": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "获取自己的商品信息",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "修改节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "description": "店铺数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ShopDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "添加节点",
+                "parameters": [
+                    {
+                        "description": "店铺数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ShopDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "根据Id删除节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/shopByName": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "根据商品名称模糊查询",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    },
+                    {
+                        "type": "string",
+                        "description": "product_name",
+                        "name": "product_name",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        }
+    },
+    "definitions": {
+        "e.R": {
+            "type": "object",
+            "properties": {
+                "code": {
+                    "$ref": "#/definitions/e.Rescode"
+                },
+                "data": {},
+                "message": {}
+            }
+        },
+        "e.Rescode": {
+            "type": "integer",
+            "enum": [
+                200,
+                201,
+                1001,
+                1002,
+                1003,
+                1004,
+                1005,
+                1006,
+                1007,
+                1008,
+                1009,
+                1010,
+                1011,
+                1012,
+                1013,
+                1014,
+                1015,
+                1016,
+                1017,
+                1018,
+                1019,
+                1020
+            ],
+            "x-enum-varnames": [
+                "SUCCESS",
+                "ERROR",
+                "TokenIsInvalid",
+                "TokenIsExpired",
+                "DELETEFAIL",
+                "UPDATEFAIL",
+                "FINDFAIL",
+                "DeleteFail",
+                "PaginationFailed",
+                "JSONParsingFailed",
+                "TheUserAlreadyExists",
+                "AlreadyExists",
+                "TheSystemIsAbnormal",
+                "CodeIsError",
+                "Theuseralreadyexists",
+                "ThePhoneNumberIsWrong",
+                "AnExceptionOccursWhenSendingAnSMSVerificationCode",
+                "TokenIsFaild",
+                "ThePasswordIsWrongOrThePhoneNumberIsIncorrect",
+                "HasSend",
+                "TheUserIsEmpty",
+                "TheParameterCannotBeEmpty"
+            ]
+        },
+        "gorm.DeletedAt": {
+            "type": "object",
+            "properties": {
+                "time": {
+                    "type": "string"
+                },
+                "valid": {
+                    "description": "Valid is true if Time is not NULL",
+                    "type": "boolean"
+                }
+            }
+        },
+        "models.ProductDto": {
+            "type": "object",
+            "required": [
+                "product_type"
+            ],
+            "properties": {
+                "product_type": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.ServiceNodes": {
+            "type": "object",
+            "properties": {
+                "address": {
+                    "description": "节点地址",
+                    "type": "string"
+                },
+                "create_by": {
+                    "type": "integer"
+                },
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "node_name": {
+                    "description": "节点名称",
+                    "type": "string"
+                },
+                "state": {
+                    "description": "0: 离线 1: 在线",
+                    "type": "boolean"
+                },
+                "tokey": {
+                    "description": "节点token",
+                    "type": "string"
+                },
+                "updatedAt": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.ServiceNodesDto": {
+            "type": "object",
+            "properties": {
+                "address": {
+                    "description": "节点地址",
+                    "type": "string"
+                },
+                "node_name": {
+                    "description": "节点名称",
+                    "type": "string"
+                },
+                "state": {
+                    "description": "0: 离线 1: 在线",
+                    "type": "boolean"
+                },
+                "tokey": {
+                    "description": "节点token",
+                    "type": "string"
+                }
+            }
+        },
+        "models.ShopDto": {
+            "type": "object",
+            "required": [
+                "product_avatar",
+                "product_description",
+                "product_name",
+                "product_price",
+                "product_type"
+            ],
+            "properties": {
+                "product_avatar": {
+                    "description": "产品图片",
+                    "type": "string"
+                },
+                "product_description": {
+                    "description": "产品描述",
+                    "type": "string"
+                },
+                "product_name": {
+                    "description": "产品名称",
+                    "type": "string"
+                },
+                "product_price": {
+                    "description": "产品价格",
+                    "type": "number"
+                },
+                "product_type": {
+                    "description": "产品类型",
+                    "type": "string"
+                }
+            }
+        },
+        "unity.PageParams": {
+            "type": "object",
+            "properties": {
+                "desc": {
+                    "type": "string"
+                },
+                "page": {
+                    "type": "integer"
+                },
+                "size": {
+                    "type": "integer"
+                }
+            }
+        }
+    },
+    "securityDefinitions": {
+        "": {
+            "type": "apiKey",
+            "name": "Authorization",
+            "in": "header"
+        }
+    }
+}`
+
+// SwaggerInfo holds exported Swagger Info so clients can modify it
+var SwaggerInfo = &swag.Spec{
+	Version:          "1.0",
+	Host:             "127.0.0.1:8081",
+	BasePath:         "/api",
+	Schemes:          []string{},
+	Title:            "物联智控平台",
+	Description:      "物联智控平台",
+	InfoInstanceName: "swagger",
+	SwaggerTemplate:  docTemplate,
+}
+
+func init() {
+	swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
+}

+ 722 - 0
docs/swagger.json

@@ -0,0 +1,722 @@
+{
+    "swagger": "2.0",
+    "info": {
+        "description": "物联智控平台",
+        "title": "物联智控平台",
+        "contact": {},
+        "version": "1.0"
+    },
+    "host": "127.0.0.1:8081",
+    "basePath": "/api",
+    "paths": {
+        "/admin/auditState": {
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员审核状态",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "状态",
+                        "name": "state",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/product": {
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "修改产品类型",
+                "parameters": [
+                    {
+                        "description": "请求参数",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ProductDto"
+                        }
+                    },
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "添加产品类型",
+                "parameters": [
+                    {
+                        "description": "请求参数",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ProductDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "根据ID删除产品类型",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/serviceNode": {
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员查询所有节点",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/admin/shop": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "管理员"
+                ],
+                "summary": "管理员查询所有店铺",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/getNode": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "获取自己节点以及公开节点",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ServiceNodes"
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        "/productall": {
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "查询所有类型",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/serviceNode": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "查询自己的所有节点",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "修改节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "description": "节点数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ServiceNodesDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "添加节点",
+                "parameters": [
+                    {
+                        "description": "节点数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ServiceNodesDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "节点管理"
+                ],
+                "summary": "根据Id删除节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/shop": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "获取自己的商品信息",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "put": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "修改节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "description": "店铺数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ShopDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "post": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "添加节点",
+                "parameters": [
+                    {
+                        "description": "店铺数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.ShopDto"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            },
+            "delete": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "根据Id删除节点",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        },
+        "/shopByName": {
+            "get": {
+                "consumes": [
+                    "application/json"
+                ],
+                "tags": [
+                    "店铺管理"
+                ],
+                "summary": "根据商品名称模糊查询",
+                "parameters": [
+                    {
+                        "description": "分页数据",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/unity.PageParams"
+                        }
+                    },
+                    {
+                        "type": "string",
+                        "description": "product_name",
+                        "name": "product_name",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/e.R"
+                        }
+                    }
+                }
+            }
+        }
+    },
+    "definitions": {
+        "e.R": {
+            "type": "object",
+            "properties": {
+                "code": {
+                    "$ref": "#/definitions/e.Rescode"
+                },
+                "data": {},
+                "message": {}
+            }
+        },
+        "e.Rescode": {
+            "type": "integer",
+            "enum": [
+                200,
+                201,
+                1001,
+                1002,
+                1003,
+                1004,
+                1005,
+                1006,
+                1007,
+                1008,
+                1009,
+                1010,
+                1011,
+                1012,
+                1013,
+                1014,
+                1015,
+                1016,
+                1017,
+                1018,
+                1019,
+                1020
+            ],
+            "x-enum-varnames": [
+                "SUCCESS",
+                "ERROR",
+                "TokenIsInvalid",
+                "TokenIsExpired",
+                "DELETEFAIL",
+                "UPDATEFAIL",
+                "FINDFAIL",
+                "DeleteFail",
+                "PaginationFailed",
+                "JSONParsingFailed",
+                "TheUserAlreadyExists",
+                "AlreadyExists",
+                "TheSystemIsAbnormal",
+                "CodeIsError",
+                "Theuseralreadyexists",
+                "ThePhoneNumberIsWrong",
+                "AnExceptionOccursWhenSendingAnSMSVerificationCode",
+                "TokenIsFaild",
+                "ThePasswordIsWrongOrThePhoneNumberIsIncorrect",
+                "HasSend",
+                "TheUserIsEmpty",
+                "TheParameterCannotBeEmpty"
+            ]
+        },
+        "gorm.DeletedAt": {
+            "type": "object",
+            "properties": {
+                "time": {
+                    "type": "string"
+                },
+                "valid": {
+                    "description": "Valid is true if Time is not NULL",
+                    "type": "boolean"
+                }
+            }
+        },
+        "models.ProductDto": {
+            "type": "object",
+            "required": [
+                "product_type"
+            ],
+            "properties": {
+                "product_type": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.ServiceNodes": {
+            "type": "object",
+            "properties": {
+                "address": {
+                    "description": "节点地址",
+                    "type": "string"
+                },
+                "create_by": {
+                    "type": "integer"
+                },
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "node_name": {
+                    "description": "节点名称",
+                    "type": "string"
+                },
+                "state": {
+                    "description": "0: 离线 1: 在线",
+                    "type": "boolean"
+                },
+                "tokey": {
+                    "description": "节点token",
+                    "type": "string"
+                },
+                "updatedAt": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.ServiceNodesDto": {
+            "type": "object",
+            "properties": {
+                "address": {
+                    "description": "节点地址",
+                    "type": "string"
+                },
+                "node_name": {
+                    "description": "节点名称",
+                    "type": "string"
+                },
+                "state": {
+                    "description": "0: 离线 1: 在线",
+                    "type": "boolean"
+                },
+                "tokey": {
+                    "description": "节点token",
+                    "type": "string"
+                }
+            }
+        },
+        "models.ShopDto": {
+            "type": "object",
+            "required": [
+                "product_avatar",
+                "product_description",
+                "product_name",
+                "product_price",
+                "product_type"
+            ],
+            "properties": {
+                "product_avatar": {
+                    "description": "产品图片",
+                    "type": "string"
+                },
+                "product_description": {
+                    "description": "产品描述",
+                    "type": "string"
+                },
+                "product_name": {
+                    "description": "产品名称",
+                    "type": "string"
+                },
+                "product_price": {
+                    "description": "产品价格",
+                    "type": "number"
+                },
+                "product_type": {
+                    "description": "产品类型",
+                    "type": "string"
+                }
+            }
+        },
+        "unity.PageParams": {
+            "type": "object",
+            "properties": {
+                "desc": {
+                    "type": "string"
+                },
+                "page": {
+                    "type": "integer"
+                },
+                "size": {
+                    "type": "integer"
+                }
+            }
+        }
+    },
+    "securityDefinitions": {
+        "": {
+            "type": "apiKey",
+            "name": "Authorization",
+            "in": "header"
+        }
+    }
+}

+ 489 - 0
docs/swagger.yaml

@@ -0,0 +1,489 @@
+basePath: /api
+definitions:
+  e.R:
+    properties:
+      code:
+        $ref: '#/definitions/e.Rescode'
+      data: {}
+      message: {}
+    type: object
+  e.Rescode:
+    enum:
+    - 200
+    - 201
+    - 1001
+    - 1002
+    - 1003
+    - 1004
+    - 1005
+    - 1006
+    - 1007
+    - 1008
+    - 1009
+    - 1010
+    - 1011
+    - 1012
+    - 1013
+    - 1014
+    - 1015
+    - 1016
+    - 1017
+    - 1018
+    - 1019
+    - 1020
+    type: integer
+    x-enum-varnames:
+    - SUCCESS
+    - ERROR
+    - TokenIsInvalid
+    - TokenIsExpired
+    - DELETEFAIL
+    - UPDATEFAIL
+    - FINDFAIL
+    - DeleteFail
+    - PaginationFailed
+    - JSONParsingFailed
+    - TheUserAlreadyExists
+    - AlreadyExists
+    - TheSystemIsAbnormal
+    - CodeIsError
+    - Theuseralreadyexists
+    - ThePhoneNumberIsWrong
+    - AnExceptionOccursWhenSendingAnSMSVerificationCode
+    - TokenIsFaild
+    - ThePasswordIsWrongOrThePhoneNumberIsIncorrect
+    - HasSend
+    - TheUserIsEmpty
+    - TheParameterCannotBeEmpty
+  gorm.DeletedAt:
+    properties:
+      time:
+        type: string
+      valid:
+        description: Valid is true if Time is not NULL
+        type: boolean
+    type: object
+  models.ProductDto:
+    properties:
+      product_type:
+        type: string
+    required:
+    - product_type
+    type: object
+  models.ServiceNodes:
+    properties:
+      address:
+        description: 节点地址
+        type: string
+      create_by:
+        type: integer
+      createdAt:
+        type: string
+      deletedAt:
+        $ref: '#/definitions/gorm.DeletedAt'
+      id:
+        type: integer
+      node_name:
+        description: 节点名称
+        type: string
+      state:
+        description: '0: 离线 1: 在线'
+        type: boolean
+      tokey:
+        description: 节点token
+        type: string
+      updatedAt:
+        type: string
+    type: object
+  models.ServiceNodesDto:
+    properties:
+      address:
+        description: 节点地址
+        type: string
+      node_name:
+        description: 节点名称
+        type: string
+      state:
+        description: '0: 离线 1: 在线'
+        type: boolean
+      tokey:
+        description: 节点token
+        type: string
+    type: object
+  models.ShopDto:
+    properties:
+      product_avatar:
+        description: 产品图片
+        type: string
+      product_description:
+        description: 产品描述
+        type: string
+      product_name:
+        description: 产品名称
+        type: string
+      product_price:
+        description: 产品价格
+        type: number
+      product_type:
+        description: 产品类型
+        type: string
+    required:
+    - product_avatar
+    - product_description
+    - product_name
+    - product_price
+    - product_type
+    type: object
+  unity.PageParams:
+    properties:
+      desc:
+        type: string
+      page:
+        type: integer
+      size:
+        type: integer
+    type: object
+host: 127.0.0.1:8081
+info:
+  contact: {}
+  description: 物联智控平台
+  title: 物联智控平台
+  version: "1.0"
+paths:
+  /admin/auditState:
+    put:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      - description: 状态
+        in: query
+        name: state
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 管理员审核状态
+      tags:
+      - 管理员
+  /admin/product:
+    delete:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 根据ID删除产品类型
+      tags:
+      - 管理员
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 请求参数
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ProductDto'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 添加产品类型
+      tags:
+      - 管理员
+    put:
+      consumes:
+      - application/json
+      parameters:
+      - description: 请求参数
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ProductDto'
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 修改产品类型
+      tags:
+      - 管理员
+  /admin/serviceNode:
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 管理员查询所有节点
+      tags:
+      - 管理员
+  /admin/shop:
+    get:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 管理员查询所有店铺
+      tags:
+      - 管理员
+  /getNode:
+    get:
+      consumes:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ServiceNodes'
+            type: array
+      summary: 获取自己节点以及公开节点
+      tags:
+      - 节点管理
+  /productall:
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 查询所有类型
+      tags:
+      - 店铺管理
+  /serviceNode:
+    delete:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 根据Id删除节点
+      tags:
+      - 节点管理
+    get:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 查询自己的所有节点
+      tags:
+      - 节点管理
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 节点数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ServiceNodesDto'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 添加节点
+      tags:
+      - 节点管理
+    put:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      - description: 节点数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ServiceNodesDto'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 修改节点
+      tags:
+      - 节点管理
+  /shop:
+    delete:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 根据Id删除节点
+      tags:
+      - 店铺管理
+    get:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 获取自己的商品信息
+      tags:
+      - 店铺管理
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 店铺数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ShopDto'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 添加节点
+      tags:
+      - 店铺管理
+    put:
+      consumes:
+      - application/json
+      parameters:
+      - description: id
+        in: query
+        name: id
+        required: true
+        type: string
+      - description: 店铺数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/models.ShopDto'
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 修改节点
+      tags:
+      - 店铺管理
+  /shopByName:
+    get:
+      consumes:
+      - application/json
+      parameters:
+      - description: 分页数据
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/unity.PageParams'
+      - description: product_name
+        in: query
+        name: product_name
+        required: true
+        type: string
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/e.R'
+      summary: 根据商品名称模糊查询
+      tags:
+      - 店铺管理
+securityDefinitions:
+  "":
+    in: header
+    name: Authorization
+    type: apiKey
+swagger: "2.0"

+ 36 - 0
global/db.go

@@ -0,0 +1,36 @@
+package global
+
+import (
+	"fmt"
+	"gorm.io/driver/mysql"
+	"gorm.io/gorm"
+	"gorm.io/gorm/logger"
+	"lot_interlligentControl/models"
+)
+
+var (
+	DBLink *gorm.DB
+)
+
+func SetupDBLink() error {
+	var err error
+	dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?%s",
+		DatabaseSetting.UserName,
+		DatabaseSetting.Password,
+		DatabaseSetting.Host,
+		DatabaseSetting.Db,
+		DatabaseSetting.OtherParams,
+	)
+	DBLink, err = gorm.Open(mysql.Open(dsn), &gorm.Config{
+		DisableForeignKeyConstraintWhenMigrating: true,
+		Logger:                                   logger.Default.LogMode(logger.Info),
+	})
+	if err != nil {
+		return err
+	}
+	//DBLink.SingularTable(true)
+	//DBLink.DB().SetMaxIdleConns(DatabaseSetting.MaxIdleConn)
+	//DBLink.DB().SetMaxOpenConns(DatabaseSetting.MaxOpenConn)
+	DBLink.Set("gorm:table_options", "ENGINE=InnoDB").AutoMigrate(&models.ServiceNodes{}, &models.Shop{}, &models.Product{})
+	return nil
+}

+ 25 - 0
global/redis.go

@@ -0,0 +1,25 @@
+package global
+
+import (
+	"context"
+	"fmt"
+	"github.com/go-redis/redis/v8"
+)
+
+var Rdb *redis.Client
+
+func init() {
+	//addr := RedisSetting.Addr
+	//password := RedisSetting.Password
+	//db := RedisSetting.DB
+	Rdb = redis.NewClient(&redis.Options{
+		Addr:     "192.168.11.70:6379",
+		Password: "",
+		DB:       0,
+	})
+	ctx := context.Background()
+	_, err := Rdb.Ping(ctx).Result()
+	if err != nil {
+		fmt.Println(err)
+	}
+}

+ 72 - 0
global/setting.go

@@ -0,0 +1,72 @@
+package global
+
+import (
+	global "lot_interlligentControl/configs"
+	"time"
+)
+
+// DatabaseSettingS 数据库配置
+type DatabaseSettingS struct {
+	Dialect         string `json:"dialect"`
+	Host            string `json:"host"`
+	Port            string `json:"port"`
+	UserName        string `json:"userName"`
+	Password        string `json:"password"`
+	Db              string `json:"db"`
+	OtherParams     string `json:"otherParams"`
+	MaxIdleConn     int    `json:"max_idle_conn"`
+	MaxOpenConn     int    `json:"max_open_conn"`
+	ConnMaxLifetime string `json:"conn_max_lifetime"`
+}
+
+// Nats 配置
+type Nats struct {
+	NatsServerUrl string `json:"NatsServer_Url"`
+}
+
+// Jwt 配置
+type Jwt struct {
+	Secret        string    `json:"secret"`
+	RefreshExpire time.Time `json:"refresh_expire"`
+	Issuer        string    `json:"issuer"`
+}
+
+// ServerSettingS 服务器配置
+type ServerSettingS struct {
+	Mode                string `json:"mode"`
+	Port                string `json:"port"`
+	InsecureServingInfo string `json:"insecure_serving_info"`
+}
+type SubMail struct {
+	Appid     string `json:"appid"`
+	Signature string `json:"signature"`
+}
+type Redis struct {
+	Addr     string `json:"addr"`
+	Password string `json:"password"`
+	DB       int    `json:"db"`
+}
+
+var (
+	DatabaseSetting *DatabaseSettingS
+	NatsSetting     *Nats
+	JwtSetting      *Jwt
+	ServerSetting   *ServerSettingS
+	SubMailSetting  *SubMail
+	RedisSetting    *Redis
+)
+
+// SetupSetting 读取配置到全局变量
+func SetupSetting() error {
+	s, err := global.NewSetting()
+	err = s.ReadSection("Database", &DatabaseSetting)
+	err = s.ReadSection("Nats", &NatsSetting)
+	err = s.ReadSection("Jwt", &JwtSetting)
+	err = s.ReadSection("Server", &ServerSetting)
+	err = s.ReadSection("SubMail", &SubMailSetting)
+	err = s.ReadSection("Redis", &RedisSetting)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 83 - 0
go.mod

@@ -0,0 +1,83 @@
+module lot_interlligentControl
+
+go 1.21
+
+require (
+	github.com/bytedance/sonic v1.9.1
+	github.com/gin-gonic/gin v1.9.1
+	github.com/go-playground/validator v9.31.0+incompatible
+	github.com/go-redis/redis/v8 v8.11.5
+	github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
+	github.com/nats-io/nats.go v1.34.0
+	github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
+	github.com/sirupsen/logrus v1.9.3
+	github.com/spf13/viper v1.18.2
+	github.com/swaggo/files v1.0.1
+	github.com/swaggo/gin-swagger v1.6.0
+	github.com/swaggo/swag v1.16.3
+	gorm.io/driver/mysql v1.5.6
+	gorm.io/gorm v1.25.9
+)
+
+require (
+	github.com/KyleBanks/depth v1.2.1 // indirect
+	github.com/PuerkitoBio/purell v1.1.1 // indirect
+	github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
+	github.com/cespare/xxhash/v2 v2.1.2 // indirect
+	github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
+	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+	github.com/fsnotify/fsnotify v1.7.0 // indirect
+	github.com/gabriel-vasile/mimetype v1.4.2 // indirect
+	github.com/gin-contrib/sse v0.1.0 // indirect
+	github.com/go-openapi/jsonpointer v0.19.5 // indirect
+	github.com/go-openapi/jsonreference v0.19.6 // indirect
+	github.com/go-openapi/spec v0.20.4 // indirect
+	github.com/go-openapi/swag v0.19.15 // indirect
+	github.com/go-playground/locales v0.14.1 // indirect
+	github.com/go-playground/universal-translator v0.18.1 // indirect
+	github.com/go-playground/validator/v10 v10.14.0 // indirect
+	github.com/go-sql-driver/mysql v1.7.0 // indirect
+	github.com/goccy/go-json v0.10.2 // indirect
+	github.com/hashicorp/hcl v1.0.0 // indirect
+	github.com/jinzhu/inflection v1.0.0 // indirect
+	github.com/jinzhu/now v1.1.5 // indirect
+	github.com/jonboulle/clockwork v0.4.0 // indirect
+	github.com/josharian/intern v1.0.0 // indirect
+	github.com/json-iterator/go v1.1.12 // indirect
+	github.com/klauspost/compress v1.17.2 // indirect
+	github.com/klauspost/cpuid/v2 v2.2.4 // indirect
+	github.com/leodido/go-urn v1.2.4 // indirect
+	github.com/lestrrat-go/strftime v1.0.6 // indirect
+	github.com/magiconair/properties v1.8.7 // indirect
+	github.com/mailru/easyjson v0.7.6 // indirect
+	github.com/mattn/go-isatty v0.0.19 // indirect
+	github.com/mitchellh/mapstructure v1.5.0 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.2 // indirect
+	github.com/nats-io/nkeys v0.4.7 // indirect
+	github.com/nats-io/nuid v1.0.1 // indirect
+	github.com/pelletier/go-toml/v2 v2.1.0 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/sagikazarmark/locafero v0.4.0 // indirect
+	github.com/sagikazarmark/slog-shim v0.1.0 // indirect
+	github.com/sourcegraph/conc v0.3.0 // indirect
+	github.com/spf13/afero v1.11.0 // indirect
+	github.com/spf13/cast v1.6.0 // indirect
+	github.com/spf13/pflag v1.0.5 // indirect
+	github.com/subosito/gotenv v1.6.0 // indirect
+	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
+	github.com/ugorji/go/codec v1.2.11 // indirect
+	go.uber.org/multierr v1.10.0 // indirect
+	golang.org/x/arch v0.3.0 // indirect
+	golang.org/x/crypto v0.21.0 // indirect
+	golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
+	golang.org/x/net v0.22.0 // indirect
+	golang.org/x/sys v0.18.0 // indirect
+	golang.org/x/text v0.14.0 // indirect
+	golang.org/x/tools v0.13.0 // indirect
+	google.golang.org/protobuf v1.31.0 // indirect
+	gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
+	gopkg.in/ini.v1 v1.67.0 // indirect
+	gopkg.in/yaml.v2 v2.4.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+)

+ 255 - 0
go.sum

@@ -0,0 +1,255 @@
+github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
+github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
+github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
+github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
+github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
+github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
+github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
+github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
+github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
+github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
+github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
+github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
+github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
+github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
+github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
+github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
+github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
+github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
+github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
+github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
+github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
+github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
+github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
+github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
+github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
+github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
+github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
+github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
+github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
+github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
+github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
+github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
+github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
+github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
+github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
+github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
+github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
+github.com/go-playground/validator v9.31.0+incompatible h1:UA72EPEogEnq76ehGdEDp4Mit+3FDh548oRqwVgNsHA=
+github.com/go-playground/validator v9.31.0+incompatible/go.mod h1:yrEkQXlcI+PugkyDjY2bRrL/UBU4f3rvrgkN3V8JEig=
+github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
+github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
+github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
+github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
+github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
+github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
+github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
+github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
+github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
+github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
+github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
+github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
+github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
+github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
+github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
+github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
+github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
+github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
+github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
+github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
+github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
+github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
+github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
+github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ=
+github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
+github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
+github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
+github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
+github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
+github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
+github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
+github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
+github.com/nats-io/nats.go v1.34.0 h1:fnxnPCNiwIG5w08rlMcEKTUw4AV/nKyGCOJE8TdhSPk=
+github.com/nats-io/nats.go v1.34.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
+github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
+github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
+github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
+github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
+github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
+github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
+github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
+github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
+github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
+github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
+github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
+github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
+github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
+github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
+github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
+github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
+github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
+github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
+github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
+github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
+github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
+github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
+github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
+github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
+github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
+github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
+github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
+github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
+github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
+github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
+github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
+github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
+github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
+github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
+github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
+github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
+github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
+go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
+golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
+golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
+golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
+golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
+golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
+golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
+golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
+golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
+google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
+gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
+gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
+gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
+gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
+gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
+gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8=
+gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
+rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

+ 37 - 0
main.go

@@ -0,0 +1,37 @@
+package main
+
+import (
+	"log"
+	"lot_interlligentControl/app"
+	"lot_interlligentControl/global"
+	"lot_interlligentControl/nats"
+)
+
+func init() {
+	err := global.SetupSetting()
+	if err != nil {
+		log.Fatalf("init.SetupSetting err: %v", err)
+	}
+	err = global.SetupDBLink()
+	if err != nil {
+		log.Fatalf("init.SetupDBLink err: %v", err)
+	}
+	nats.SetupNats()
+}
+
+// @title 物联智控平台
+// @version 1.0
+// @description 物联智控平台
+// @Host 127.0.0.1:8081
+// @BasePath /api
+// @securityDefinitions.apikey
+// @in header
+// @name Authorization
+//
+//go:generate swag init --parseDependency --parseDepth=6
+func main() {
+	err := app.InitRouter()
+	if err != nil {
+		panic(err)
+	}
+}

+ 20 - 0
models/Service_nodes.go

@@ -0,0 +1,20 @@
+package models
+
+import (
+	"gorm.io/gorm"
+)
+
+type ServiceNodes struct {
+	gorm.Model
+	NodeName string `json:"node_name"` // 节点名称
+	State    bool   `json:"state"`     // 0: 离线 1: 在线
+	Address  string `json:"address"`   // 节点地址
+	Tokey    string `json:"tokey"`     // 节点token
+	CreateBy int    `json:"create_by"`
+}
+type ServiceNodesDto struct {
+	NodeName string `json:"node_name"` // 节点名称
+	State    bool   `json:"state"`     // 0: 离线 1: 在线
+	Address  string `json:"address"`   // 节点地址
+	Tokey    string `json:"tokey"`     // 节点token
+}

+ 12 - 0
models/product.go

@@ -0,0 +1,12 @@
+package models
+
+import "gorm.io/gorm"
+
+type Product struct {
+	gorm.Model
+	ProductType string `json:"product_type" validate:"required"`
+	CreateBy    int    `json:"create_by"` //创建人
+}
+type ProductDto struct {
+	ProductType string `json:"product_type" validate:"required"`
+}

+ 21 - 0
models/shop.go

@@ -0,0 +1,21 @@
+package models
+
+import "gorm.io/gorm"
+
+type Shop struct {
+	gorm.Model
+	ProductType        string  `json:"product_type"`        // 产品类型
+	ProductAvatar      string  `json:"product_avatar"`      //产品图片
+	ProductName        string  `json:"product_name"`        //产品名称
+	ProductPrice       float64 `json:"product_price"`       //产品价格
+	ProductState       int     `json:"product_state"`       //产品状态 0待审核1审核通过2审核不通过
+	ProductDescription string  `json:"product_description"` //产品描述
+	CreateBy           int     `json:"create_by"`           //创建人
+}
+type ShopDto struct {
+	ProductName        string  `json:"product_name" validate:"required"`        //产品名称
+	ProductAvatar      string  `json:"product_avatar" validate:"required"`      //产品图片
+	ProductDescription string  `json:"product_description" validate:"required"` //产品描述
+	ProductType        string  `json:"product_type" validate:"required"`        // 产品类型
+	ProductPrice       float64 `json:"product_price" validate:"required"`       //产品价格
+}

+ 20 - 0
nats/Nats.go

@@ -0,0 +1,20 @@
+package nats
+
+import (
+	"fmt"
+	"github.com/nats-io/nats.go"
+	"lot_interlligentControl/global"
+)
+
+var Nats *nats.Conn
+
+func SetupNats() {
+	var err error
+	fmt.Println(global.NatsSetting.NatsServerUrl)
+	Nats, err = nats.Connect(global.NatsSetting.NatsServerUrl)
+	if err != nil {
+		fmt.Println("nats 连接失败!")
+		panic(err)
+	}
+	fmt.Println("nats OK!")
+}

+ 62 - 0
unity/unity.go

@@ -0,0 +1,62 @@
+package unity
+
+import (
+	"errors"
+	"lot_interlligentControl/global"
+)
+
+type PageParams struct {
+	Page int    `json:"page" form:"page"`
+	Size int    `json:"size" form:"size"`
+	Desc string `json:"desc" form:"desc"`
+}
+
+// Paginate 使用给定的DB连接执行分页查询
+func Paginate[T any](params PageParams, model T) (result []T, total int64, err error) {
+	var count int64
+	if err = global.DBLink.Model(model).Count(&count).Error; err != nil {
+		return nil, 0, err
+	}
+	// 计算偏移量并设置分页大小
+	offset := (params.Page - 1) * params.Size
+	// 执行实际分页查询
+	if err = global.DBLink.Offset(offset).Limit(params.Size).Order(params.Desc).Find(&result).Error; err != nil {
+		return nil, 0, err
+	}
+	return result, count, nil
+}
+
+// PaginateByID 根据ID进行分页查询
+func PaginateByID[T any](id int, params PageParams, model T) (result []T, total int64, err error) {
+	var count int64
+	if err = global.DBLink.Model(model).Where("create_by = ?", id).Count(&count).Error; err != nil {
+		return nil, 0, err
+	}
+	// 计算偏移量并设置分页大小
+	offset := (params.Page - 1) * params.Size
+	// 执行实际分页查询
+	if err = global.DBLink.Where("create_by = ?", id).Offset(offset).Limit(params.Size).Order(params.Desc).Find(&result).Error; err != nil {
+		return nil, 0, err
+	}
+	return result, count, nil
+}
+
+// GetById 根据id查询
+func GetById[T any](id int, model T) (T, error) {
+	tx := global.DBLink.Where("id = ?", id).First(&model)
+	if tx.Error != nil {
+		return model, errors.New("查询失败")
+	} else {
+		return model, nil
+	}
+}
+
+// DeleteById 根据id删除
+func DeleteById[T any](id int, model T) (T, error) {
+	tx := global.DBLink.Where("id = ?", id).Delete(&model)
+	if tx.Error != nil {
+		return model, errors.New("查询失败")
+	} else {
+		return model, nil
+	}
+}

+ 12 - 0
utils/getuid.go

@@ -0,0 +1,12 @@
+package utils
+
+import (
+	"github.com/gin-gonic/gin"
+)
+
+func GetUId(c *gin.Context) int {
+	mustGet := c.MustGet("user")
+	users := mustGet.(map[string]interface{})
+	id := int(users["ID"].(float64))
+	return id
+}