Commit c3c0742c authored by 吴春's avatar 吴春

提交代码

parent f88c9060
...@@ -23,4 +23,38 @@ namespace Mall.Model.Extend.AppletWeChat ...@@ -23,4 +23,38 @@ namespace Mall.Model.Extend.AppletWeChat
/// </summary> /// </summary>
public string total { get; set; } public string total { get; set; }
} }
/// <summary>
/// 回放结果
/// </summary>
public class PlayBack
{
public List<LiveReplay> live_replay { get; set; }
public string errcode { get; set; }
public int total { get; set; }
public string errmsg { get; set; }
}
public class LiveReplay
{
/// <summary>
/// 回放视频url过期时间
/// </summary>
public string expire_time { get; set; }
/// <summary>
/// 回放视频创建时间
/// </summary>
public string create_time { get; set; }
/// <summary>
/// 回放视频链接
/// </summary>
public string media_url { get; set; }
}
} }
...@@ -1744,7 +1744,6 @@ namespace Mall.Module.User ...@@ -1744,7 +1744,6 @@ namespace Mall.Module.User
/// <returns></returns> /// <returns></returns>
public bool GetLiveInfo(RB_MiniProgram_Extend model) public bool GetLiveInfo(RB_MiniProgram_Extend model)
{ {
string token = WeiXinReidsCache.Get(model.MiniAppId); string token = WeiXinReidsCache.Get(model.MiniAppId);
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token))
{ {
...@@ -1786,7 +1785,46 @@ namespace Mall.Module.User ...@@ -1786,7 +1785,46 @@ namespace Mall.Module.User
} }
public Model.Extend.AppletWeChat.PlayBack GetLiveReplayInfo(RB_MiniProgram_Extend model, int room_id)
{
string token = WeiXinReidsCache.Get(model.MiniAppId);
if (string.IsNullOrEmpty(token))
{
token = Mall.Common.Pay.WeChatPat.TokenHelper.GetLXYToken(token, model.MiniAppId, model.MiniAppSecret);
System.Threading.Tasks.Task.Run(() => WeiXinReidsCache.Set(model.MiniAppId, token));
}
if (string.IsNullOrEmpty(token))
{
return new Model.Extend.AppletWeChat.PlayBack();
}
string wenXinResult = string.Empty;
if (!string.IsNullOrWhiteSpace(token))
{
string Url = " http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token;
var postdata = new
{
action = "get_replay",
room_id = room_id,
start = 0,
limit = 100
};
wenXinResult = HttpHelper.HttpPost(Url, JsonHelper.Serialize(postdata), "");
var newLiveHouse = JsonConvert.DeserializeObject<Model.Extend.AppletWeChat.PlayBack>(wenXinResult);
//JObject jo = (JObject)JsonConvert.DeserializeObject(wenXinResult);
//int errcode = Convert.ToInt32(jo["errcode"].ToString());
if (newLiveHouse.errcode == "0")
{
return newLiveHouse;
}
else
{
LogHelper.Write(string.Format("GetLiveInfo:wenXinResult:{0}", wenXinResult));
}
}
return new Model.Extend.AppletWeChat.PlayBack();
}
/// <summary> /// <summary>
/// 获取直播房间 /// 获取直播房间
......
...@@ -41,7 +41,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -41,7 +41,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
string jsonpath = projectUrl + "/miniProject/project.config.json"; string jsonpath = projectUrl + "/miniProject/project.config.json";
string jsonbasePath = projectUrl + "/project.configbase.json"; string jsonbasePath = projectUrl + "/project.configbase.json";
var model = appletWeChatModule.GetTenantListModule(query).FirstOrDefault(); var model = appletWeChatModule.GetTenantListModule(query).FirstOrDefault();
if (System.IO.File.Exists(path)&& System.IO.File.Exists(jsonpath)) if (System.IO.File.Exists(path) && System.IO.File.Exists(jsonpath))
{ {
try try
{ {
...@@ -168,7 +168,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -168,7 +168,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
int version = Convert.ToInt32(model.Version.Replace(".", "")); int version = Convert.ToInt32(model.Version.Replace(".", ""));
version += 1; version += 1;
model.Version = version.ToString().Substring(0, version.ToString().Length - 3) + "." + version.ToString().Substring(version.ToString().Length -3, 1) + "." + version.ToString().Substring(version.ToString().Length - 2, 2); model.Version = version.ToString().Substring(0, version.ToString().Length - 3) + "." + version.ToString().Substring(version.ToString().Length - 3, 1) + "." + version.ToString().Substring(version.ToString().Length - 2, 2);
string URL = $"http://127.0.0.1:{developerKitsPort}/v2/upload?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&version=V{model.Version}&desc=微信开发者工具HTTP上传&appid={model.MiniAppId}"; string URL = $"http://127.0.0.1:{developerKitsPort}/v2/upload?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&version=V{model.Version}&desc=微信开发者工具HTTP上传&appid={model.MiniAppId}";
string result = Mall.Common.Plugin.HttpHelper.HttpGet(URL, Encoding.UTF8, ""); string result = Mall.Common.Plugin.HttpHelper.HttpGet(URL, Encoding.UTF8, "");
...@@ -467,6 +467,28 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -467,6 +467,28 @@ namespace Mall.WebApi.Controllers.AppletWeChat
} }
/// <summary>
/// 获取直播房间回放信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetLiveReplayInfo()
{
var parmsInfo = RequestParm;
JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
int roomId = parmsJob.GetInt("roomId");
var appletWeChatModel = appletWeChatModule.GetTenantListModule(new RB_MiniProgram_Extend { TenantId = Convert.ToInt32(parmsInfo.uid), MallBaseId = parmsInfo.MallBaseId }).FirstOrDefault();
var model = appletWeChatModule.GetLiveReplayInfo(appletWeChatModel, roomId);
if (model.errcode == "0")
{
return ApiResult.Success("", model);
}
else
{
return ApiResult.Failed();
}
}
[HttpPost] [HttpPost]
......
...@@ -79,6 +79,9 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -79,6 +79,9 @@ namespace Mall.WebApi.Controllers.MallBase
PaymentWayName = x.PaymentWay.GetEnumName(), PaymentWayName = x.PaymentWay.GetEnumName(),
DetailList = x.DetailList.Select(y => new DetailList = x.DetailList.Select(y => new
{ {
y.FreightCostMoney,
y.FreightMoney,
y.CostMoney,
y.Id, y.Id,
y.CoverImage, y.CoverImage,
y.CoverImagePath, y.CoverImagePath,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment