| | |
| | | |
| | | import ( |
| | | "apsClient/conf" |
| | | "apsClient/constvar" |
| | | "apsClient/crontask" |
| | | "apsClient/model/request" |
| | | "apsClient/model/response" |
| | | _ "apsClient/model/response" |
| | |
| | | return |
| | | } |
| | | list, err := service.GetDeviceIDList() |
| | | if err != nil { |
| | | logx.Errorf("SetCurrentDeviceId GetDeviceIDList err:%v", err) |
| | | ctx.Fail(ecode.DBErr) |
| | | return |
| | | } |
| | | findFlag := false |
| | | for _, item := range list { |
| | | if item == params.CurrentDeviceID { |
| | |
| | | } |
| | | service.SetDeviceIDToFile(params.CurrentDeviceID) |
| | | conf.Conf.CurrentDeviceID = params.CurrentDeviceID |
| | | err = crontask.RestartTask(conf.Conf.SerfClusterStatus != constvar.SerfClusterStatusSlave) |
| | | if err != nil { |
| | | logx.Errorf("restart task failed:%v", err) |
| | | ctx.Fail(ecode.UnknownErr) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |