Commit 6528a9a0 authored by liudong1993's avatar liudong1993

调整+

parent 4de0ff95
......@@ -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" />
......
......@@ -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
{
......
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