Commit 329bf80e authored by szh's avatar szh

update

parent eddc392b
......@@ -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 {
panic(err)
}
prev.LocalHeight += prev.DownloadHeight + 1
logging.Info("startHeight:",processHeight," endHeight:",processHeight+maxDownload+1)
logging.Info("startHeight:",processHeight," endHeight:",processHeight+maxDownload)
}
......
......@@ -30,3 +30,13 @@ func GetDevstatus(c *gin.Context) {
}
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 {
apiv1 := r.Group("/pai")
//获取树莓派基本信息
apiv1.POST("/devdetail",v1.GetDevdetail)
//获取树莓派基本信息
apiv1.POST("/devstatus",v1.GetDevstatus)
apiv1.POST("/ticketinfo",v1.GetTicketInfo)
//apiv1.Use(jwt.JWT())
//{
//
......
......@@ -27,6 +27,18 @@ type Pai struct {
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 {
if pai_serial != "" {
p.Serial = pai_serial
......@@ -125,3 +137,7 @@ func getPaiConfig(command string ,arg ...string) (config map[string]string,err e
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