123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /*
- * @description: rpc - 安全巡检
- * @Author: LanJianRong
- * @Date: 2020-11-18
- * @FilePath: \construction_management\web\api\safe_rpc_api.go
- */
- package api
- import (
- "github.com/kataras/iris/v12"
- "go.mod/services"
- "go.mod/web/utils"
- )
- type SafeRpcApi struct {
- //框架-web应用上下文环境
- Ctx iris.Context
- // 需要用的service
- ServiceSafe services.SafeService
- }
- // @Summary 安全巡检列表
- // @Tags 安全巡检
- // @Description 获得列表数据
- // @Accept json
- // @Produce json
- // @Security ApiKeyAuth
- // @Success 200 {object} viewmodels.Safe "{code:0成功,data:viewmodels.Safe,msg:}"
- // @Failure 400 {string} string "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
- // @Router /api/safe [get]
- func (c *SafeRpcApi) Get() {
- // 1.规则验证
- safeData, err := c.ServiceSafe.ValidRule(c.Ctx)
- if err != nil {
- c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
- return
- }
- bidsectionId, err := utils.GetDecryptId(safeData.BidsectionId)
- if err != nil {
- c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
- return
- }
- c.ServiceSafe.Get(bidsectionId)
- // SafeList := c.ServiceSafe.GetSafeList()
- // c.Ctx.JSON(iris.Map{
- // "code": 0,
- // "msg": "",
- // "data": SafeList,
- // })
- }
|