Commit efbc6c4c authored by liudong1993's avatar liudong1993
parents 62543efb bc28b6ba
......@@ -60,7 +60,7 @@ namespace Mall.Common.Pay.WeChatPat
s.Flush();
s.Close();
s.Dispose();
Plugin.LogHelper.Write($"GetNotifyData Receive data from WeChat :{builder.ToString()}");
Plugin.LogHelper.WriteInfo($"GetNotifyData Receive data from WeChat :{builder.ToString()}");
//转换数据格式并验证签名
// WxPayData data = new WxPayData();
......@@ -77,12 +77,10 @@ namespace Mall.Common.Pay.WeChatPat
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "ResponseHandler");
//若签名错误,则立即返回结果给微信支付后台
Plugin.LogHelper.Error($"ResponseHandler xml错误",ex);
Common.Plugin.LogHelper.Write(ex, "ResponseHandler");
}
Plugin.LogHelper.Write($"GetNotifyData Check sign success");
Plugin.LogHelper.WriteInfo($"GetNotifyData Check sign success");
}
/// <summary>
......
......@@ -32,52 +32,6 @@ namespace Mall.Common.Plugin
return resultFileList;
}
/// <summary>
/// 取得用户客户端IP(穿过代理服务器取远程用户真实IP地址)
/// </summary>
//public static string GetClientIP()
//{
// try
// {
// if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
// {
// return HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
// }
// else
// {
// return HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
// }
// }
// catch
// {
// return "0.0.0.0";
// }
//}
/// <summary>
/// 获取当前域名
/// </summary>
/// <returns></returns>
//public static string GetDomain()
//{
// try
// {
// string Domain = HttpContext.Current.Request.Url.Host;
// if (Domain == null || string.IsNullOrEmpty(Domain))
// {
// return "";
// }
// else
// {
// return Domain;
// }
// }
// catch
// {
// return "";
// }
//}
/// <summary>
/// 根据出生日期判断人的类型
/// </summary>
......
......@@ -30,17 +30,7 @@ namespace Mall.Common.Plugin
Directory.CreateDirectory(requestLogDir);
}
/// <summary>
/// 错误日志
/// </summary>
/// <param name="msg">信息</param>
/// <param name="exception">异常内容</param>
public static void Error(string msg, Exception exception)
{
Write(exception, msg);
}
/// <summary>
/// 写日志(异常日志)
/// </summary>
......@@ -78,18 +68,6 @@ namespace Mall.Common.Plugin
Task.Run(() => WriteLog(null, msg, LogEnum.Info));
}
/// <summary>
/// 接口请求信息(记录信息)
/// </summary>
/// <param name="msg">信息</param>
public static void RequestInfo(string msg)
{
string isOpenRequestLog = ConfigurationManager.AppSettings["OpenRequestLog"].ToString();
if ("true".Equals(isOpenRequestLog))
{
Task.Run(() => WriteLog(null, msg, LogEnum.Request));
}
}
/// <summary>
/// 写日志
......
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Entity.AppletWeChat
{
/// <summary>
/// 直播海报配置实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Live_Config
{
/// <summary>
/// 主键Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 海报背景图
/// </summary>
public string LiveBgImg { get; set; }
/// <summary>
/// 二维码大小
/// </summary>
public int? LiveQrCodeSize { get; set; }
/// <summary>
/// 二维码上间距
/// </summary>
public int? LiveQrCodePaddingTop { get; set; }
/// <summary>
/// 二维码左间距
/// </summary>
public int? LiveQrCodePaddingLeft { get; set; }
/// <summary>
/// 二维码形状(0-圆形,1-方形)
/// </summary>
public int? LiveQrCodeType { get; set; }
/// <summary>
/// 商户Id
/// </summary>
public int? TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int? MallBaseId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate { get; set; }
}
}
......@@ -444,5 +444,15 @@ namespace Mall.Model.Entity.Product
/// 是否是直播商品 1是 2否
/// </summary>
public int? IsLiveGoods { get; set; }
/// <summary>
/// 自动上架时间
/// </summary>
public DateTime? ShelvesDate { get; set; }
/// <summary>
/// 自动下架时间
/// </summary>
public DateTime? DownDate { get; set; }
}
}
......@@ -162,5 +162,10 @@ namespace Mall.Model.Entity.User
/// 会员权益描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 粉象等级图标
/// </summary>
public string Icon { get; set; }
}
}
using Mall.Model.Entity.AppletWeChat;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Extend.AppletWeChat
{
/// <summary>
/// 直播海报配置扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Live_Config_Extend : RB_Live_Config
{
}
}
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Common.Enum.Goods;
using Mall.Model.Entity.User;
namespace Mall.Model.Extend.Product
{
......@@ -114,6 +115,12 @@ namespace Mall.Model.Extend.Product
/// 订单返佣列表
/// </summary>
public List<RB_SmallShops_Commission_Extend> SmallShopsCommissionOrderList { get; set; }
/// <summary>
/// 优惠券信息 //2020-08-25 Add By:w
/// </summary>
public List<User.RB_Member_DiscountCoupon_Extend> MemberDiscountCouponList { get; set; }
/// <summary>
/// 是否发放佣金 1是 2否
/// </summary>
......@@ -178,7 +185,7 @@ namespace Mall.Model.Extend.Product
/// <summary>
/// 成本价
/// </summary>
public decimal CostMoneyImport { get; set; }
public decimal CostMoneyImport { get; set; }
/// <summary>
/// 支付方式
/// </summary>
......
......@@ -101,5 +101,9 @@ namespace Mall.Model.Extend.User
/// </summary>
public int IsSelectOverTime { get; set; }
/// <summary>
/// 小程序排序
/// </summary>
public int SortNum { get; set; }
}
}
......@@ -120,6 +120,10 @@ namespace Mall.Model.Extend.User
#endregion
/// <summary>
/// 小程序排序
/// </summary>
public int SortNum { get; set; }
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -16,6 +16,7 @@ using Mall.Model.Query;
using VT.FW.DB;
using Mall.Model.Extend.AppletWeChat;
using Mall.Model.Entity.AppletWeChat;
using Mall.Repository.AppletWeChat;
namespace Mall.Module.User
{
......@@ -78,6 +79,11 @@ namespace Mall.Module.User
/// </summary>
private readonly MallStatisticsRepository mallStatisticsRepository = new MallStatisticsRepository();
/// <summary>
/// 直播配置仓储层
/// </summary>
private readonly RB_Live_ConfigRepository live_ConfigRepository = new RB_Live_ConfigRepository();
#region 轮播图管理
/// <summary>
......@@ -1782,7 +1788,7 @@ namespace Mall.Module.User
newLiveHouse.room_info.ForEach(x => x.TenantId = model.TenantId ?? 0);
newLiveHouse.room_info.ForEach(x => x.MallBaseId = model.MallBaseId);
newLiveHouse.room_info.ForEach(x => x.CreateDate = System.DateTime.Now);
AddLiveHouse(newLiveHouse.room_info, new Model.Entity.AppletWeChat.RB_Live_House { TenantId = model.TenantId ?? 0, MallBaseId = model.MallBaseId });
return true;
}
......@@ -1917,13 +1923,13 @@ namespace Mall.Module.User
string datetime = GetTime(item.start_time);
if (!string.IsNullOrWhiteSpace(datetime))
{
item.LiveTime =Convert.ToDateTime(datetime);
item.LiveTime = Convert.ToDateTime(datetime);
}
}
catch (Exception)
{
}
}
liveHouseRepository.InsertBatch(list);
......@@ -2132,5 +2138,46 @@ namespace Mall.Module.User
{
return mallStatisticsRepository.MallDistributorDayStatisticsRepository(query);
}
#region 直播配置
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_Live_Config_Extend GetLiveConfigModule(RB_Live_Config_Extend query)
{
return live_ConfigRepository.GetLiveConfigRepository(query);
}
/// <summary>
/// 新增修改直播配置
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetLiveConfigModule(RB_Live_Config_Extend extModel)
{
var flag = false;
var oldModel = GetLiveConfigModule(extModel);
if (oldModel!=null&&oldModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Live_Config_Extend.LiveBgImg),extModel.LiveBgImg},
{ nameof(RB_Live_Config_Extend.LiveQrCodeSize),extModel.LiveQrCodeSize},
{ nameof(RB_Live_Config_Extend.LiveQrCodePaddingTop),extModel.LiveQrCodePaddingTop},
{ nameof(RB_Live_Config_Extend.LiveQrCodePaddingLeft),extModel.LiveQrCodePaddingLeft},
{ nameof(RB_Live_Config_Extend.LiveQrCodeType),extModel.LiveQrCodeType},
};
flag = live_ConfigRepository.Update(fileds, new WhereHelper(nameof(RB_Live_Config_Extend.Id), extModel.Id));
}
else
{
flag = live_ConfigRepository.Insert(extModel) > 0;
}
return flag;
}
#endregion
}
}
This diff is collapsed.
......@@ -3294,9 +3294,11 @@ namespace Mall.Module.User
string GradeName = "默认等级";
int HpEnabled = 2;
int IsVip = 2;
string Icon = "";
if ((basicsModel?.IsEnableFXGrade ?? 0) == 1)
{
var gmodel = distributor_FXGradeRepository.GetEntity((model.FXGradeId ?? 0));
Icon = gmodel.Icon ?? "";
GradeName = gmodel?.GradeName ?? "默认等级";
if ((gmodel?.IsGuest ?? 0) == 3)
{
......@@ -3397,6 +3399,7 @@ namespace Mall.Module.User
UserName = umodel.Name,
umodel.Photo,
GradeName,
GradeIcon=Icon,
SuperiorId,
SuperiorName,
DistributorGradeEntrance = HpEnabled == 1 ? 2 : (basicsModel?.GradeEntrance ?? 2),
......@@ -3411,7 +3414,8 @@ namespace Mall.Module.User
IsEnableFXGrade = (basicsModel?.IsEnableFXGrade ?? 0),
IsVip,
VipExpiryDate = model.VipExpiryDate.HasValue ? model.VipExpiryDate.Value.ToString("yyyy-MM-dd") : "",
VipBuyCommission
VipBuyCommission,
}
};
}
......@@ -3964,7 +3968,16 @@ namespace Mall.Module.User
{
string UserIds = member_UserRepository.GetMemberChildIdStr(demodel.UserId ?? 0);
var list = member_UserRepository.GetPageListForFX(pageIndex, pageSize, out count, new RB_Member_User_Extend() { UserIds = UserIds, FXGradeId = demodel.FXGradeId, Name = demodel.Name, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var list = member_UserRepository.GetPageListForFX(pageIndex, pageSize, out count,
new RB_Member_User_Extend()
{
UserIds = UserIds,
FXGradeId = demodel.FXGradeId,
Name = demodel.Name,
TenantId = demodel.TenantId,
MallBaseId = demodel.MallBaseId,
SortNum = demodel.SortNum
});
List<object> RList = new List<object>();
if (list.Any())
{
......@@ -5162,6 +5175,7 @@ namespace Mall.Module.User
{ nameof(RB_Distributor_FXGrade.UpdateDate),demodel.UpdateDate},
{ nameof(RB_Distributor_FXGrade.DecimalType),demodel.DecimalType},
{ nameof(RB_Distributor_FXGrade.Description),demodel.Description},
{ nameof(RB_Distributor_FXGrade.Icon),demodel.Icon},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
......
using Mall.Model.Entity.AppletWeChat;
using Mall.Model.Extend.AppletWeChat;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Mall.Repository.AppletWeChat
{
/// <summary>
/// 直播海报配置仓储层
/// </summary>
public class RB_Live_ConfigRepository : BaseRepository<RB_Live_Config>
{
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_Live_Config_Extend GetLiveConfigRepository(RB_Live_Config_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Live_Config WHERE 1=1 ");
if (query != null)
{
if (query.MallBaseId > 0)
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_Live_Config_Extend.MallBaseId), query.MallBaseId);
}
if (query.TenantId > 0)
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_Live_Config_Extend.TenantId), query.TenantId);
}
if (query.Id > 0)
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_Live_Config_Extend.Id), query.Id);
}
}
return Get<RB_Live_Config_Extend>(builder.ToString()).FirstOrDefault();
}
}
}
......@@ -411,26 +411,44 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
}
//默认综合【升序】
string orderBy = $" order by g.{nameof(RB_Goods_Extend.Sort)} asc";
//上架时间【降序】
if (dmodel.OrderBy == 1)
{//最新
orderBy = $" order by g.{nameof(RB_Goods_Extend.CreateDate)} desc";
{
orderBy = $" order by g.{nameof(RB_Goods_Extend.CreateDate)} DESC";
}
//上架时间【升序】
else if (dmodel.OrderBy == 5)
{
orderBy = $" order by g.{nameof(RB_Goods_Extend.CreateDate)} ASC ";
}
//价格低=>高【升序】
else if (dmodel.OrderBy == 2)
{
//价格低-高
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} asc";
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} ASC";
}
//价格高=>低【降序】
else if (dmodel.OrderBy == 3)
{
//价格高-低
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} desc";
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} DESC";
}
//销量高=>低【降序】
else if (dmodel.OrderBy == 4)
{
//销量高-低
orderBy = $" order by g.{nameof(RB_Goods_Extend.SalesNum)} desc";
orderBy = $" order by g.{nameof(RB_Goods_Extend.SalesNum)} DESC ";
}
//销量低=>高【升序】
else if (dmodel.OrderBy == 6)
{
orderBy = $" order by g.{nameof(RB_Goods_Extend.SalesNum)} ASC ";
}
//综合【降序】
else if (dmodel.OrderBy == 7)
{
orderBy = $" order by g.{nameof(RB_Goods_Extend.Sort)} DESC ";
}
if (dmodel.IsSelectVideo == 1)
{
where += $@" and g.{nameof(RB_Goods_Extend.VideoAddress)} !=''";
......
......@@ -223,14 +223,17 @@ select * from RB_Member_User where {where} order by CreateDate desc
/// <returns></returns>
public List<RB_Member_User_Extend> GetPageListForFX(int pageIndex, int pageSize, out long rowCount, RB_Member_User_Extend dmodel)
{
string where = " 1=1 and d.Status=0 ";
string where = " and d.Status=0 ";
string where2 = "";
if (dmodel.TenantId > 0)
{
where += $@" and u.{nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
where2 += $@" and u.{nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and u.{nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
where2 += $@" and u.{nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
......@@ -269,12 +272,34 @@ select * from RB_Member_User where {where} order by CreateDate desc
where += $@" and d.{nameof(RB_Distributor_Info.FXGradeId)}={dmodel.FXGradeId}";
}
string sql = $@"
select u.* from RB_Member_User u
inner join rb_distributor_info d on u.Id =d.UserId
where {where} order by u.CreateDate desc
";
return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT u.*
FROM RB_Member_User u INNER JOIN rb_distributor_info d on u.Id =d.UserId
LEFT JOIN (
SELECT u.SuperiorId,COUNT(0) AS ReferralsNum
FROM rb_member_user u
WHERE 1=1 {1}
GROUP BY u.SuperiorId
) AS B ON U.Id=B.SuperiorId
WHERE 1=1 {0}
", where, where2);
string orderBy = " order by u.CreateDate desc ";
if (dmodel.SortNum == 1)
{
orderBy = " order by u.CreateDate ASC ";
}
else if (dmodel.SortNum == 2)
{
orderBy = " order by B.ReferralsNum DESC ";
}
else if (dmodel.SortNum == 3)
{
orderBy = " order by B.ReferralsNum ASC ";
}
builder.AppendFormat(orderBy);
return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out rowCount,builder.ToString()).ToList();
}
/// <summary>
......
......@@ -51,7 +51,7 @@ namespace Mall.ThirdCore.Oss
catch (Exception ex)
{
ossResult.resultCode = 0;
Mall.Common.Plugin.LogHelper.Error("OytourOssService_UploadFile文件上传保存失败", ex);
Mall.Common.Plugin.LogHelper.Write(ex,"OytourOssService_UploadFile文件上传保存失败");
}
return ossResult;
}
......@@ -86,7 +86,7 @@ namespace Mall.ThirdCore.Oss
}
catch (Exception e)
{
Mall.Common.Plugin.LogHelper.Error("OytourOssService_DeleteFile" + e.ToString(), e);
Mall.Common.Plugin.LogHelper.Write(e, "OytourOssService_DeleteFile" + e.ToString());
ossResult.resultCode = 0;
ossResult.message = e.ToString();
return ossResult;
......@@ -110,7 +110,7 @@ namespace Mall.ThirdCore.Oss
}
catch (Exception e)
{
Mall.Common.Plugin.LogHelper.Error("OytourOssService_DeleteFileList" + e.ToString(), e);
Mall.Common.Plugin.LogHelper.Write(e, "OytourOssService_DeleteFileList" + e.ToString());
ossResult.resultCode = 0;
ossResult.message = e.ToString();
return ossResult;
......@@ -134,7 +134,7 @@ namespace Mall.ThirdCore.Oss
}
catch (Exception e)
{
Mall.Common.Plugin.LogHelper.Error("OytourOssService_FileCopy" + e.ToString(), e);
Mall.Common.Plugin.LogHelper.Write(e, "OytourOssService_FileCopy" + e.ToString());
ossResult.resultCode = 0;
ossResult.message = e.ToString();
return ossResult;
......
......@@ -77,7 +77,7 @@ namespace Mall.WebApi.App_Code
});
var xe = XElement.Parse(result, LoadOptions.SetLineInfo);
LogHelper.Write(null, "订单号【" + sOrderNo + "】成功回调:" + xe);
LogHelper.WriteInfo("订单号【" + sOrderNo + "】成功回调:" + xe);
try
{
//存入缓存,方便自动取消的时候不被清理
......@@ -122,7 +122,7 @@ namespace Mall.WebApi.App_Code
var res = new ResponseHandler(accessor);
var tradeType = res.GetParameter("trade_type");
LogHelper.Write(null, "Notify支付回调:res-" + res.ToString());
LogHelper.WriteInfo("Notify支付回调:res-" + res.ToString());
RB_MiniProgram_Extend model = new RB_MiniProgram_Extend();
model = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend { MallBaseId = 0, TenantId = 0 });
res.SetKey(model.WeChatApiSecret);
......@@ -181,7 +181,7 @@ namespace Mall.WebApi.App_Code
}
else
{
LogHelper.Write(null, "Notify支付回调:returnMsg-" + returnMsg);
LogHelper.WriteInfo("Notify支付回调:returnMsg-" + returnMsg);
}
}
else
......@@ -197,109 +197,7 @@ namespace Mall.WebApi.App_Code
}
//public ProcessNotify(HttpContext context)
//{
// WxPayData notifyData = GetNotifyData(context);
// //检查支付结果中transaction_id是否存在
// if (!notifyData.IsSet("transaction_id"))
// {
// //若transaction_id不存在,则立即返回结果给微信支付后台
// WxPayData res = new WxPayData();
// res.SetValue("return_code", "FAIL");
// res.SetValue("return_msg", "支付结果中微信订单号不存在");
// context.Response.WriteAsync(res.ToXml());
// return (false, null);
// }
// string transaction_id = notifyData.GetValue("transaction_id").ToString();
// string out_trade_no = notifyData.GetValue("out_trade_no").ToString();
// //查询订单,判断订单真实性
// if (!QueryOrder(transaction_id))
// {
// //若订单查询失败,则立即返回结果给微信支付后台
// WxPayData res = new WxPayData();
// res.SetValue("return_code", "FAIL");
// res.SetValue("return_msg", "订单查询失败");
// context.Response.WriteAsync(res.ToXml());
// return (false, null);
// }
// //查询订单成功
// else
// {
// WxPayData res = new WxPayData();
// res.SetValue("return_code", "SUCCESS");
// res.SetValue("return_msg", "OK");
// context.Response.WriteAsync(res.ToXml());
// ProcessNotifyReturn notifyReturn = new ProcessNotifyReturn
// {
// out_trade_no = out_trade_no,
// transaction_id = transaction_id
// };
// return (true, notifyReturn);
// }
//}
///// <summary>
///// 接收从微信支付后台发送过来的数据并验证签名
///// </summary>
///// <returns>微信支付后台返回的数据</returns>
//public WxPayData GetNotifyData(HttpContext context)
//{
// #region
// //注意:如果用以下读取流的方法,.net core 3.0 以后一定要加下边那段
// //.net core 3.0以后需加下边这段,否则Stream会报错
// var syncIOFeature = context.Features.Get<IHttpBodyControlFeature>();
// if (syncIOFeature != null)
// {
// syncIOFeature.AllowSynchronousIO = true;
// }
// #endregion
// //接收从微信后台POST过来的数据
// System.IO.Stream s = context.Request.Body;
// int count = 0;
// byte[] buffer = new byte[1024];
// StringBuilder builder = new StringBuilder();
// while ((count = s.Read(buffer, 0, 1024)) > 0)
// {
// builder.Append(Encoding.UTF8.GetString(buffer, 0, count));
// }
// s.Flush();
// s.Close();
// s.Dispose();
// LogHelper.Write($"GetNotifyData Receive data from WeChat :{builder.ToString()}");
// //转换数据格式并验证签名
// WxPayData data = new WxPayData();
// try
// {
// data.FromXml(builder.ToString());
// }
// catch (Exception ex)
// {
// //若签名错误,则立即返回结果给微信支付后台
// WxPayData res = new WxPayData();
// res.SetValue("return_code", "FAIL");
// res.SetValue("return_msg", ex.Message);
// context.Response.WriteAsync(res.ToXml());
// }
// LogHelper.Write($"GetNotifyData Check sign success");
// return data;
//}
// <summary>
/// <summary>
/// 退款 传入订单号OrderNumber,RefundNumber,总金额total_fee(分),RefundFee退款金额(分),
/// </summary>
/// <param name="param"></param>
......
......@@ -91,7 +91,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Error("MallController_GetHome", ex);
Common.Plugin.LogHelper.Write(ex,"MallController_GetHome");
}
int page_id = parms.GetInt("page_id");
......@@ -114,6 +114,9 @@ namespace Mall.WebApi.Controllers.MallBase
//小程序
var mall = new object();
//直播海报配置
var liveConfig = new object();
//获取小程序信息
var miniProgram = new RB_MiniProgram_Extend();
if (MiniAppId != null && !string.IsNullOrEmpty(MiniAppId))
......@@ -387,6 +390,15 @@ namespace Mall.WebApi.Controllers.MallBase
hotspot = hotspotLogin,
hotspot_cancel = hotspotCancel
};
var liveConfigModel = programModule.GetLiveConfigModule(new Model.Extend.AppletWeChat.RB_Live_Config_Extend() { MallBaseId = miniProgram.MallBaseId, TenantId = miniProgram.TenantId });
liveConfig = new
{
liveConfigModel?.LiveQrCodeSize,
liveConfigModel?.LiveBgImg,
liveConfigModel?.LiveQrCodePaddingLeft,
liveConfigModel?.LiveQrCodePaddingTop,
liveConfigModel?.LiveQrCodeType,
};
var miniPageList = programPageModule.GetMiniprogram_Page_ListExtModule(new RB_MiniProgram_Page_Extend() { MallBaseId = RequestParm.MallBaseId });
var objResult = new
{
......@@ -398,6 +410,7 @@ namespace Mall.WebApi.Controllers.MallBase
share_setting_custom,
cat_style,
auth_page,//授权页面
liveConfig,
bar_title = miniPageList?.Select(qitem => new { name = qitem.PageName, value = qitem.PageUrl, new_name = qitem.SelfPageName }),//导航标题
};
return ApiResult.Success(data: objResult);
......@@ -421,7 +434,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Error("MallController_GetUserCenter", ex);
Common.Plugin.LogHelper.Write(ex, "MallController_GetUserCenter");
}
//获取小程序信息
var miniProgram = programModule.GetMiniProgramModule(new Model.Extend.User.RB_MiniProgram_Extend() { MiniAppId = MiniAppId }, isGetUserCenterMenu: true);
......@@ -623,7 +636,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Error("GetGoosPoster", ex);
Common.Plugin.LogHelper.Write(ex, "GetGoosPoster");
}
//获取小程序信息
var miniProgram = new RB_MiniProgram_Extend();
......
......@@ -429,6 +429,12 @@ namespace Mall.WebApi.Controllers.MarketingCenter
memberCoupon.MallBaseId = oldLogisticsModel.MallBaseId;
memberCoupon.Remarks = "";
memberCoupon.CouponId = oldLogisticsModel.ID;
memberCoupon.Name = oldLogisticsModel.Name;
memberCoupon.CouponType = oldLogisticsModel.CouponType;
memberCoupon.MinConsumePrice = oldLogisticsModel.MinConsumePrice;
memberCoupon.MaxDiscountsPrice = oldLogisticsModel.MaxDiscountsPrice;
memberCoupon.DiscountsPrice = oldLogisticsModel.DiscountsPrice;
memberCoupon.UseType = oldLogisticsModel.UseType;
if (oldLogisticsModel.IndateType == Common.Enum.MarketingCenter.IndateTypeEnum.DayHorizon)
{
memberCoupon.StartDate = System.DateTime.Now;
......
......@@ -273,13 +273,14 @@ namespace Mall.WebApi.Controllers.MarketingCenter
List<ExcelDataSource> slist = new List<ExcelDataSource>();
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "日期") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款人数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款订单数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款金额") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款件数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
new ExcelColumn(value: "日期") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款人数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款订单数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款金额") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "付款件数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
},
};
slist.Add(header);
......@@ -288,7 +289,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
{
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = statisticsModule.GetSellExcel(demodel);
var list = statisticsModule.GetSellPageList(1,1000,out long rowsCount,demodel);
#region 组装数据
int Num = 0;
foreach (var item in list)
......@@ -296,7 +297,8 @@ namespace Mall.WebApi.Controllers.MarketingCenter
Num++;
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value:Num.ToString()){ },
}
};
......
......@@ -93,9 +93,20 @@ namespace Mall.WebApi.Controllers.MallBase
DeliveryMethodName = x.DeliveryMethod.GetEnumName(),
x.Income,
x.FreightMoney,
x.CouponMoney,
x.PaymentWay,
PaymentWayName = x.PaymentWay.GetEnumName(),
CouponMoney = x.CouponMoney ?? 0,
IntegralMoney = (x.DetailList != null && x.DetailList.Any()) ? (x.DetailList.Sum(x => x.IntegralMoney ?? 0)) : 0,
IntegralNumber = (x.DetailList != null && x.DetailList.Any()) ? (x.DetailList.Sum(x => x.IntegralNumber ?? 0)) : 0,
MemberDiscountCouponList = x.MemberDiscountCouponList.Select(y => new
{
y.Name,
y.MinConsumePrice,
y.MaxDiscountsPrice,
y.UseType,
y.CouponType,
y.DiscountsPrice
}),
DetailList = x.DetailList.Select(y => new
{
y.SupplierId,
......@@ -120,12 +131,17 @@ namespace Mall.WebApi.Controllers.MallBase
y.RealMoney,
y.YFMoney,
y.PayMoney,
SFinanceList = y.FinanceList.Where(z => z.Type == 1).Select(z => new {
CouponMoney = y.CouponMoney ?? 0,
IntegralMoney = y.IntegralMoney ?? 0,
IntegralNumber = y.IntegralNumber ?? 0,
SFinanceList = y.FinanceList.Where(z => z.Type == 1).Select(z => new
{
z.FrID,
z.Status,
z.Is_Cashier
}),
ZFinanceList = y.FinanceList.Where(z => z.Type == 2).Select(z => new {
ZFinanceList = y.FinanceList.Where(z => z.Type == 2).Select(z => new
{
z.FrID,
z.Status,
z.Is_Cashier
......
......@@ -15,6 +15,7 @@ using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
using Mall.AOP;
namespace Mall.WebApi.Controllers.MallBase
{
......@@ -25,7 +26,8 @@ namespace Mall.WebApi.Controllers.MallBase
public class ProductController : BaseController
{
private readonly ProductModule productModule = new ProductModule();
private readonly ProductModule productModule = AOPHelper.CreateAOPObject<ProductModule>();
#region 素材管理
/// <summary>
......@@ -1582,7 +1584,9 @@ namespace Mall.WebApi.Controllers.MallBase
model?.PresentFXMonth,
model?.Advertising,
model?.SubName,
model?.MarketingLogo
model?.MarketingLogo,
model?.ShelvesDate,
model?.DownDate,
});
}
......@@ -1713,8 +1717,17 @@ namespace Mall.WebApi.Controllers.MallBase
pricemodel.GoodsWeight ??= 0;
demodel.InventoryNum += (pricemodel.InventoryNum ?? 0);
}
demodel.SellingPrice = 0;
//主表价格 如果有自定义规格,直接取最小值
demodel.SellingPrice = demodel.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.Min(x => x.SellingPrice ?? 0) ?? 0;
if (demodel.SpecificationPriceList != null && demodel.SpecificationPriceList.Count > 0)
{
var SellingPrice = demodel.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.Min(x => x.SellingPrice);
if (SellingPrice != null)
{
demodel.SellingPrice = SellingPrice;
}
}
//分销佣金
if (demodel.SeparateDistribution == 1)
{
......
......@@ -72,7 +72,7 @@ namespace Mall.WebApi.Controllers.User
//验证是否新用户
if (!userModule.ValidateUserOpenId(demodel.OpenId, demodel.Source, requestParm.TenantId, requestParm.MallBaseId))
{
LogHelper.Write(demodel.OpenId + ",SuperiorId:" + (demodel.SuperiorId ?? 0));
LogHelper.WriteInfo(demodel.OpenId + ",SuperiorId:" + (demodel.SuperiorId ?? 0));
//注册新用户
if (string.IsNullOrEmpty(demodel.Name))
{
......
......@@ -1053,6 +1053,12 @@ namespace Mall.WebApi.Controllers.User
memberCoupon.MallBaseId = userInfo.MallBaseId;
memberCoupon.Remarks = "";
memberCoupon.CouponId = oldLogisticsModel.ID;
memberCoupon.Name = oldLogisticsModel.Name;
memberCoupon.CouponType = oldLogisticsModel.CouponType;
memberCoupon.MinConsumePrice = oldLogisticsModel.MinConsumePrice;
memberCoupon.MaxDiscountsPrice = oldLogisticsModel.MaxDiscountsPrice;
memberCoupon.DiscountsPrice = oldLogisticsModel.DiscountsPrice;
memberCoupon.UseType = oldLogisticsModel.UseType;
if (oldLogisticsModel.IndateType == Common.Enum.MarketingCenter.IndateTypeEnum.DayHorizon)
{
memberCoupon.StartDate = System.DateTime.Now;
......
......@@ -22,6 +22,7 @@ using Mall.Model.Entity.User;
using Mall.Module.Product;
using Microsoft.AspNetCore.Authorization;
using Mall.Model.Query;
using Mall.Model.Extend.AppletWeChat;
namespace Mall.WebApi.Controllers.User
{
......@@ -1785,5 +1786,35 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.Success(data: basicData);
}
#endregion
#region 直播配置
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <returns></returns>
public ApiResult GetLiveConfig()
{
var query = JsonConvert.DeserializeObject<RB_Live_Config_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var extModel = programModule.GetLiveConfigModule(query);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 添加修改直播配置
/// </summary>
/// <returns></returns>
public ApiResult SetLiveConfig()
{
var extModel = JsonConvert.DeserializeObject<RB_Live_Config_Extend>(RequestParm.msg.ToString());
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
var flag = programModule.SetLiveConfigModule(extModel);
return ApiResult.Success(data: extModel);
}
#endregion
}
}
\ No newline at end of file
......@@ -2739,6 +2739,7 @@ namespace Mall.WebApi.Controllers.User
x.DecimalType,
x.UpgradeId,
x.Description,
x.Icon,
UpdateDate = x.UpdateDate.HasValue ? x.UpdateDate.Value.ToString("yyyy-MM-dd") : ""
});
return ApiResult.Success("", pagelist);
......
......@@ -34,12 +34,12 @@ namespace Mall.WebApi.Filter
//记录错误日志
if (context.HttpContext.Items[GlobalKey.UserPostInfo] != null)
{
LogHelper.Error($"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:{Config.GetFilePath(context.HttpContext.Request.GetAbsoluteUri())},请求参数:{JsonConvert.SerializeObject(context.HttpContext.Items[GlobalKey.UserPostInfo].ToString())}", context.Exception);
LogHelper.Write(context.Exception,$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:{Config.GetFilePath(context.HttpContext.Request.GetAbsoluteUri())},请求参数:{JsonConvert.SerializeObject(context.HttpContext.Items[GlobalKey.UserPostInfo].ToString())}");
Console.WriteLine(context.Exception);
}
else
{
LogHelper.Error($"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:{Config.GetFilePath(context.HttpContext.Request.GetAbsoluteUri())}", context.Exception);
LogHelper.Write(context.Exception,$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:{Config.GetFilePath(context.HttpContext.Request.GetAbsoluteUri())}");
Console.WriteLine(context.Exception);
}
......
using Mall.WindowsService.Model;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
......@@ -25,70 +24,4 @@ namespace Mall.WindowsService.Helper
}
}
}
/// <summary>
/// 配置文件帮助类
/// </summary>
public class ConfigHelper
{
/// <summary>
/// 获取任务配置文件
/// </summary>
/// <returns></returns>
public static IList<CommandModel> GetTaskConfig()
{
IList<CommandModel> list = new List<CommandModel>();
//加载接口配置文件
string settingPath = PathHelper.RootPath + @"\task.json";
using (StreamReader sr = new StreamReader(settingPath))
{
try
{
JsonSerializer serializer = new JsonSerializer();
serializer.Converters.Add(new JavaScriptDateTimeConverter());
serializer.NullValueHandling = NullValueHandling.Ignore;
//构建Json.net的读取流
JsonReader reader = new JsonTextReader(sr);
//对读取出的Json.net的reader流进行反序列化,并装载到模型中
list = serializer.Deserialize<IList<CommandModel>>(reader);
}
catch (Exception ex)
{
LogHelper.Write("加载配置文件" + ex.Message.ToString());
}
}
return list;
}
/// <summary>
/// 加载DLL文件
/// </summary>
/// <returns></returns>
public static Dictionary<string, object> LoadAssembly()
{
Dictionary<string, object> assemblyDic = new Dictionary<string, object>();
string path = PathHelper.RootPath;
DirectoryInfo directoryInfo = new DirectoryInfo(path);
if (directoryInfo.Exists)
{
//搜索dll文件
FileInfo[] dllList = directoryInfo.GetFiles("*.dll");
if (!object.Equals(dllList, null) && dllList.Length > 0)
{
foreach (var item in dllList)
{
AssemblyName assemblyName = AssemblyName.GetAssemblyName(item.FullName);
Assembly ass = Assembly.Load(assemblyName);
foreach (var type in ass.ExportedTypes)
{
string fullName = type.FullName;
assemblyDic.Add(fullName, type);
}
}
}
}
return assemblyDic;
}
}
}
......@@ -13,6 +13,7 @@ namespace Mall.WindowsService.Helper
private static int inTimer1 = 0;
private static int inTimer2 = 0;
private static int inTimer3 = 0;
private static int inTimer4 = 0;
/// <summary>
/// 收入单子服务开始执行方法
......@@ -103,5 +104,22 @@ namespace Mall.WindowsService.Helper
Interlocked.Exchange(ref inTimer3, 0);
}
}
/// <summary>
/// 商品定时上架,下架
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void GoodsShelves(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer4, 1) == 0)
{
LogHelper.Write("GoodsShelves=====Start");
Module.GoodsShelvesModule.ShelvesGoodsModule();
Module.GoodsShelvesModule.DownGoodsModule();
LogHelper.Write("GoodsShelves=====End");
Interlocked.Exchange(ref inTimer4, 0);
}
}
}
}
......@@ -31,4 +31,8 @@
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.WindowsService.Model
{
/// <summary>
/// 任务命令实体类
/// </summary>
public class CommandModel
{
/// <summary>
/// 对应方法名称
/// </summary>
public string Method { get; set; }
/// <summary>
/// 执行方式(1-每天,2-间隔多少小时,3-间隔多少分钟)
/// </summary>
public int ActionType { get; set; }
/// <summary>
/// 执行时间(01:00)
/// </summary>
public string ActionTime { get; set; }
}
}
using Mall.Repository.Product;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Mall.Model.Entity.Product;
using VT.FW.DB;
namespace Mall.WindowsService.Module
{
/// <summary>
/// 商品自动上架下架
/// </summary>
public class GoodsShelvesModule
{
/// <summary>
/// 商品仓储层对象
/// </summary>
private static readonly RB_GoodsRepository goodsRepository = new RB_GoodsRepository();
/// <summary>
/// 商品自动上架时间
/// </summary>
/// <returns></returns>
public static bool ShelvesGoodsModule()
{
bool flag = false;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT Id,GoodsStatus,ShelvesDate,DownDate
FROM rb_goods
WHERE Status=0 AND '{0}'>=ShelvesDate AND '{0}'<=DownDate AND GoodsStatus<>1
", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var list = goodsRepository.Get<RB_Goods>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Goods.GoodsStatus),1 }
};
flag = goodsRepository.Update(fileds, new WhereHelper(nameof(RB_Goods.Id), item.Id));
}
}
return flag;
}
/// <summary>
/// 商品自动下架
/// </summary>
/// <returns></returns>
public static bool DownGoodsModule()
{
bool flag = false;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT Id,GoodsStatus,ShelvesDate,DownDate
FROM rb_goods
WHERE Status=0 AND DownDate<='{0}' AND GoodsStatus=1 ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var list = goodsRepository.Get<RB_Goods>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Goods.GoodsStatus),2 }
};
flag = goodsRepository.Update(fileds, new WhereHelper(nameof(RB_Goods.Id), item.Id));
}
}
return flag;
}
}
}
......@@ -15,6 +15,7 @@ namespace Mall.WindowsService
private System.Timers.Timer timer2; //订单取消计时器
private System.Timers.Timer timer3; //订单自动收货计时器
private System.Timers.Timer timer4; //七天自动取消下线计时器
private System.Timers.Timer timer5; //定时上架和下架
public WindowsService()
{
......@@ -65,6 +66,17 @@ namespace Mall.WindowsService
timer4.Enabled = true;
#endregion
timer5 = new System.Timers.Timer();
timer5 = new System.Timers.Timer
{
Interval = 1000 * (60 * 10) //10分钟调用一次
};
timer5.Elapsed += new System.Timers.ElapsedEventHandler(helper.GoodsShelves);
timer5.Enabled = true;
#region
#endregion
}
protected override void OnStop()
......@@ -75,6 +87,7 @@ namespace Mall.WindowsService
this.timer2.Enabled = false;
this.timer3.Enabled = false;
this.timer4.Enabled = false;
this.timer5.Enabled = false;
}
}
}
{
"ConnectionStrings": {
"DefaultConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; ",
"DefaultConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=test_reborn_mall_3;CharSet=utf8; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient"
......
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