// 模块控制接口-公司
// 秒寻科技
// zt 2024-02-01

package companyhandler

import (
	"ipsomc/core/company/companylogic"
	"ipsomc/core/company/companymodel"
	"ipsomc/core/gin/bind"
	"ipsomc/core/gin/resp"

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

type CompanyHand struct {
	companyLgc companylogic.CompanyLgc
	bindApi    bind.BindApi
}

// 增加注册用户
func (obj *CompanyHand) CompanyRegisterHan(c *gin.Context) {
	dataModel := new(companymodel.Company)

	//把前端数据绑定到模型
	if err := obj.bindApi.Bind2Model(c, dataModel); err != nil {
		resp.RespFail(c, err.Error())
		return
	}

	//注册
	if err := obj.companyLgc.CompanyRegister(dataModel); err != nil {
		resp.RespFail(c, err.Error())
		return
	}

	//返回数据
	resp.RespOk(c)
}
