作者 yangfu

增加 服务配置接口

@@ -43,4 +43,7 @@ h5_host = "http://mmm-web-open-test.fjmaimaimai.com" @@ -43,4 +43,7 @@ h5_host = "http://mmm-web-open-test.fjmaimaimai.com"
43 suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" 43 suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com"
44 44
45 #阿里云 45 #阿里云
46 -cname ="https://media.fjmaimaimai.com/"  
  46 +cname ="https://media.fjmaimaimai.com/"
  47 +
  48 +#服务地址
  49 +VOD_SVR_ADDRESS ="http://mmm-open-api-dev.fjmaimaimai.com"
@@ -47,4 +47,7 @@ suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" @@ -47,4 +47,7 @@ suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com"
47 cname ="https://media.fjmaimaimai.com/" 47 cname ="https://media.fjmaimaimai.com/"
48 48
49 #企业平台 49 #企业平台
50 -BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-test.fjmaimaimai.com}"  
  50 +BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-test.fjmaimaimai.com}"
  51 +
  52 +#服务地址
  53 +VOD_SVR_ADDRESS ="http://mmm-open-api-dev.fjmaimaimai.com"
@@ -46,4 +46,7 @@ suplus_approve_host ="https://public-interface.fjmaimaimai.com/approve" @@ -46,4 +46,7 @@ suplus_approve_host ="https://public-interface.fjmaimaimai.com/approve"
46 BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-prd.fjmaimaimai.com}" 46 BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-prd.fjmaimaimai.com}"
47 47
48 #阿里云 48 #阿里云
49 -cname ="https://media.fjmaimaimai.com/"  
  49 +cname ="https://media.fjmaimaimai.com/"
  50 +
  51 +#服务地址
  52 +VOD_SVR_ADDRESS ="http://mmm-open-api-prd.fjmaimaimai.com"
@@ -46,4 +46,7 @@ suplus_approve_host ="http://suplus-approve-test.fjmaimaimai.com" @@ -46,4 +46,7 @@ suplus_approve_host ="http://suplus-approve-test.fjmaimaimai.com"
46 cname ="https://media.fjmaimaimai.com/" 46 cname ="https://media.fjmaimaimai.com/"
47 47
48 #企业平台 48 #企业平台
49 -BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-test.fjmaimaimai.com}"  
  49 +BUSINESS_ADMIN_SERVICE_HOST ="${BUSINESS_ADMIN_SERVICE_HOST||http://suplus-business-admin-test.fjmaimaimai.com}"
  50 +
  51 +#服务地址
  52 +VOD_SVR_ADDRESS ="http://mmm-open-api-test.fjmaimaimai.com"
@@ -34,3 +34,24 @@ func (this *ConfigController) GetConfigScore() { @@ -34,3 +34,24 @@ func (this *ConfigController) GetConfigScore() {
34 header := controllers.GetRequestHeader(this.Ctx) 34 header := controllers.GetRequestHeader(this.Ctx)
35 msg = protocol.NewReturnResponse(config.GetConfigScore(header, request)) 35 msg = protocol.NewReturnResponse(config.GetConfigScore(header, request))
36 } 36 }
  37 +
  38 +//ServiceConfig 服务配置
  39 +//@router /service [post]
  40 +func (this *ConfigController) ServiceConfig() {
  41 + var msg *protocol.ResponseMessage
  42 + defer func() {
  43 + this.Resp(msg)
  44 + }()
  45 + var request *protocol.ServiceConfigRequest
  46 + if err := json.Unmarshal(this.ByteBody, &request); err != nil {
  47 + log.Error(err)
  48 + msg = protocol.BadRequestParam(1)
  49 + return
  50 + }
  51 + if b, m := this.Valid(request); !b {
  52 + msg = m
  53 + return
  54 + }
  55 + header := controllers.GetRequestHeader(this.Ctx)
  56 + msg = protocol.NewReturnResponse(config.ServiceConfig(header, request))
  57 +}
@@ -32,3 +32,19 @@ type ScoreRange struct { @@ -32,3 +32,19 @@ type ScoreRange struct {
32 Max float64 `json:"max"` //最大分 32 Max float64 `json:"max"` //最大分
33 Step float64 `json:"step"` //步长 33 Step float64 `json:"step"` //步长
34 } 34 }
  35 +
  36 +/*ServiceConfig 服务配置*/
  37 +type ServiceConfigRequest struct {
  38 +}
  39 +type ServiceConfigResponse struct {
  40 + ServeConfig *ServeConfig `json:"serveConfig"` //服务配置
  41 +}
  42 +
  43 +type ServeConfig struct {
  44 + VodAddress string `json:"vodSvrAddress"` //视频服务地址
  45 +}
  46 +
  47 +func (s *ServeConfig) SetVodAddress(addr string) *ServeConfig {
  48 + s.VodAddress = addr
  49 + return s
  50 +}
@@ -407,6 +407,14 @@ func init() { @@ -407,6 +407,14 @@ func init() {
407 MethodParams: param.Make(), 407 MethodParams: param.Make(),
408 Params: nil}) 408 Params: nil})
409 409
  410 + beego.GlobalControllerRouter["opp/controllers/v1:ConfigController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ConfigController"],
  411 + beego.ControllerComments{
  412 + Method: "ServiceConfig",
  413 + Router: `/service`,
  414 + AllowHTTPMethods: []string{"post"},
  415 + MethodParams: param.Make(),
  416 + Params: nil})
  417 +
410 beego.GlobalControllerRouter["opp/controllers/v1:DepartmentController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:DepartmentController"], 418 beego.GlobalControllerRouter["opp/controllers/v1:DepartmentController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:DepartmentController"],
411 beego.ControllerComments{ 419 beego.ControllerComments{
412 Method: "Departments", 420 Method: "Departments",
@@ -2,6 +2,7 @@ package config @@ -2,6 +2,7 @@ package config
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
  5 + "github.com/astaxie/beego"
5 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" 6 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
6 "opp/models" 7 "opp/models"
7 "opp/protocol" 8 "opp/protocol"
@@ -22,3 +23,13 @@ func GetConfigScore(header *protocol.RequestHeader, request *protocol.GetConfigS @@ -22,3 +23,13 @@ func GetConfigScore(header *protocol.RequestHeader, request *protocol.GetConfigS
22 } 23 }
23 return 24 return
24 } 25 }
  26 +
  27 +//ServiceConfig 服务配置
  28 +func ServiceConfig(header *protocol.RequestHeader, request *protocol.ServiceConfigRequest) (rsp *protocol.ServiceConfigResponse, err error) {
  29 + var ()
  30 + rsp = &protocol.ServiceConfigResponse{
  31 + ServeConfig: new(protocol.ServeConfig),
  32 + }
  33 + rsp.ServeConfig.SetVodAddress(beego.AppConfig.String("VOD_SVR_ADDRESS"))
  34 + return
  35 +}