Commit 329bf80e authored by szh's avatar szh

update

parent eddc392b
...@@ -104,12 +104,16 @@ func SyncBlock() { ...@@ -104,12 +104,16 @@ func SyncBlock() {
} }
} }
} }
err := models.UpdateBlocks(txsMap,statMap,processHeight+maxDownload+1) if len(txsList) != int(maxDownload) || len(txsList) != len(statList) {
logging.Error("txsList",len(txsList),"txsMap",len(txsMap),"statList",len(statList))
panic("exception txs not eq expect")
}
err := models.UpdateBlocks(txsMap,statMap,processHeight+maxDownload)
if err != nil { if err != nil {
panic(err) panic(err)
} }
prev.LocalHeight += prev.DownloadHeight + 1 prev.LocalHeight += prev.DownloadHeight + 1
logging.Info("startHeight:",processHeight," endHeight:",processHeight+maxDownload+1) logging.Info("startHeight:",processHeight," endHeight:",processHeight+maxDownload)
} }
......
...@@ -29,4 +29,14 @@ func GetDevstatus(c *gin.Context) { ...@@ -29,4 +29,14 @@ func GetDevstatus(c *gin.Context) {
appG.Response(http.StatusOK, e.ERROR, nil) appG.Response(http.StatusOK, e.ERROR, nil)
} }
appG.Response(http.StatusOK, e.SUCCESS, pai) appG.Response(http.StatusOK, e.SUCCESS, pai)
}
func GetTicketInfo(c *gin.Context) {
appG := app.Gin{C: c}
var pai pai_service.Pai
info,err := pai.GetTicketInfo()
if err != nil {
appG.Response(http.StatusOK, e.ERROR, nil)
}
appG.Response(http.StatusOK, e.SUCCESS, info)
} }
\ No newline at end of file
...@@ -22,9 +22,7 @@ func InitRouter() *gin.Engine { ...@@ -22,9 +22,7 @@ func InitRouter() *gin.Engine {
apiv1 := r.Group("/pai") apiv1 := r.Group("/pai")
//获取树莓派基本信息 //获取树莓派基本信息
apiv1.POST("/devdetail",v1.GetDevdetail) apiv1.POST("/ticketinfo",v1.GetTicketInfo)
//获取树莓派基本信息
apiv1.POST("/devstatus",v1.GetDevstatus)
//apiv1.Use(jwt.JWT()) //apiv1.Use(jwt.JWT())
//{ //{
// //
......
...@@ -27,6 +27,18 @@ type Pai struct { ...@@ -27,6 +27,18 @@ type Pai struct {
NetInfo *types.NodeNetInfo `json:"net_info"` NetInfo *types.NodeNetInfo `json:"net_info"`
} }
type MinedInfo struct {
Mined int64 `json:"mined"`
Tickets int64 `json:"tickets"`
MinedList []*MinedTxInfo `json:"mined_list"`
}
type MinedTxInfo struct {
Height int64 `json:"height"`
Amount int64 `json:"amount"`
BlockTime int64 `json:"block_time"`
}
func (p *Pai) GetConfig() bool { func (p *Pai) GetConfig() bool {
if pai_serial != "" { if pai_serial != "" {
p.Serial = pai_serial p.Serial = pai_serial
...@@ -124,4 +136,8 @@ func getPaiConfig(command string ,arg ...string) (config map[string]string,err e ...@@ -124,4 +136,8 @@ func getPaiConfig(command string ,arg ...string) (config map[string]string,err e
} }
return list, nil return list, nil
}
func (p *Pai) GetTicketInfo() (*MinedInfo,error) {
return nil,nil
} }
\ No newline at end of file
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