diff --git a/models/repo.go b/models/repo.go index a4417e4bd..8070d7442 100755 --- a/models/repo.go +++ b/models/repo.go @@ -2470,6 +2470,12 @@ func GetBlockChainUnSuccessRepos() ([]*Repository, error) { Find(&repos) } +func (repo *Repository) UpdateBlockChain() error { + + _, err := x.Exec("UPDATE `repository` SET block_chain_status = ?, contract_address=? WHERE id = ?", repo.BlockChainStatus, repo.ContractAddress, repo.ID) + return err +} + func (repo *Repository) IncreaseCloneCnt() { sess := x.NewSession() defer sess.Close() diff --git a/routers/repo/blockchain.go b/routers/repo/blockchain.go index dc3fcd848..6bd546ce6 100755 --- a/routers/repo/blockchain.go +++ b/routers/repo/blockchain.go @@ -72,7 +72,7 @@ func HandleBlockChainInitNotify(ctx *context.Context) { repo.BlockChainStatus = models.RepoBlockChainSuccess repo.ContractAddress = req.ContractAddress - if err = models.UpdateRepositoryCols(repo, "block_chain_status", "contract_address"); err != nil { + if err = repo.UpdateBlockChain(); err != nil { log.Error("UpdateRepositoryCols failed:%v", err.Error(), ctx.Data["msgID"]) ctx.JSON(200, map[string]string{ "code": "-1",