diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml index 0b433418..95f4e7b6 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.xml +++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml @@ -13190,5 +13190,10 @@ 订单号 + + + 扩展 表示 [POST] /wxa/business/getliveinfo 接口的请求。 + + diff --git a/CoreCms.Net.Model/WeChatEntites/MyWxaBusinessGetLiveInfoRequest.cs b/CoreCms.Net.Model/WeChatEntites/MyWxaBusinessGetLiveInfoRequest.cs new file mode 100644 index 00000000..0700a717 --- /dev/null +++ b/CoreCms.Net.Model/WeChatEntites/MyWxaBusinessGetLiveInfoRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Model.WeChatEntites +{ + /// + /// 扩展 表示 [POST] /wxa/business/getliveinfo 接口的请求。 + /// + public class MyWxaBusinessGetLiveInfoRequest : SKIT.FlurlHttpClient.Wechat.Api.Models.WxaBusinessGetLiveInfoRequest + { + [Newtonsoft.Json.JsonProperty("action")] + [System.Text.Json.Serialization.JsonPropertyName("action")] + public string Action { get; set; } + } +} diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue index f84a5c0e..7fe696e8 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue @@ -10,61 +10,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ item.name }} + + - - - - - + + + 主播: + + {{ item.anchor_name }} + | + 直播商品:{{ item.goods.length }}件 - - - - - - - - - - - - - - - - - - - - - - - {{ item.name }} + + 直播时间:{{$u.timeFormat(item.start_time, 'yyyy-mm-dd hh:MM:ss')}} 至 {{$u.timeFormat(item.end_time, 'yyyy-mm-dd hh:MM:ss')}} - - - - 主播: - - {{ item.anchor_name }} - | - 直播商品:{{ item.goods.length }}件 - - - 直播时间:{{$u.timeFormat(item.start_time, 'yyyy-mm-dd hh:MM:ss')}} 至 {{$u.timeFormat(item.end_time, 'yyyy-mm-dd hh:MM:ss')}} + + - - + + + - - - - - - @@ -75,8 +77,10 @@ export default { data() { return { + items: ['直播计划', '历史直播'], + current: 0, page: 1, - limit: 10, + limit: 50, list: [], status: 'loadmore', iconType: 'flower', @@ -119,11 +123,30 @@ }, }, methods: { + // tab点击切换 + onClickItem(index) { + if (this.current !== index) { + this.current = index; + this.page = 1; + this.list = []; + this.getList(); + } + }, getList() { let data = { page: this.page, limit: this.limit, }; + if (this.current == 0) { + data['where'] = ''; + } + if (this.current == 1) { + data['where'] = 'get_replay'; + } + uni.showLoading({ + title: '加载中', + mask: true + }); this.status = 'loading'; this.$u.api.getLiveInfo(data).then(res => { if (res.status) { @@ -132,12 +155,15 @@ if (res.data.total > this.list.length) { this.status = 'loadmore'; this.page++; + uni.hideLoading(); } else { // 数据已加载完毕 this.status = 'nomore'; + uni.hideLoading(); } } else { // 接口请求出错了 + uni.hideLoading(); this.$u.toast(res.msg); } }); diff --git a/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs b/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs index 545782fe..60a40b19 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using SKIT.FlurlHttpClient.Wechat.Api.Models; using System.Threading.Tasks; using SKIT.FlurlHttpClient.Wechat.Api; +using CoreCms.Net.Model.WeChatEntites; namespace CoreCms.Net.Web.WebApi.Controllers { @@ -42,10 +43,12 @@ namespace CoreCms.Net.Web.WebApi.Controllers var client = _weChatApiHttpClientFactory.CreateWxOpenClient(); var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken(); - var request = new WxaBusinessGetLiveInfoRequest + var request = new MyWxaBusinessGetLiveInfoRequest { AccessToken = accessToken, Limit = entity.limit, + Offset = (entity.page - 1) * entity.limit, + Action = !string.IsNullOrEmpty(entity.where) ? "get_replay" : "" }; var response = await client.ExecuteWxaBusinessGetLiveInfoAsync(request); @@ -57,7 +60,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers else { jm.status = false; - jm.msg = response.ErrorCode == 9410000 ? "直播间列表为空" : response.ErrorMessage; + jm.msg = response.ErrorCode == 9410000 ? "暂无直播信息" : response.ErrorMessage; jm.otherData = response; } return jm;