所有数据库相关的操作支持事务

This commit is contained in:
刘祥超
2021-01-01 23:31:30 +08:00
parent 0cf398a436
commit f49c26cdab
146 changed files with 2845 additions and 2068 deletions

View File

@@ -55,7 +55,7 @@ func (this *APINode) Start() {
sharedAPIConfig = config
// 校验
apiNode, err := models.SharedAPINodeDAO.FindEnabledAPINodeWithUniqueIdAndSecret(config.NodeId, config.Secret)
apiNode, err := models.SharedAPINodeDAO.FindEnabledAPINodeWithUniqueIdAndSecret(nil, config.NodeId, config.Secret)
if err != nil {
logs.Println("[API_NODE]start failed: read api node from database failed: " + err.Error())
return
@@ -230,7 +230,7 @@ func (this *APINode) listenPorts(apiNode *models.APINode) (isListening bool) {
}
// HTTPS
httpsConfig, err := apiNode.DecodeHTTPS()
httpsConfig, err := apiNode.DecodeHTTPS(nil)
if err != nil {
remotelogs.Error("API_NODE", "decode https config: "+err.Error())
return
@@ -296,7 +296,7 @@ func (this *APINode) listenPorts(apiNode *models.APINode) (isListening bool) {
}
// Rest HTTPS
restHTTPSConfig, err := apiNode.DecodeRestHTTPS()
restHTTPSConfig, err := apiNode.DecodeRestHTTPS(nil)
if err != nil {
remotelogs.Error("API_NODE", "decode REST https config: "+err.Error())
return

View File

@@ -75,7 +75,7 @@ func (this *NodeStatusExecutor) update() {
remotelogs.Error("NODE_STATUS", "serial NodeStatus fail: "+err.Error())
return
}
err = models.SharedAPINodeDAO.UpdateAPINodeStatus(sharedAPIConfig.NumberId(), jsonData)
err = models.SharedAPINodeDAO.UpdateAPINodeStatus(nil, sharedAPIConfig.NumberId(), jsonData)
if err != nil {
remotelogs.Error("NODE_STATUS", "rpc UpdateNodeStatus() failed: "+err.Error())
return

View File

@@ -90,7 +90,7 @@ func (this *RestServer) handle(writer http.ResponseWriter, req *http.Request) {
return
}
accessToken, err := models.SharedAPIAccessTokenDAO.FindAccessToken(token)
accessToken, err := models.SharedAPIAccessTokenDAO.FindAccessToken(nil, token)
if err != nil {
this.writeJSON(writer, maps.Map{
"code": 400,