unified_user_center_controller.go 999 字节
package controllers

import (
	"encoding/json"

	"github.com/astaxie/beego"
	"github.com/linmadan/egglib-go/web/beego/utils"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/unifiedUserCenter/command"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/unifiedUserCenter/service"
)

type UnifiedUserCenterController struct {
	beego.Controller
}

func (controller *UnifiedUserCenterController) SyncEmployeeCallback() {
	unifiedUserCenterService := service.NewUnifiedUserCenterService(nil)
	syncEmployeeCallbackCommand := &command.SyncEmployeeCallbackCommand{}
	json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), syncEmployeeCallbackCommand)
	data, err := unifiedUserCenterService.SyncEmployeeCallback(syncEmployeeCallbackCommand)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}