Commit 9a8f6a45 authored by szh's avatar szh

增加通用节点操作接口

parent 41c3a614
......@@ -89,6 +89,9 @@ func RaspberryChan() {
}
updateJobMap(value.JobID,err)
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"))
}
}
......
......@@ -614,4 +614,21 @@ func JobStatus(c *gin.Context) {
return
}
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 {
apiv1.POST("/delbackup", v1.DelBackup)
//是否备份
apiv1.POST("/isbackup", v1.CheckBackup)
//节点操作通用接口
apiv1.POST("/bityuanjob", v1.BityuanJob)
//获取任务完成情况
apiv1.POST("/jobstatus", v1.JobStatus)
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