MeiRiYiCheng_1_old/YBDevice.CommonService/DefaultService.cs

34 lines
1.4 KiB
C#

using Furion;
using YBDevice.Entity;
namespace YBDevice.CommonService
{
public class DefaultService
{
public static string APICDNURL = App.Configuration["APICDNURL"];//API图片CDN地址
public DefaultService()
{
if (string.IsNullOrEmpty(APICDNURL))
{
APICDNURL = App.Configuration["CustomSetting:CDNURL"];
}
}
/// <summary>
/// 加载默认头像
/// </summary>
/// <param name="sex">性别,1-男,2-女</param>
/// <param name="type">类型,1-成人,2-儿童</param>
/// <returns></returns>
public static string HeadImg(GenderType sex, FamilyType type)
=> (sex, type) switch
{
_ when sex == GenderType.Male && type == FamilyType.Adult => $"{APICDNURL}/img/adult_male.png",
_ when sex == GenderType.FeMale && type == FamilyType.Adult => $"{APICDNURL}/img/adult_female.png",
_ when sex == GenderType.Male && type == FamilyType.Children => $"{APICDNURL}/img/child_male.png",
_ when sex == GenderType.FeMale && type == FamilyType.Children => $"{APICDNURL}/img/child_female.png",
_ when sex == GenderType.UnKnow && type == FamilyType.Adult=> $"{APICDNURL}/img/adult_male.png",
_ => $"{APICDNURL}/img/child_male.png"
};
}
}