package api

import (
	"queencount/bus"
	"queencount/db/model"

	"github.com/gin-gonic/gin"
)

func TestRouter(r *GinRouter) {
	r.GET("/test/print", Printa)
	// r.GET("/test/print", Printa)
	r.GET("/test/sb", TestSubscribe)
	r.GET("/test/tim", TestInMongo)

}

func Printa(c *gin.Context, apictx *ApiSession) (interface{}, error) {
	// _, bset := GetIncrementTimes("day", "1h")
	// fmt.Println(bset)

	return nil, nil
}

func TestSubscribe(c *gin.Context, apictx *ApiSession) (interface{}, error) {

	var assetCount model.AssetEvent
	bus.NatsCenter.PublishObj("asset.added", &assetCount)
	return nil, nil
}
func TestInMongo(c *gin.Context, apictx *ApiSession) (interface{}, error) {

	var assetCount model.AssetEvent
	assetCount.Api = "upload"
	assetCount.DbId = "628b4ae8633d10f8e3658557"
	assetCount.DefId = "628c9b9f8790e88745f65903" // 针线车
	bus.NatsCenter.PublishObj("asset.added", &assetCount)
	return nil, nil
}
