package controllers

import (
	"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/phpjx"
	"github.com/astaxie/beego/server/web"
)

type JxShopController struct {
	web.Controller
}

// @Title 京西自营商城消息回调接口
// @Description 京西自营商城消息回调接口
// @Param	appKey			formData	string	true	"AppKey"
// @Param	msgType			formData	string	true	"消息类型"
// @Param	subMsgType		formData	string	false	"子消息类型"
// @Param	thingID			formData	string	false	"消息对应的事物ID"
// @Param	data			formData	string	false	"详细"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /JxMsg [post]
func (c *JxShopController) JxMsg(msgType string) {
	c.callJxMsg(func(params *tJxshopJxMsgParams) (retVal interface{}, errCode string, err error) {
		retVal, errCode, err = phpjx.OnCallbackMsg(&phpjx.CallbackMsg{
			AppKey:     params.AppKey,
			MsgType:    params.MsgType,
			SubMsgType: params.SubMsgType,
			ThingID:    params.ThingID,
			Data:       params.Data,
		})
		return retVal, "", err
	})
}
