1- @model ReturnableViewModel <IEnumerable < MessageReceivedEntry >>
1+ @model ReturnableViewModel <IList < WeixinReceivedMessageEntity >>
22
33@{
44 ViewData [" Title" ] = " Received Text" ;
55}
66
77<h2 >@ViewData ["Title"] (@Model.Item.Count()) </h2 >
88
9-
10- @foreach ( var item in Model .Item .Where (x => x is TextMessageReceivedEntry ).Select (x => x as TextMessageReceivedEntry ).ToList ())
9+ @foreach ( var item in Model .Item )
1110{
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 >
11+ <div class =" media" >
12+ <div class =" media-body" >
13+ <dl class =" dl-horizontal" >
14+ <dt >OpenId </dt >
15+ <dd >
16+ <div class =" text-truncate" style =" width :150px ;" data-container =" body" data-toggle =" popover"
17+ data-placement =" bottom" data-content =" @item.FromUserName" >@item.FromUserName </div >
18+ </dd >
19+ @if (! string .IsNullOrEmpty (item .Content ))
20+ {
3821 <dt >Content </dt >
3922 <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 >
23+ }
24+ @if (! string .IsNullOrEmpty (item .Url ))
25+ {
26+ <dt >Url </dt >
27+ <dd >@item.Url </dd >
28+ }
29+ @if (! string .IsNullOrEmpty (item .PicUrl ))
30+ {
31+ <dt >PicUrl </dt >
32+ <dd >@item.PicUrl </dd >
33+ }
34+ @if (! string .IsNullOrEmpty (item .MediaId ))
35+ {
36+ <dt >media Id </dt >
37+ <dd >@item.MediaId </dd >
38+ }
39+ @if (! string .IsNullOrEmpty (item .ThumbMediaId ))
40+ {
41+ <dt >mThumbmedia Id </dt >
42+ <dd >@item.ThumbMediaId </dd >
43+ }
44+ <dt >Received Time </dt >
45+ <dd >@( new UnixDateTime (item .CreateTime ?? 0 ).DateTime .ToLocalTime ().ToString (" yyyy-MM-dd hh:mm:ss" )) </dd >
46+ </dl >
47+ <a asp-action =" SendWeixin" asp-route-openid =" @item.FromUserName" >发送微信消息</a >
4548 </div >
46- < hr / >
47- }
49+ </ div >
50+ < hr />
4851}
0 commit comments