diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
index fa4f80e0..2beebdf1 100644
--- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs
+++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
@@ -889,6 +889,12 @@ namespace CoreCms.Net.Configuration
public static readonly string ContinuousCheckInPeriodType = "continuousCheckInPeriodType";
+ ///
+ /// 显示直播入口
+ ///
+ public static readonly string ShowLiveBroadCast = "showLiveBroadCast";
+
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
index 2ce86472..6c18139d 100644
--- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs
+++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
@@ -256,6 +256,11 @@ namespace CoreCms.Net.Configuration
di.Add(SystemSettingConstVars.CheckInCommonType, new DictionaryKeyValues() { sKey = "签到赠送类型", sValue = GlobalEnumVars.CheckInCommonType.积分.ToString() });
di.Add(SystemSettingConstVars.ContinuousCheckInPeriodType, new DictionaryKeyValues() { sKey = "连续签到周期", sValue = GlobalEnumVars.ContinuousCheckInPeriodType.不限.ToString() });
+ //小程序直播
+ di.Add(SystemSettingConstVars.ShowLiveBroadCast, new DictionaryKeyValues() { sKey = "显示小程序直播入口", sValue = "2" });
+
+
+
return di;
}
diff --git a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
index f7186b31..558a9a85 100644
--- a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
+++ b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
@@ -405,6 +405,10 @@ const install = (Vue, vm) => {
let getSolitaireDetail = (params, config = {}) => http.post('/Api/Solitaire/GetDetail', params, { custom: { methodName: 'solitaire.getDetail', needToken: false } });
+ //直播
+ let getLiveInfo = (params, config = {}) => http.post('/Api/LiveBroadCast/GetLiveInfo', params, { custom: { methodName: 'liveBroadCast.getLiveInfo', needToken: false } });
+
+
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
vm.$u.api = {
shopConfigV2,
@@ -596,7 +600,9 @@ const install = (Vue, vm) => {
serviceVerificationTicket,
getSolitairePageList,
- getSolitaireDetail
+ getSolitaireDetail,
+
+ getLiveInfo
};
}
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages.json b/CoreCms.Net.Uni-App/CoreShop/pages.json
index 78eb5461..8ccbf2a7 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages.json
+++ b/CoreCms.Net.Uni-App/CoreShop/pages.json
@@ -51,6 +51,25 @@
}
],
"subpackages": [
+ {
+ "root": "pages/livebroadcast",
+ "name": "livebroadcast",
+ "pages": [
+ {
+ "path": "index/index",
+ "style": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "直播间"
+ }
+ }
+ ],
+ "plugins": {
+ "live-player-plugin": {
+ "version": "1.3.5", // 注意该直播组件最新版本号
+ "provider": "wx2b03c6e691cd7370" // 必须填该直播组件appid,不是小程序的appid
+ }
+ }
+ },
{
"root": "pages/article",
"name": "article",
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
index a3d0ead0..128d4eb2 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
@@ -367,6 +367,12 @@
router: '/pages/form/list/list',
showItem: false
},
+ livebroadcast: {
+ name: '直播',
+ icon: 'play-circle',
+ router: '/pages/livebroadcast/index/index',
+ showItem: false
+ },
},
other: {
invite: {
@@ -510,6 +516,8 @@
_this.vas.calendar.showItem = _this.config.showCalendar == 1;
//自定义表单
_this.vas.customForm.showItem = _this.config.showCustomForm == 1;
+ //是否显示直播
+ _this.vas.livebroadcast.showItem = _this.config.showLiveBroadCast == 1;
//显示我的发票
_this.utilityMenus.myInvoice.showItem = _this.config.invoiceSwitch == 1;
//获取用户信息
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue
new file mode 100644
index 00000000..f84a5c0e
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/livebroadcast/index/index.vue
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+ 主播:
+
+ {{ 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')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs b/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs
new file mode 100644
index 00000000..545782fe
--- /dev/null
+++ b/CoreCms.Net.Web.WebApi/Controllers/LiveBroadCastController.cs
@@ -0,0 +1,71 @@
+using CoreCms.Net.Caching.AccressToken;
+using CoreCms.Net.Model.FromBody;
+using CoreCms.Net.Model.ViewModels.UI;
+using CoreCms.Net.WeChat.Service.HttpClients;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using SKIT.FlurlHttpClient.Wechat.Api.Models;
+using System.Threading.Tasks;
+using SKIT.FlurlHttpClient.Wechat.Api;
+
+namespace CoreCms.Net.Web.WebApi.Controllers
+{
+ ///
+ /// 小程序内置直播功能
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class LiveBroadCastController : ControllerBase
+ {
+ private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
+
+ ///
+ /// 构造函数
+ ///
+ ///
+ public LiveBroadCastController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
+ {
+ _weChatApiHttpClientFactory = weChatApiHttpClientFactory;
+ }
+
+
+ #region 获取直播间列表和回放
+ ///
+ /// 获取直播间列表和回放
+ ///
+ ///
+ [HttpPost]
+ public async Task GetLiveInfo([FromBody] FMPageByIntId entity)
+ {
+ var jm = new WebApiCallBack();
+
+ var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
+ var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
+
+ var request = new WxaBusinessGetLiveInfoRequest
+ {
+ AccessToken = accessToken,
+ Limit = entity.limit,
+ };
+
+ var response = await client.ExecuteWxaBusinessGetLiveInfoAsync(request);
+ if (response.IsSuccessful())
+ {
+ jm.status = true;
+ jm.data = response;
+ }
+ else
+ {
+ jm.status = false;
+ jm.msg = response.ErrorCode == 9410000 ? "直播间列表为空" : response.ErrorMessage;
+ jm.otherData = response;
+ }
+ return jm;
+ }
+ #endregion
+
+
+
+
+ }
+}