作者 唐旭辉

日志输出调整

@@ -22,8 +22,8 @@ redis_add_port = "${REDIS_PORT||6379}" @@ -22,8 +22,8 @@ redis_add_port = "${REDIS_PORT||6379}"
22 redis_auth = "" 22 redis_auth = ""
23 ##log相关配置 23 ##log相关配置
24 ##out_put:"console","file" 24 ##out_put:"console","file"
25 -log_output = "console"  
26 -log_filename = "${aliyun_logs_access||ability.log}" 25 +log_output = "file"
  26 +log_filename = "${aliyun_logs_access||./log/ability.log}"
27 log_level = "${LOG_LEVEL||debug}" 27 log_level = "${LOG_LEVEL||debug}"
28 28
29 ##统一用户中心相关配置 29 ##统一用户中心相关配置
@@ -409,14 +409,14 @@ func (c *CompanyController) GetCompanyForUCenter() { @@ -409,14 +409,14 @@ func (c *CompanyController) GetCompanyForUCenter() {
409 type Paremeter struct { 409 type Paremeter struct {
410 Companyid int64 `json:"company_id"` 410 Companyid int64 `json:"company_id"`
411 } 411 }
412 - var param protocol.CenterCompanyInfo 412 + var param Paremeter
413 if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil { 413 if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
414 log.Error("json 解析失败 err:%s", err) 414 log.Error("json 解析失败 err:%s", err)
415 msg = protocol.BadRequestParam("1") 415 msg = protocol.BadRequestParam("1")
416 return 416 return
417 } 417 }
418 -  
419 - msg = protocol.NewReturnResponse(nil, nil) 418 + companydata, err := servecompany.CompanyInfoForUCenter(param.Companyid)
  419 + msg = protocol.NewReturnResponse(companydata, err)
420 return 420 return
421 } 421 }
422 422
@@ -82,6 +82,7 @@ func init() { @@ -82,6 +82,7 @@ func init() {
82 nsUcenter := beego.NewNamespace("/ucenter", 82 nsUcenter := beego.NewNamespace("/ucenter",
83 beego.NSBefore(middleware.LogRequestData), 83 beego.NSBefore(middleware.LogRequestData),
84 beego.NSRouter("/company", &controllers.CompanyController{}, "post:InitCompany"), 84 beego.NSRouter("/company", &controllers.CompanyController{}, "post:InitCompany"),
  85 + // beego.NSRouter("/company/info", &controllers.CompanyController{}, ""),
85 ) 86 )
86 beego.AddNamespace(nsV1) 87 beego.AddNamespace(nsV1)
87 beego.AddNamespace(nsAuth) 88 beego.AddNamespace(nsAuth)
@@ -466,13 +466,26 @@ func ForbidCompany(ucenterCompany int64) error { @@ -466,13 +466,26 @@ func ForbidCompany(ucenterCompany int64) error {
466 return nil 466 return nil
467 } 467 }
468 468
469 -func CompanyInfoForUCenter(uCenterid int64) {  
470 - // var (  
471 - // err error  
472 - // companyinfo *models.Company  
473 - // )  
474 - // companyinfo, err = models.GetCompanyByUCenter(uCenterid)  
475 - // if err != nil && err != orm.ErrNoRows {  
476 -  
477 - // } 469 +func CompanyInfoForUCenter(uCenterid int64) (protocol.ResponseCenterCompany, error) {
  470 + var (
  471 + err error
  472 + companyinfo *models.Company
  473 + resp protocol.ResponseCenterCompany
  474 + )
  475 + companyinfo, err = models.GetCompanyByUCenter(uCenterid)
  476 + if err != nil && err != orm.ErrNoRows {
  477 + return resp, protocol.NewErrWithMessage("1")
  478 + }
  479 + if err == orm.ErrNoRows {
  480 + resp.ExistNo()
  481 + return resp, nil
  482 + }
  483 + resp.ExistYes()
  484 + resp.UCenterCompanyId = companyinfo.UserCenterId
  485 + if ok := companyinfo.IsEnable(); ok {
  486 + resp.StatusYes()
  487 + } else {
  488 + resp.StatusNo()
  489 + }
  490 + return resp, nil
478 } 491 }