Commit b19220d5 authored by 黄奎's avatar 黄奎
parents b92eb5e3 b484f72d
......@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.CacheManager\Mall.CacheManager.csproj" />
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
......
......@@ -1112,8 +1112,8 @@ namespace Mall.Module.Product
if (cList.Any())
{
string cIds = string.Join(",", cList.Select(x => x.CouponId).Distinct());
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds);
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, true);
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
if (dcList.Any())
{
foreach (var item in cList)
......@@ -2032,8 +2032,8 @@ namespace Mall.Module.Product
if (cList.Any())
{
string cIds = string.Join(",", cList.Select(x => x.CouponId).Distinct());
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds);
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, true);
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
if (dcList.Any())
{
foreach (var item in cList)
......
......@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.User;
......@@ -138,7 +136,7 @@ namespace Mall.Module.Product
/// <summary>
/// 和平返佣
/// </summary>
private readonly RB_Distributor_HPCommissionRepository distributor_HPCommissionRepository = new RB_Distributor_HPCommissionRepository();
private readonly RB_Distributor_HPCommissionRepository distributor_HPCommissionRepository = new RB_Distributor_HPCommissionRepository();
/// <summary>
/// 和平返佣比例
/// </summary>
......@@ -220,7 +218,7 @@ namespace Mall.Module.Product
//会员价格
var MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (list.Where(x=> x.EnjoyMember == 1 && x.SeparateSetMember == 1).Any())
if (list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Any())
{
string goodsIds = string.Join(",", list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Select(x => x.Id));
MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
......@@ -574,7 +572,7 @@ namespace Mall.Module.Product
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(model.CarouselImage);
//轮播图
foreach (var item in CarouselIdList)
{
{
model.CarouselImageList.Add(new RB_ImageCommonModel()
{
Id = 0,
......@@ -585,7 +583,7 @@ namespace Mall.Module.Product
}
model.CustomShareImagePath = model.CustomShareImage;
//服务列表
model.ServiceList = new List<RB_ImageCommonModel>();
if (model.IsDefaultService == 2)
......@@ -790,7 +788,7 @@ namespace Mall.Module.Product
var gList = distributor_HPGradeRatioRepository.GetList(new RB_Distributor_HPGradeRatio_Extend() { CommissionId = hpcModel.Id, TenantId = TenantId, MallBaseId = MallBaseId });
var ratioModel = gList.Where(x => x.GradeId == disModel.HPGradeId).FirstOrDefault();
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
if (hpcModel.DecimalType == 1)
{
......@@ -869,6 +867,100 @@ namespace Mall.Module.Product
return model;
}
/// <summary>
/// 获取商品分享
/// </summary>
/// <returns></returns>
public object GetAppletGoodsShareInfo(int goodsId, int userId, string path, int mallBaseId)
{
string QRPath = GetWeiXinQRCode(path, 430, mallBaseId);
var umodel = member_UserRepository.GetEntity(userId);
var goodsModel = goodsRepository.GetEntity(goodsId);
if (goodsModel == null)
{
return new
{
goods_name = "",
multi_map = new List<string>(),
is_negotiable = 0,
min_price = 0,
max_price = 0,
nickname = umodel?.Name ?? "",
avatar = umodel?.Photo ?? "",
qrcode_url = QRPath,
sign = ""
};
}
else {
//商品图片处理
var imgList = new List<string>();
if (!string.IsNullOrEmpty(goodsModel.CarouselImage) && goodsModel.CarouselImage != "[]") {
imgList = JsonConvert.DeserializeObject<List<string>>(goodsModel.CarouselImage);
}
if (imgList.Any()) {
if (imgList.Count() < 8) {
var imgList2 = new List<string>();
int Num = 8 / imgList.Count();
for (var i = 0; i < Num + 1; i++) {
imgList2.AddRange(imgList);
}
imgList = imgList2.Take(8).ToList();
}
}
return new
{
goods_name = goodsModel.Name,
multi_map = imgList,
is_negotiable = 0,
min_price = goodsModel.SellingPrice,
max_price = goodsModel.SellingPrice,
nickname = umodel?.Name ?? "",
avatar = umodel?.Photo ?? "",
qrcode_url = QRPath,
sign = ""
};
}
}
#region 获取小程序码
/// <summary>
/// 生成小程序码
/// </summary>
/// <param name="path"></param>
/// <param name="width"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public string GetWeiXinQRCode(string path, int width, int mallBaseId)
{
var appletWeChatModel = programRepository.GetEntity(mallBaseId);
string token = CacheManager.AppletWeChat.WeiXinReidsCache.Get(appletWeChatModel.MiniAppId);
if (string.IsNullOrEmpty(token))
{
token = Common.Pay.WeChatPat.TokenHelper.GetLXYToken(token, appletWeChatModel.MiniAppId, appletWeChatModel.MiniAppSecret);
System.Threading.Tasks.Task.Run(() => CacheManager.AppletWeChat.WeiXinReidsCache.Set(appletWeChatModel.MiniAppId, token));
}
if (!string.IsNullOrEmpty(token))
{
//string GetImageUrl = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + token;//获取二维码
string GetImageUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + token;//获取小程序码
var postData = new
{
path,
width
};
string pathName = Guid.NewGuid().ToString() + ".jpg";
string basepath = AppContext.BaseDirectory;
string path_server = basepath + "\\upfile\\temporary\\" + pathName;
var Robj = HttpHelper.HttpPostForGetWXQRCodePath(GetImageUrl, JsonHelper.Serialize(postData), path_server);
//var Robj1 = HttpHelper.HttpPost(GetImageUrl, JsonHelper.Serialize(postData), "");
return Robj;
}
return "";
}
#endregion
/// <summary>
/// 获取小程序商品详情
/// </summary>
......@@ -1610,7 +1702,7 @@ namespace Mall.Module.Product
{
integral = new
{
title = "购买可得" + Integral + "积分"
title = Integral > 0 ? "购买可得" + Integral + "积分" : ""
}
},
//plugin_extra = new List<object>(),
......
......@@ -2972,6 +2972,7 @@ namespace Mall.Module.User
{
return "";
}
var baseModel = distributor_BasicsRepository.GetList(new RB_Distributor_Basics_Extend() { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault();
return new
{
......@@ -2979,7 +2980,8 @@ namespace Mall.Module.User
{
CustomModel.CommissionTobePaidName,
CustomModel.UserNotesName,
CustomModel.IWantToWithdrawName
CustomModel.IWantToWithdrawName,
baseModel.UserNotes
},
CommissionInfo = new
{
......
......@@ -57,10 +57,17 @@ namespace Mall.Repository.MarketingCenter
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_DiscountCoupon_Extend> GetDiscountCouponList(RB_DiscountCoupon_Extend query)
public List<RB_DiscountCoupon_Extend> GetDiscountCouponList(RB_DiscountCoupon_Extend query,bool IsSelectDel = false)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_DiscountCoupon_Extend.Status)}=0 ");
if (IsSelectDel)
{
builder.Append($" SELECT * FROM {TableName} WHERE 1=1 ");
}
else
{
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_DiscountCoupon_Extend.Status)}=0 ");
}
if (query != null)
{
if (query.ID > 0)
......
......@@ -60,7 +60,7 @@ namespace Mall.Repository.MarketingCenter
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_DiscountCoupon_Product_Extend> GetListByDiscountCouponIds(RB_DiscountCoupon query, string DiscountCouponIds)
public List<RB_DiscountCoupon_Product_Extend> GetListByDiscountCouponIds(RB_DiscountCoupon query, string DiscountCouponIds,bool IsSelectDel =false)
{
StringBuilder builder = new StringBuilder();
......@@ -80,7 +80,14 @@ namespace Mall.Repository.MarketingCenter
{
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Product.DiscountCouponId)} in ({DiscountCouponIds})");
}
string sql = $"SELECT a.* from {TableName} as a WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
string sql = "";
if (IsSelectDel)
{
sql = $"SELECT a.* from {TableName} as a WHERE 1=1 ";
}
else {
sql = $"SELECT a.* from {TableName} as a WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
}
if (query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Category)
{
sql = $" SELECT a.*,b.`Name` as Relevance from {TableName} as a LEFT JOIN {PCategoryTableName} as b on a.ProductId=b.Id WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
......
......@@ -66,6 +66,8 @@ namespace Mall.WebApi.App_Code
req.SetParameter("sign", req.CreateMd5Sign(_accessor, model.WeChatApiSecret));
var reqXml = req.ParseXml();
LogHelper.Write(null, "订单号【" + sOrderNo + "】请求参数:" + reqXml);
var result = Common.Pay.WeChatPat.HttpHelper.Post(new HttpParam()
{
Url = Mall.Common.Pay.WeChatPat.Model.ApiList.UnifiedOrderUrl,
......
......@@ -60,7 +60,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
private readonly ProductModule productModule = new ProductModule();
/// <summary>
/// 用户处理类
/// </summary>
......@@ -117,13 +117,15 @@ namespace Mall.WebApi.Controllers.MallBase
var auth_page = new object();
//用户信息
var user_info = new object();
//小程序
var mall = new object();
if (page_id > 0)
{
var targetPage = miniprogramPageTemplModule.GetMiniprogramPageTemplModule(new RB_Miniprogram_Page_Templ_Extend()
{
MallBaseId = miniProgram.MallBaseId,
TenantId = miniProgram.TenantId,
Id=page_id
Id = page_id
}, isGetHome: false);
List<object> list = new List<object>();
//自定义首页
......@@ -179,6 +181,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
if (miniProgram != null && miniProgram.MallBaseId > 0)
{
//底部导航
navbar = new
{
......@@ -356,22 +359,39 @@ namespace Mall.WebApi.Controllers.MallBase
cat_goods_cols = productCategoryStyle?.RowNum
};
#endregion
mall = new
{
id = miniProgram.MallBaseId,
name = miniProgram.MallName,
user_id = 0,
created_at = miniProgram.CreateDate.HasValue ? miniProgram.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
updated_at = miniProgram.CreateDate.HasValue ? miniProgram.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
deleted_at = "0000-00-00 00:00:00",
is_delete = miniProgram.Status,
is_recycle = 0,
is_disable = miniProgram.Status,
expired_at = "0000-00-00 00:00:00",
option = new List<object>(),
setting,
};
}
if (RequestParm.OpenId != null && !string.IsNullOrWhiteSpace(RequestParm.OpenId))
{
var memberModel = userModule.GetAppletUserCenterStatistics(RequestParm.OpenId);
user_info = memberModel;
}
}
var miniPageList = programPageModule.GetMiniprogram_Page_ListExtModule(new RB_MiniProgram_Page_Extend() { MallBaseId = RequestParm.MallBaseId });
var objResult = new
{
mall,
home_pages = homePage,
navbar,
user_info,
setting,
share_setting,
share_setting_custom,
cat_style,
......
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