From 4907fc78f13db01225f4321ec1d7aad4618c4e96 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 22 八月 2019 14:46:24 +0800
Subject: [PATCH] add randomPwd
---
controllers/cluster.go | 15 +++++++++++++++
router/router.go | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/controllers/cluster.go b/controllers/cluster.go
index 4d844ee..3344bb9 100644
--- a/controllers/cluster.go
+++ b/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
diff --git a/router/router.go b/router/router.go
index 151d3d9..24651a5 100644
--- a/router/router.go
+++ b/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)
--
Gitblit v1.8.0