liuxiaolong
2019-08-22 d279022520262b8fb8fc985df3bb19df19192a2f
controllers/cluster.go
@@ -199,3 +199,42 @@
      util.ResponseFormat(c,code.ComError,"加入失败")
   }
}
// @Summary 保存集群名称
// @Description 保存集群名称
// @Produce json
// @Tags cluster
// @Param  clusterName query string true "集群名称"
// @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/updateClusterName [post]
func (cc ClusterController) UpdateClusterName(c *gin.Context) {
   clusterName := c.PostForm("clusterName")
   if clusterName == "" {
      util.ResponseFormat(c,code.RequestParamError, "参数有误")
      return
   }
   var api dbapi.ClusterApi
   b,_ := api.UpdateClusterName(clusterName)
   if b {
      util.ResponseFormat(c,code.UpdateSuccess,"更新成功")
   } else {
      util.ResponseFormat(c,code.ComError, "更新失败")
   }
}
// @Summary 退出集群
// @Description 退出集群
// @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/leave [post]
func (cc ClusterController) Leave(c *gin.Context) {
   var api dbapi.ClusterApi
   if b,_:= api.Leave();b {
      util.ResponseFormat(c,code.Success,"退出成功")
   } else {
      util.ResponseFormat(c,code.ComError,"退出失败")
   }
}