Commit 9a8f6a45 authored by szh's avatar szh

增加通用节点操作接口

parent 41c3a614
...@@ -89,6 +89,9 @@ func RaspberryChan() { ...@@ -89,6 +89,9 @@ func RaspberryChan() {
} }
updateJobMap(value.JobID,err) updateJobMap(value.JobID,err)
tlog.Info("RaspberryChan resetWallet success", "err", nil) tlog.Info("RaspberryChan resetWallet success", "err", nil)
default :
tlog.Error("RaspberryChan not support type","msg",value.Name)
updateJobMap(value.JobID,errors.New("RaspberryChan not support type"))
} }
} }
......
...@@ -615,3 +615,20 @@ func JobStatus(c *gin.Context) { ...@@ -615,3 +615,20 @@ func JobStatus(c *gin.Context) {
} }
appG.Response(http.StatusOK, e.JOB_NOT_DONE, nil) appG.Response(http.StatusOK, e.JOB_NOT_DONE, nil)
} }
func BityuanJob (c *gin.Context) {
type JReq struct {
JobMsg string `json:"job_msg" binding:"required"`
}
var req JReq
appG := app.Gin{C: c}
err := appG.C.ShouldBindJSON(&req)
if err != nil {
appG.Response(http.StatusOK, e.INVALID_PARAMS, nil)
tlog.Info("invalid params")
return
}
util.AddValue(&app.JobID,1)
app.JobChan <- app.MsgType{Name: req.JobMsg,JobID:app.JobID}
appG.Response(http.StatusOK, e.SUCCESS, app.JobID)
}
\ No newline at end of file
...@@ -67,6 +67,8 @@ func InitRouter() *gin.Engine { ...@@ -67,6 +67,8 @@ func InitRouter() *gin.Engine {
apiv1.POST("/delbackup", v1.DelBackup) apiv1.POST("/delbackup", v1.DelBackup)
//是否备份 //是否备份
apiv1.POST("/isbackup", v1.CheckBackup) apiv1.POST("/isbackup", v1.CheckBackup)
//节点操作通用接口
apiv1.POST("/bityuanjob", v1.BityuanJob)
//获取任务完成情况 //获取任务完成情况
apiv1.POST("/jobstatus", v1.JobStatus) apiv1.POST("/jobstatus", v1.JobStatus)
return r return r
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment