电话
13363039260
演示如下代码:
@{ int uid =1;//用户id,自行替换掉 var dbContext = DbHelper.DbContext(); dbContext.AddDbParamter("id", uid); var nickName = "";//昵称 var username = "";//用户名 var avatar = "";//头像图片 dynamic memberData = dbContext.Query("pa_member", "*", "id=@id").FirstOrDefault(); if (memberData != null) { username = memberData.Username; avatar = memberData.avatar; nickName = memberData.NickName; if (string.IsNullOrEmpty(nickName)) { nickName = username;//未设置昵称情况下采用用户名; } if (string.IsNullOrEmpty(avatar)) { avatar = "/areas/member/css/images/DefaultAvatar.png";//未设置头像时采用默认头像 } } } <div>用户名:@username</div> <div>昵称:@nickName</div> <div>头像:<img src="@avatar" /></div>
用户表的其他字段可以在后台>系统>系统表中搜索:pa_member,在预定义字段中查看,如下图: