You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
1.5 KiB

package user
import (
"yunyan/comm"
"yunyan/pb"
"yunyan/sys/ipinfo"
)
// @Summary 获取第三方服务列表
// @Description 下发后台「第三方服务配置」:本应用作用域(应用覆盖全局)+按用户 IP 区域合并字段覆盖,凭据解密为明文
// @Tags User
// @Accept json
// @Produce json
// @Security BearerAuth
// @Param user body pb.UserGetThirdSvcsReq true "获取第三方服务列表"
// @Success 200 {object} comm.HttpResult{data=pb.UserGetThirdSvcsResp} "成功返回(整体响应体经 AES-CBC 加密,响应头 X-Encrypted:1)"
// @Router /api/home/user_getthirdsvcs_v2 [post]
//
// 注册在 apiV2Comp(Version=v2)上,路由 = user_getthirdsvcs_v2;已在 EncryptMsgs 中声明,
// 网关对整个响应体做 AES-CBC 加密——响应含第三方服务明文凭据,绝不能明文出网关。
// 解析口径与 v3 的 user_getappconfig_v3 共用 resolveThirdSvcs(见 svcresolve.go),两者结果一致。
func (this *apiV2Comp) GetThirdSvcs(session comm.IUserSession, req *pb.UserGetThirdSvcsReq) (resp *pb.UserGetThirdSvcsResp, errdata *pb.ErrorData) {
region := pb.Region_RegionUSA
if ipdata, _ := ipinfo.GetIPInfo(session.GetIP()); ipdata != nil {
region = ToRegion(ipdata)
}
items, err := resolveThirdSvcs(comm.AppName(), region, req.Ids)
if err != nil {
errdata = &pb.ErrorData{Code: pb.ErrorCode_DBError, Message: err.Error()}
return
}
resp = &pb.UserGetThirdSvcsResp{Svcs: filterSvcsByVip(session.GetUserId(), items)}
return
}