1- @model IEnumerable < MessageReceivedEntry >
1+ @model ReturnableViewModel < IList < WeixinReceivedMessageEntity > >
22
33@{
44 ViewData [" Title" ] = " Received Text" ;
55}
66
7- <h2 >@ViewData ["Title"] (@Model.Count()) </h2 >
7+ <h2 >@ViewData ["Title"] (@Model.Item. Count()) </h2 >
88
99
10- @foreach ( var item in Model .Where ( x => x is TextMessageReceivedEntry ). Select ( x => x as TextMessageReceivedEntry ). ToList () )
10+ @foreach ( var item in Model .Item )
1111{
12- // if (itemEntry is TextMessageReceivedEntry item)
13- {
14- <div class =" media" >
15- @* <img class="mr-3" src="@item.headimgurl" style="width:64px;" />*@
16- <div class =" media-body" >
17- @* <h5 class="mt-0">
18- <span>@item.From</span>
19- @{
20- switch (item.sex)
21- {
22- case 1:
23- <i class="fas fa-mars text-primary"></i>
24- break;
25- case 2:
26- <i class="fas fa-venus text-danger"></i>
27- break;
28- default:
29- break;
30- }
31- }
32- </h5>*@
33- <dl class =" dl-horizontal" >
34- <dt >OpenId </dt >
35- <dd >
36- <div class =" text-truncate" style =" width :150px ;" data-container =" body" data-toggle =" popover" data-placement =" bottom" data-content =" @item.FromUserName" >@item.FromUserName </div >
37- </dd >
12+ <div class =" media" >
13+ <div class =" media-body" >
14+ <dl class =" dl-horizontal" >
15+ <dt >OpenId </dt >
16+ <dd >
17+ <div class =" text-truncate" style =" width :150px ;" data-container =" body" data-toggle =" popover"
18+ data-placement =" bottom" data-content =" @item.FromUserName" >@item.FromUserName </div >
19+ </dd >
20+ @if (! string .IsNullOrEmpty (item .Content ))
21+ {
3822 <dt >Content </dt >
3923 <dd >@item.Content </dd >
40- <dt >Received Time </dt >
41- <dd >@item.GetCreateTime() ? .ToLocalTime ().ToString (" yyyy-MM-dd hh:mm:ss" )</dd >
42- </dl >
43- <a asp-action =" SendWeixin" asp-route-openid =" @item.FromUserName" >发送微信消息</a >
44- </div >
24+ }
25+ @if (! string .IsNullOrEmpty (item .Url ))
26+ {
27+ <dt >Url </dt >
28+ <dd >@item.Url </dd >
29+ }
30+ @if (! string .IsNullOrEmpty (item .PicUrl ))
31+ {
32+ <dt >PicUrl </dt >
33+ <dd >@item.PicUrl </dd >
34+ }
35+ @if (! string .IsNullOrEmpty (item .MediaId ))
36+ {
37+ <dt >media Id </dt >
38+ <dd >@item.MediaId </dd >
39+ }
40+ @if (! string .IsNullOrEmpty (item .ThumbMediaId ))
41+ {
42+ <dt >mThumbmedia Id </dt >
43+ <dd >@item.ThumbMediaId </dd >
44+ }
45+ <dt >Received Time </dt >
46+ <dd >@( new UnixDateTime (item .CreateTime ?? 0 ).DateTime .ToLocalTime ().ToString (" yyyy-MM-dd hh:mm:ss" )) </dd >
47+ </dl >
48+ <a asp-action =" SendWeixin" asp-route-openid =" @item.FromUserName" >发送微信消息</a >
4549 </div >
46- < hr / >
47- }
50+ </ div >
51+ < hr />
4852}
0 commit comments