作者 唐旭辉

日志输出调整

... ... @@ -22,8 +22,8 @@ redis_add_port = "${REDIS_PORT||6379}"
redis_auth = ""
##log相关配置
##out_put:"console","file"
log_output = "console"
log_filename = "${aliyun_logs_access||ability.log}"
log_output = "file"
log_filename = "${aliyun_logs_access||./log/ability.log}"
log_level = "${LOG_LEVEL||debug}"
##统一用户中心相关配置
... ...
... ... @@ -409,14 +409,14 @@ func (c *CompanyController) GetCompanyForUCenter() {
type Paremeter struct {
Companyid int64 `json:"company_id"`
}
var param protocol.CenterCompanyInfo
var param Paremeter
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
log.Error("json 解析失败 err:%s", err)
msg = protocol.BadRequestParam("1")
return
}
msg = protocol.NewReturnResponse(nil, nil)
companydata, err := servecompany.CompanyInfoForUCenter(param.Companyid)
msg = protocol.NewReturnResponse(companydata, err)
return
}
... ...
... ... @@ -82,6 +82,7 @@ func init() {
nsUcenter := beego.NewNamespace("/ucenter",
beego.NSBefore(middleware.LogRequestData),
beego.NSRouter("/company", &controllers.CompanyController{}, "post:InitCompany"),
// beego.NSRouter("/company/info", &controllers.CompanyController{}, ""),
)
beego.AddNamespace(nsV1)
beego.AddNamespace(nsAuth)
... ...
... ... @@ -466,13 +466,26 @@ func ForbidCompany(ucenterCompany int64) error {
return nil
}
func CompanyInfoForUCenter(uCenterid int64) {
// var (
// err error
// companyinfo *models.Company
// )
// companyinfo, err = models.GetCompanyByUCenter(uCenterid)
// if err != nil && err != orm.ErrNoRows {
// }
func CompanyInfoForUCenter(uCenterid int64) (protocol.ResponseCenterCompany, error) {
var (
err error
companyinfo *models.Company
resp protocol.ResponseCenterCompany
)
companyinfo, err = models.GetCompanyByUCenter(uCenterid)
if err != nil && err != orm.ErrNoRows {
return resp, protocol.NewErrWithMessage("1")
}
if err == orm.ErrNoRows {
resp.ExistNo()
return resp, nil
}
resp.ExistYes()
resp.UCenterCompanyId = companyinfo.UserCenterId
if ok := companyinfo.IsEnable(); ok {
resp.StatusYes()
} else {
resp.StatusNo()
}
return resp, nil
}
... ...