add cluster updateName and leave
| | |
| | | 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,"退出失败") |
| | | } |
| | | } |
| | |
| | | clusterApi.POST("/stopSearching", clusterController.StopSearching) |
| | | clusterApi.GET("/getSearchNodes", clusterController.GetSearchNodes) |
| | | clusterApi.POST("/joinCluster", clusterController.JoinCluster) |
| | | clusterApi.POST("/updateClusterName", clusterController.UpdateClusterName) |
| | | clusterApi.POST("/leave", clusterController.Leave) |
| | | } |
| | | |
| | | // 文件 上传 |