push.go 730 字节
package v1

import (
	"encoding/json"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
	"openapi/controllers"
	"openapi/protocol"
	"openapi/services/push"
)

type PushController struct {
	controllers.BaseController
}

//推送信息 PushInfo
// @router /pushInfo [post]
func (this *PushController) PushInfo() {
	var msg *protocol.ResponseMessage
	defer func() {
		this.Resp(msg)
	}()
	var request *protocol.PushInfoRequest
	if err := json.Unmarshal(this.ByteBody, &request); err != nil {
		log.Error(err)
		msg = protocol.BadRequestParam(1)
		return
	}
	if b, m := this.Valid(request); !b {
		msg = m
		return
	}
	header := controllers.GetRequestHeader(this.Ctx)
	msg = protocol.NewReturnResponse(push.PushInfo(header, request))
}