platform.go 722 字节
package controllers

import (
	"encoding/json"
	"oppmg/common/log"
	"oppmg/protocol"
	"oppmg/services/platform"
)

type PlatformController struct {
	BaseController
}

func (c PlatformController) UpdateData() {
	var msg *protocol.ResponseMessage
	defer func() {
		c.ResposeJson(msg)
	}()
	var param platform.CommonProtocol
	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
		log.Error("json 解析失败 err:%s", err)
		msg = protocol.BadRequestParam("1")
		return
	}
	m, err := platform.NewPlatformAction(param.Module)
	if err != nil {
		msg = protocol.NewReturnResponse(nil, err)
		return
	}
	err = m.DoAction(param.Action, []byte(param.Data))
	msg = protocol.NewReturnResponse(nil, err)
	return
}