处理链接为默认值的问题
This commit is contained in:
parent
11c926fbfb
commit
12c5379d78
@ -1,6 +1,8 @@
|
||||
package adminResponse
|
||||
|
||||
import "hospital-admin-api/config"
|
||||
import (
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
// Login 登陆
|
||||
type Login struct {
|
||||
@ -12,6 +14,6 @@ type Login struct {
|
||||
|
||||
// GetFullAvatar 返回带有指定字符串的头像路径
|
||||
func (l *Login) GetFullAvatar() Login {
|
||||
l.Avatar = config.C.Oss.OssCustomDomainName + "/" + l.Avatar
|
||||
l.Avatar = utils.AddOssDomain(l.Avatar)
|
||||
return Login{}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package adminUserResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -102,7 +102,7 @@ func GetUserPageResponse(adminUser []*model.AdminUser) []getUserPage {
|
||||
IsDisabled: v.IsDisabled,
|
||||
NickName: v.NickName,
|
||||
Phone: v.Phone,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + v.Avatar,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
Sex: v.Sex,
|
||||
Email: v.Email,
|
||||
RoleID: strconv.Itoa(int(v.RoleID)),
|
||||
@ -133,7 +133,7 @@ func GetUserResponse(adminUser *model.AdminUser) *getUser {
|
||||
IsDisabled: adminUser.IsDisabled,
|
||||
NickName: adminUser.NickName,
|
||||
Phone: adminUser.Phone,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + adminUser.Avatar,
|
||||
Avatar: utils.AddOssDomain(adminUser.Avatar),
|
||||
Sex: adminUser.Sex,
|
||||
Email: adminUser.Email,
|
||||
RoleID: strconv.FormatInt(adminUser.RoleID, 10),
|
||||
|
||||
@ -2,7 +2,7 @@ package basicBankResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -22,8 +22,8 @@ func BasicBankResponse(basicBank *model.BasicBank) *BasicBank {
|
||||
BankId: strconv.FormatInt(basicBank.BankId, 10),
|
||||
BankCode: basicBank.BankCode,
|
||||
BankName: basicBank.BankName,
|
||||
BankIconPath: config.C.Oss.OssCustomDomainName + basicBank.BankIconPath,
|
||||
BankImgPath: config.C.Oss.OssCustomDomainName + basicBank.BankImgPath,
|
||||
BankIconPath: utils.AddOssDomain(basicBank.BankIconPath),
|
||||
BankImgPath: utils.AddOssDomain(basicBank.BankImgPath),
|
||||
CreatedAt: basicBank.CreatedAt,
|
||||
UpdatedAt: basicBank.UpdatedAt,
|
||||
}
|
||||
@ -41,8 +41,8 @@ func GetBasicBankListResponse(basicBank []*model.BasicBank) []BasicBank {
|
||||
BankId: strconv.FormatInt(v.BankId, 10),
|
||||
BankCode: v.BankCode,
|
||||
BankName: v.BankName,
|
||||
BankIconPath: config.C.Oss.OssCustomDomainName + v.BankIconPath,
|
||||
BankImgPath: config.C.Oss.OssCustomDomainName + v.BankImgPath,
|
||||
BankIconPath: utils.AddOssDomain(v.BankIconPath),
|
||||
BankImgPath: utils.AddOssDomain(v.BankImgPath),
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package userDoctorInfoResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@ -34,7 +34,7 @@ func UserDoctorInfoResponse(userDoctorInfo *model.UserDoctorInfo) *UserDoctorInf
|
||||
result := strings.Split(userDoctorInfo.LicenseCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = config.C.Oss.OssCustomDomainName + v
|
||||
v = utils.AddOssDomain(v)
|
||||
licenseCert = append(licenseCert, v)
|
||||
}
|
||||
}
|
||||
@ -45,7 +45,7 @@ func UserDoctorInfoResponse(userDoctorInfo *model.UserDoctorInfo) *UserDoctorInf
|
||||
result := strings.Split(userDoctorInfo.QualificationCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = config.C.Oss.OssCustomDomainName + v
|
||||
v = utils.AddOssDomain(v)
|
||||
qualificationCert = append(qualificationCert, v)
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ func UserDoctorInfoResponse(userDoctorInfo *model.UserDoctorInfo) *UserDoctorInf
|
||||
result := strings.Split(userDoctorInfo.WorkCert, ",")
|
||||
if len(result) > 0 {
|
||||
for _, v := range result {
|
||||
v = config.C.Oss.OssCustomDomainName + v
|
||||
v = utils.AddOssDomain(v)
|
||||
workCert = append(workCert, v)
|
||||
}
|
||||
}
|
||||
@ -85,8 +85,8 @@ func UserDoctorInfoResponse(userDoctorInfo *model.UserDoctorInfo) *UserDoctorInf
|
||||
QualificationCertNum: userDoctorInfo.QualificationCertNum,
|
||||
WorkCert: workCert,
|
||||
MultiPointImages: multiPointImages,
|
||||
IdCardFront: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.IdCardFront,
|
||||
IdCardBack: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.IdCardBack,
|
||||
SignImage: config.C.Oss.OssCustomDomainName + "/" + userDoctorInfo.SignImage,
|
||||
IdCardFront: utils.AddOssDomain(userDoctorInfo.IdCardFront),
|
||||
IdCardBack: utils.AddOssDomain(userDoctorInfo.IdCardBack),
|
||||
SignImage: utils.AddOssDomain(userDoctorInfo.SignImage),
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"hospital-admin-api/api/responses/hospitalResponse"
|
||||
"hospital-admin-api/api/responses/userDoctorInfoResponse"
|
||||
"hospital-admin-api/api/responses/userResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -223,7 +223,7 @@ func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPa
|
||||
MultiPointFailReason: v.MultiPointFailReason,
|
||||
IsBindBank: v.IsBindBank,
|
||||
IsRecommend: v.IsRecommend,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + v.Avatar,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DoctorTitle: v.DoctorTitle,
|
||||
DepartmentCustomName: v.DepartmentCustomName,
|
||||
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
||||
@ -276,7 +276,7 @@ func GetUserDoctorPendingPageResponse(userDoctor []*model.UserDoctor) []getUserD
|
||||
IdenAuthStatus: v.IdenAuthStatus,
|
||||
IdenAuthTime: v.IdenAuthTime,
|
||||
IdenAuthFailReason: v.IdenAuthFailReason,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + v.Avatar,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DoctorTitle: v.DoctorTitle,
|
||||
DepartmentCustomName: v.DepartmentCustomName,
|
||||
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
||||
@ -320,7 +320,7 @@ func GetMultiPageResponse(userDoctor []*model.UserDoctor) []GetMultiPage {
|
||||
MultiPointStatus: v.MultiPointStatus,
|
||||
MultiPointTime: v.MultiPointTime,
|
||||
MultiPointFailReason: v.MultiPointFailReason,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + v.Avatar,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DoctorTitle: v.DoctorTitle,
|
||||
DepartmentCustomName: v.DepartmentCustomName,
|
||||
DepartmentCustomMobile: v.DepartmentCustomMobile,
|
||||
|
||||
@ -2,7 +2,7 @@ package userResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -38,7 +38,7 @@ func UserResponse(user *model.User) *User {
|
||||
RegisterMethod: user.RegisterMethod,
|
||||
Age: user.Age,
|
||||
Sex: user.Sex,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + "/" + user.Avatar,
|
||||
Avatar: utils.AddOssDomain(user.Avatar),
|
||||
LoginIP: user.LoginIp,
|
||||
LastLoginAt: user.LastLoginAt,
|
||||
CreatedBy: user.CreatedBy,
|
||||
|
||||
@ -79,7 +79,7 @@ func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse
|
||||
MultiPointFailReason: userDoctor.MultiPointFailReason,
|
||||
IsBindBank: userDoctor.IsBindBank,
|
||||
IsRecommend: userDoctor.IsRecommend,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + userDoctor.Avatar,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
@ -94,7 +94,7 @@ func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse
|
||||
IsImgQuickReception: userDoctor.IsImgQuickReception,
|
||||
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: userDoctor.IsSysDiagnoCooperation,
|
||||
QrCode: config.C.Oss.OssCustomDomainName + userDoctor.QrCode,
|
||||
QrCode: utils.AddOssDomain(userDoctor.QrCode),
|
||||
BeGoodAt: userDoctor.BeGoodAt,
|
||||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
@ -934,7 +934,7 @@ func (r *UserDoctorService) GetUserDoctorPending(doctorId int64) (g *userDoctorR
|
||||
IdenAuthStatus: userDoctor.IdenAuthStatus,
|
||||
IdenAuthTime: userDoctor.IdenAuthTime,
|
||||
IdenAuthFailReason: IdenAuthFailReason,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + userDoctor.Avatar,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
@ -1209,7 +1209,7 @@ func (r *UserDoctorService) GetMulti(doctorId int64) (g *userDoctorResponse.GetM
|
||||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||||
MultiPointTime: userDoctor.MultiPointTime,
|
||||
MultiPointFailReason: userDoctor.MultiPointFailReason,
|
||||
Avatar: config.C.Oss.OssCustomDomainName + userDoctor.Avatar,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
|
||||
@ -9,3 +9,11 @@ import (
|
||||
func RemoveOssDomain(url string) string {
|
||||
return strings.Replace(url, config.C.Oss.OssCustomDomainName, "", 1)
|
||||
}
|
||||
|
||||
// AddOssDomain 去除oss地址中的前缀
|
||||
func AddOssDomain(url string) string {
|
||||
if url == "" {
|
||||
return ""
|
||||
}
|
||||
return config.C.Oss.OssCustomDomainName + url
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user