Esempio n. 1
0
func purchaseListHandler(r *http.Request, w http.ResponseWriter,
	redis *models.RedisLogger, user *models.Account, p Parameter) {
	form := p.(purchaseListForm)

	_, txs, _ := user.Txs(&form.Paging)

	list := []*purchaseStruct{}
	for _, tx := range txs {
		list = append(list, &purchaseStruct{
			Coins: tx.Coins,
			Value: tx.Value,
			Time:  tx.Time.Unix(),
		})
	}

	respData := map[string]interface{}{
		"payCoinList":   list,
		"page_frist_id": form.Paging.First,
		"page_last_id":  form.Paging.Last,
	}
	writeResponse(r.RequestURI, w, respData, nil)
}