liuxiaolong
2019-08-22 4907fc78f13db01225f4321ec1d7aad4618c4e96
add randomPwd
2个文件已修改
16 ■■■■■ 已修改文件
controllers/cluster.go 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cluster.go
@@ -2,7 +2,10 @@
import (
    "basic.com/dbapi.git"
    "fmt"
    "github.com/gin-gonic/gin"
    "math/rand"
    "time"
    "webserver/extend/code"
    "webserver/extend/util"
)
@@ -75,6 +78,18 @@
    }
}
// @Summary 生成集群6位随机密码
// @Description 生成集群6位随机密码
// @Produce json
// @Tags cluster
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
// @Router /data/api-v/cluster/randomPwd [get]
func (cc ClusterController) RandomPwd(c *gin.Context) {
    pwd := fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
    util.ResponseFormat(c,code.Success,pwd)
}
// @Summary 搜索集群
// @Description 搜索集群
// @Accept json
router/router.go
@@ -226,6 +226,7 @@
    }
    clusterApi := r.Group(urlPrefix+"/cluster")
    {
        clusterApi.GET("/randomPwd", clusterController.RandomPwd)
        clusterApi.POST("/create", clusterController.Create)
        clusterApi.POST("/search", clusterController.Search)
        clusterApi.POST("/stopSearching", clusterController.StopSearching)