Commit 4a733c10 authored by 黄奎's avatar 黄奎

111

parents 1d15cf17 de40a998
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CoreHtmlToImage" Version="1.0.6" />
<PackageReference Include="LumenWorks.Framework.IO.Core" Version="1.0.1" /> <PackageReference Include="LumenWorks.Framework.IO.Core" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" /> <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using CoreHtmlToImage;
namespace Mall.Common.Plugin
{
/// <summary>
/// htmlToimg工具类
/// </summary>
public class HtmlToImgHelper
{
//Bitmap m_Bitmap;
//string m_Url;
//int m_BrowserWidth, m_BrowserHeight, m_ThumbnailWidth, m_ThumbnailHeight;
//public HtmlToImgHelper(string Url, int BrowserWidth, int BrowserHeight, int ThumbnailWidth, int ThumbnailHeight)
//{
// m_Url = Url;
// m_BrowserHeight = BrowserHeight;
// m_BrowserWidth = BrowserWidth;
// m_ThumbnailWidth = ThumbnailWidth;
// m_ThumbnailHeight = ThumbnailHeight;
//}
//public static Bitmap GetWebSiteThumbnail(string Url, int BrowserWidth, int BrowserHeight, int ThumbnailWidth, int ThumbnailHeight)
//{
// HtmlToImgHelper thumbnailGenerator = new HtmlToImgHelper(Url, BrowserWidth, BrowserHeight, ThumbnailWidth, ThumbnailHeight);
// return thumbnailGenerator.GenerateWebSiteThumbnailImage();
//}
//public Bitmap GenerateWebSiteThumbnailImage()
//{
// Thread m_thread = new Thread(new ThreadStart(_GenerateWebSiteThumbnailImage));
// m_thread.SetApartmentState(ApartmentState.STA);
// m_thread.Start();
// m_thread.Join();
// return m_Bitmap;
//}
//private void _GenerateWebSiteThumbnailImage()
//{
// WebBrowser m_WebBrowser = new WebBrowser();
// m_WebBrowser.ScrollBarsEnabled = false;
// m_WebBrowser.Navigate(m_Url);
// m_WebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WebBrowser_DocumentCompleted);
// while (m_WebBrowser.ReadyState != WebBrowserReadyState.Complete)
// Application.DoEvents();
// m_WebBrowser.Dispose();
//}
//private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
//{
// WebBrowser m_WebBrowser = (WebBrowser)sender;
// m_WebBrowser.ClientSize = new Size(this.m_BrowserWidth, this.m_BrowserHeight);
// m_WebBrowser.ScrollBarsEnabled = false;
// m_Bitmap = new Bitmap(m_WebBrowser.Bounds.Width, m_WebBrowser.Bounds.Height);
// m_WebBrowser.BringToFront();
// m_WebBrowser.DrawToBitmap(m_Bitmap, m_WebBrowser.Bounds);
// m_Bitmap = (Bitmap)m_Bitmap.GetThumbnailImage(m_ThumbnailWidth, m_ThumbnailHeight, null, IntPtr.Zero);
//}
//public string GetHtmlToImgString() {
// Bitmap m_Bitmap = GetWebSiteThumbnail("这里是html的连接地址", 990, 2798, 990, 2798);
// MemoryStream ms = new MemoryStream();
// m_Bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);//JPG、GIF、PNG等均可
// byte[] buff = ms.ToArray();
// Response.BinaryWrite(buff);
// System.Drawing.Image img = byteArrayToImage(buff);
// string url = "图片保存路径.png";
// img.Save(url);
//}
public string GetHtmlToImage() {
var converter = new HtmlConverter();
string html = "<div>hello world</div>";
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
html = StringHelper.GetFileContent("E:/LDWork/LiuDongWork/OnLineItem/MallNew/Mall.WebApi/upfile/temimg/新建文本文档.txt", Encoding.GetEncoding("gb2312"));
byte[] byte1 = converter.FromHtmlString(html, 385);
string str = System.Text.Encoding.Default.GetString(byte1);
//Bitmap bitmap = BytesToBitmap(byte1, 385, 675);
Bitmap bitmap = BytesToBitmap2(byte1);
string url = "E:/LDWork/LiuDongWork/OnLineItem/MallNew/Mall.WebApi/upfile/temimg/图片保存路径.jpg";
bitmap.Save(url, System.Drawing.Imaging.ImageFormat.Jpeg);
return url;
}
//public string GetHtmlToImg_V2(string fileName) {
// byte[] byte1 = StreamToBytes(FileToStream(fileName));
// Bitmap bitmap = BytesToBitmap(byte1, 385, 675);
// //MemoryStream ms = new MemoryStream();
// //bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);//JPG、GIF、PNG等均可
// string url = "图片保存路径.png";
// bitmap.Save(url, System.Drawing.Imaging.ImageFormat.Jpeg);
// return url;
//}
//byte[] 转图片
public static Bitmap BytesToBitmap(byte[] Bytes, int width, int heiht)
{
MemoryStream stream = null;
try
{
stream = new MemoryStream(Bytes);
return new Bitmap((Image)new Bitmap(stream), width, heiht);
}
catch (ArgumentNullException ex)
{
throw ex;
}
catch (ArgumentException ex)
{
throw ex;
}
finally
{
stream.Close();
}
}
public static Bitmap BytesToBitmap2(byte[] Bytes)
{
MemoryStream stream = null;
try
{
stream = new MemoryStream(Bytes);
return new Bitmap((Image)new Bitmap(stream));
}
catch (ArgumentNullException ex)
{
throw ex;
}
catch (ArgumentException ex)
{
throw ex;
}
finally
{
stream.Close();
}
}
//图片转byte[]
public static byte[] BitmapToBytes(Bitmap Bitmap)
{
MemoryStream ms = null;
try
{
ms = new MemoryStream();
Bitmap.Save(ms, Bitmap.RawFormat);
byte[] byteImage = new Byte[ms.Length];
byteImage = ms.ToArray();
return byteImage;
}
catch (ArgumentNullException ex)
{
throw ex;
}
finally
{
ms.Close();
}
}
/// <summary>
/// 将 Stream 转成 byte[]
/// </summary>
public byte[] StreamToBytes(Stream stream)
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
return bytes;
}
/// <summary>
/// 将 byte[] 转成 Stream
/// </summary>
public Stream BytesToStream(byte[] bytes)
{
Stream stream = new MemoryStream(bytes);
return stream;
}
/// <summary>
/// 将 Stream 写入文件
/// </summary>
public void StreamToFile(Stream stream, string fileName)
{
// 把 Stream 转换成 byte[]
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
// 设置当前流的位置为流的开始
stream.Seek(0, SeekOrigin.Begin);
// 把 byte[] 写入文件
FileStream fs = new FileStream(fileName, FileMode.Create);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(bytes);
bw.Close();
fs.Close();
}
/// <summary>
/// 从文件读取 Stream
/// </summary>
public Stream FileToStream(string fileName)
{
// 打开文件
FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
// 读取文件的 byte[]
byte[] bytes = new byte[fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
fileStream.Close();
// 把 byte[] 转换成 Stream
Stream stream = new MemoryStream(bytes);
return stream;
}
}
}
...@@ -1443,6 +1443,24 @@ namespace Mall.Common.Plugin ...@@ -1443,6 +1443,24 @@ namespace Mall.Common.Plugin
} }
} }
/// <summary>
/// 获取文件内容
/// </summary>
/// <param name="filePath">文件路径</param>
/// <returns></returns>
public static string GetFileContent(string filePath, Encoding encoding)
{
if (File.Exists(filePath))
{
string content = File.ReadAllText(filePath, encoding);
return content;
}
else
{
return "";
}
}
/// <summary> /// <summary>
/// 替换索引出为“*” /// 替换索引出为“*”
/// </summary> /// </summary>
......
...@@ -35,6 +35,14 @@ namespace Mall.Model.Entity.BaseSetUp ...@@ -35,6 +35,14 @@ namespace Mall.Model.Entity.BaseSetUp
/// </summary> /// </summary>
public string ExpressBirdAPIKey { get; set; } public string ExpressBirdAPIKey { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; } public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
} }
} }
...@@ -216,9 +216,9 @@ namespace Mall.Module.Product ...@@ -216,9 +216,9 @@ namespace Mall.Module.Product
item.CoverImage = ""; item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]") if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{ {
List<int> CarouselIdList = JsonConvert.DeserializeObject<List<int>>(item.CarouselImage); List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图 //封面图
item.CoverImage = material_InfoRepository.GetEntity(CarouselIdList[0])?.Path ?? ""; item.CoverImage = CarouselIdList[0];
} }
//验证规格是否已失效 //验证规格是否已失效
if (item.IsCustomSpecification == 1) if (item.IsCustomSpecification == 1)
......
...@@ -1518,7 +1518,7 @@ namespace Mall.Module.User ...@@ -1518,7 +1518,7 @@ namespace Mall.Module.User
{ {
return "用户分销等级与上级用户分销等级不是上下级关系 ID:" + item.UserId; return "用户分销等级与上级用户分销等级不是上下级关系 ID:" + item.UserId;
} }
else if ((hpgmodel.Grade ?? 0) - (gmodel?.Grade ?? 0) != 1) else if ((gmodel?.Grade ?? 0) - (hpgmodel.Grade ?? 0) != 1)
{ {
return "用户分销等级与上级用户分销等级不是上下级关系 ID:" + item.UserId; return "用户分销等级与上级用户分销等级不是上下级关系 ID:" + item.UserId;
} }
......
...@@ -79,6 +79,9 @@ namespace Mall.Repository.User ...@@ -79,6 +79,9 @@ namespace Mall.Repository.User
{ {
where += $@" and {nameof(RB_Distributor_HPGradeInfo.GradeName)} like '%{dmodel.GradeName}%'"; where += $@" and {nameof(RB_Distributor_HPGradeInfo.GradeName)} like '%{dmodel.GradeName}%'";
} }
if (dmodel.IsGuest == 2) {
where += $@" and {nameof(RB_Distributor_HPGradeInfo.IsGuest)}={dmodel.IsGuest}";
}
string sql = $@"select * from RB_Distributor_HPGradeInfo where {where} order by Grade asc"; string sql = $@"select * from RB_Distributor_HPGradeInfo where {where} order by Grade asc";
return Get<RB_Distributor_HPGradeInfo_Extend>(sql).ToList(); return Get<RB_Distributor_HPGradeInfo_Extend>(sql).ToList();
......
...@@ -81,10 +81,9 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -81,10 +81,9 @@ namespace Mall.WebApi.Controllers.MallBase
private readonly MallBaseModule mallBaseModule = new MallBaseModule(); private readonly MallBaseModule mallBaseModule = new MallBaseModule();
/// <summary> /// <summary>
/// 小程序页面处理类 /// 用户积分
/// </summary> /// </summary>
private Module.User.MiniProgramPageModule programPageModule = new Module.User.MiniProgramPageModule(); private readonly IntegralModule integralModule = new IntegralModule();
/// <summary> /// <summary>
/// 小程序首页 /// 小程序首页
...@@ -109,8 +108,9 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -109,8 +108,9 @@ namespace Mall.WebApi.Controllers.MallBase
var homePage = new object(); var homePage = new object();
//底部导航 //底部导航
var navbar = new object(); var navbar = new object();
//授权页面 var setting = new object();
var auth_page = new object(); var share_setting = new object();
var cat_style = new object();
if (MiniAppId != null && !string.IsNullOrEmpty(MiniAppId)) if (MiniAppId != null && !string.IsNullOrEmpty(MiniAppId))
{ {
//获取小程序信息 //获取小程序信息
...@@ -142,31 +142,6 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -142,31 +142,6 @@ namespace Mall.WebApi.Controllers.MallBase
}), }),
}; };
//授权页面热区
var hotspotCancel = new object();
var hotspotLogin = new object();
if (miniProgram.AuthDataList != null && miniProgram.AuthDataList.Count > 0)
{
var first = miniProgram.AuthDataList[0];
var second = miniProgram.AuthDataList[1];
if (first.open_type == "login")
{
hotspotLogin = first;
hotspotCancel = second;
}
else
{
hotspotLogin = second;
hotspotCancel = first;
}
}
auth_page = new
{
pic_url = miniProgram.AuthUrl,
hotspot = hotspotLogin,
hotspot_cancel = hotspotCancel
};
var selfHomePage = miniprogramPageTemplModule.GetMiniprogramPageTemplModule(new RB_Miniprogram_Page_Templ_Extend() var selfHomePage = miniprogramPageTemplModule.GetMiniprogramPageTemplModule(new RB_Miniprogram_Page_Templ_Extend()
{ {
MallBaseId = miniProgram.MallBaseId, MallBaseId = miniProgram.MallBaseId,
...@@ -1203,41 +1178,346 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1203,41 +1178,346 @@ namespace Mall.WebApi.Controllers.MallBase
} }
} }
#region 基本设置
//基础配置 Add By:W 2020年6月1号 //基础配置 Add By:W 2020年6月1号
var mallBaseModel = mallBaseModule.GetListRepository(new RB_MallBase_Extend { TenantId = miniProgram.TenantId ?? 0, MallBaseId = miniProgram.MallBaseId }).FirstOrDefault(); var mallBaseModel = mallBaseModule.GetListRepository(new RB_MallBase_Extend { TenantId = miniProgram.TenantId ?? 0, MallBaseId = miniProgram.MallBaseId }).FirstOrDefault();
//获取物流配置 //获取物流配置
var logisticsRules = mallBaseModule.GetLogisticsList(new RB_Logistics { TenantId = miniProgram.TenantId ?? 0, MallBaseId = miniProgram.MallBaseId }).FirstOrDefault();
//用户积分
var integralModel = integralModule.GetIntegralSettingsList(new RB_Integral_Settings { TenantId = miniProgram.TenantId ?? 0, MallBaseId = miniProgram.MallBaseId }).FirstOrDefault();
List<string> payment_type = new List<string>();
if (!string.IsNullOrWhiteSpace(mallBaseModel.PayWay))
{
foreach (var item in mallBaseModel.PayWay.Split(","))
{
switch (item)
{
case "1":
payment_type.Add("online_pay");
break;
case "2":
payment_type.Add("huodao");
break;
case "3":
payment_type.Add("balance");
break;
default:
break;
}
}
}
List<string> send_type = new List<string>();
if (!string.IsNullOrWhiteSpace(mallBaseModel.DeliverWay))
{
foreach (var item in mallBaseModel.DeliverWay.Split(","))
{
switch (item)
{
case "1":
send_type.Add("express");
break;
case "2":
send_type.Add("offline");
break;
case "3":
send_type.Add("city");
break;
default:
break;
}
}
}
List<string> good_negotiable = new List<string>();
if (!string.IsNullOrWhiteSpace(mallBaseModel.ConsultWay))
{
foreach (var item in mallBaseModel.ConsultWay.Split(","))
{
switch (item)
{
case "1":
good_negotiable.Add("contact");
break;
case "2":
good_negotiable.Add("contact_tel");
break;
case "3":
good_negotiable.Add("contact_web");
break;
default:
break;
}
}
}
var setting = new setting = new
{ {
contact_tel = mallBaseModel.ContactNumber, contact_tel = mallBaseModel?.ContactNumber,
over_time = mallBaseModel.CancelTime, over_time = mallBaseModel?.CancelTime,
delivery_time = mallBaseModel.AutoReceiving, delivery_time = mallBaseModel?.AutoReceiving,
after_sale_time = mallBaseModel.AfterTime, after_sale_time = mallBaseModel?.AfterTime,
payment_type = "", payment_type = payment_type.ToArray(),//支付方式
send_type = "", send_type = send_type.ToArray(),//发货方式
kdniao_mch_id = "",//快递鸟配置 kdniao_mch_id = logisticsRules?.ExpressBirdID,//快递鸟配置
kdniao_api_key = "", kdniao_api_key = logisticsRules?.ExpressBirdAPIKey,
member_integral = integralModel?.IntegralNum,
member_integral_rule = integralModel?.Explain,
good_negotiable = good_negotiable.ToArray(),//商品面议联系方式
mobile_verify = "",
is_small_app = mallBaseModel?.TurnMini,
small_app_id = mallBaseModel?.MinAppId,
small_app_url = mallBaseModel?.MinUrl,
small_app_pic = mallBaseModel?.TurnMiniIco,
is_customer_services = mallBaseModel?.OnlineService,
customer_services_pic = mallBaseModel?.OnlineServiceIco,
is_dial = mallBaseModel?.OneCall,
dial_pic = mallBaseModel?.OneCallIco,
is_web_service = mallBaseModel?.ServiceOutLink,
web_service_url = mallBaseModel?.OuterServiceLink,
web_service_pic = mallBaseModel?.ServiceOutLinkIco,
is_quick_navigation = mallBaseModel?.SuspendBtn,
quick_navigation_style = mallBaseModel?.SuspendStyle,
quick_navigation_opened_pic = mallBaseModel?.UnfoldIco,
quick_navigation_closed_pic = mallBaseModel?.PackUpIco,
is_show_stock = "",
is_use_stock = "",
sell_out_pic = "",
sell_out_other_pic = "",
is_common_user_member_price = mallBaseModel?.DetailsMemberPrice,
is_member_user_member_price = mallBaseModel?.DetailsVipMemberPrice,
is_share_price = mallBaseModel?.DetailsSharePrice,
is_purchase_frame = mallBaseModel?.BuySwitch,
purchase_num = mallBaseModel?.CarouselOrder,
is_comment = mallBaseModel?.DetailsComment,
is_sales = mallBaseModel?.DetailsBuyNum,
is_mobile_auth = mallBaseModel?.OtherIndexMoblie,
is_official_account = mallBaseModel?.OtherTencent,
is_manual_mobile_auth = mallBaseModel?.OtherManualMobile,
is_icon_members_grade = mallBaseModel?.OtherMemerLevel,
is_goods_video = mallBaseModel?.DetailsVideo,
is_quick_map = mallBaseModel?.ShortcutNavigation,
quick_map_pic = mallBaseModel?.ShortcutNavigationIco,
quick_map_address = mallBaseModel?.Address,
longitude = mallBaseModel?.LongAndLat.Split(",")[0],
latitude = mallBaseModel?.LongAndLat.Split(",")[1],
is_quick_home = mallBaseModel?.BackTopNavigation,
quick_home_pic = mallBaseModel?.BackTopNavigationIco,
logo = "",
share_title = mallBaseModel?.MinShareTitle,
share_pic = mallBaseModel?.MinShareIco,
is_add_app = mallBaseModel?.MinSwitch,
add_app_bg_color = mallBaseModel?.MinBackColor,
add_app_bg_transparency = mallBaseModel?.MinBackClarity,
add_app_bg_radius = mallBaseModel?.MinBackCircularBead,
add_app_text = mallBaseModel?.MinTips,
add_app_text_color = mallBaseModel?.MinTipsColor,
add_app_icon_color_type = mallBaseModel?.MinIcoColor,
is_close = "",
business_time_type = "",
business_time_custom_type = "",
business_time_type_day = "",
business_time_type_week = "",
auto_business = "",
auto_business_time = "",
is_icon_super_vip = "",
is_show_normal_vip = "",
is_show_super_vip = "",
is_required_position = mallBaseModel?.OtherMustAddress,
is_share_tip = mallBaseModel?.OtherApplyShare,
is_show_cart = mallBaseModel?.ListShopCar,
is_show_sales_num = mallBaseModel?.ListBuyCount,
is_show_goods_name = mallBaseModel?.ListName,
is_underline_price = mallBaseModel?.DetailsLineationPrice,
is_express = mallBaseModel?.DeatilsExpress,
is_not_share_show = mallBaseModel?.OtherNoShare,
is_show_cart_fly = mallBaseModel?.CarSuspendBtn,
is_show_score_top = mallBaseModel?.BackTopBtn,
express_select_type = logisticsRules?.LogisticsType,//待会儿处理
express_aliapy_code = logisticsRules?.AliyunAppCode,
is_quick_customize = mallBaseModel?.Custom,
quick_customize_pic = mallBaseModel?.TurnIco,
quick_customize_open_type = "",
quick_customize_params = "",
quick_customize_link_url = mallBaseModel?.TurnLink,
quick_customize_new_params = "",
theme_color = "",
latitude_longitude = mallBaseModel?.LongAndLat
};
#endregion
#region 分销基础信息
var distributorBasics = userModule.GetDistributorBasicsInfo((miniProgram.TenantId ?? 0).ToString(), miniProgram.MallBaseId);
if (!string.IsNullOrEmpty(distributorBasics.WithdrawWay))
{
distributorBasics.WithdrawWayList = JsonConvert.DeserializeObject<List<int>>(distributorBasics.WithdrawWay);
}
List<string> pay_type = new List<string>();
if (!string.IsNullOrWhiteSpace(distributorBasics.WithdrawWay))
{
foreach (var item in distributorBasics.WithdrawWayList)
{
switch (item)
{
case 1:
pay_type.Add("auto");
break;
case 2:
pay_type.Add("wechat");
break;
case 3:
pay_type.Add("alipay");
break;
case 4:
pay_type.Add("bank");
break;
case 5:
pay_type.Add("balance");
break;
default:
break;
}
}
}
share_setting = new
{
level = distributorBasics?.DistributorTier,
is_rebate = distributorBasics?.InPurchasing,
price_type = distributorBasics?.DistributorCommissionType,
first = distributorBasics?.OneCommission,
second = distributorBasics?.TwoCommission,
third = distributorBasics?.ThreeCommission,
share_condition = "",
condition = distributorBasics?.ReferralsCondition ?? 0,
auto_share_val = "",
share_goods_status = "",
share_goods_warehouse_id = "",
pay_type = pay_type.ToArray(),
cash_max_day = distributorBasics?.DailyWithdrawalLimit,
min_money = distributorBasics?.MinimumWithdrawalLimit,
cash_service_charge = distributorBasics?.WithdrawFee,
agree = distributorBasics?.ApplicationProtocol,
content = distributorBasics?.UserNotes,
pic_url_apply = "",
pic_url_status = distributorBasics?.BackgroundImage,
pic_url_home_head = distributorBasics?.IndexImage,
become_condition = "",
cat_list = "",
is_show_share_level = "",
}; };
#endregion
#region share_setting_custom
var distributorCustom = userModule.GetDistributorCustomInfo((miniProgram.TenantId ?? 0).ToString(), miniProgram.MallBaseId);
var share_setting_custom = new
{
menus = new
{
money = new
{
name = distributorCustom?.DistributionCommissionName,
icon = distributorCustom?.DistributionCommissionImage,
open_type = "",
url = "",
tel = ""
},
order = new
{
name = distributorCustom?.DistributionOrderName,
icon = distributorCustom?.DistributionOrderImage,
open_type = "",
url = "",
tel = ""
},
cash = new
{
name = distributorCustom?.WithdrawDetialsName,
icon = distributorCustom?.WithdrawDetialsImage,
open_type = "",
url = "",
tel = ""
},
team = new
{
name = distributorCustom?.MyTeamName,
icon = distributorCustom?.MyTeamImage,
open_type = "",
url = "",
tel = ""
},
qrcode = new
{
name = distributorCustom?.PromoteQRCodeName,
icon = distributorCustom?.PromoteQRCodeImage,
open_type = "",
url = "",
tel = ""
},
},
words = new
{
can_be_presented = new { name = distributorCustom?.CommissionForWithdrawalName, defaultStr = "可提现佣金" },
already_presented = new { name = distributorCustom?.CommissionWithdrawnName, defaultStr = "已提现佣金" },
parent_name = new { name = distributorCustom?.ReferrerName, defaultStr = "推荐人" },
pending_money = new { name = distributorCustom?.CommissionTobePaidName, defaultStr = "待打款佣金" },
cash = new { name = distributorCustom?.WithdrawDepositName, defaultStr = "提现" },
user_instructions = new { name = distributorCustom?.UserNotesName, defaultStr = "用户须知" },
apply_cash = new { name = distributorCustom?.IWantToWithdrawName, defaultStr = "我要提现" },
cash_type = new { name = distributorCustom?.WithdrawalWayName, defaultStr = "提现方式" },
cash_money = new { name = distributorCustom?.WithdrawalAmountName, defaultStr = "提现金额" },
order_money_un = new { name = distributorCustom?.OutstandingCommissionName, defaultStr = "未结算佣金" },
share_name = new { name = distributorCustom?.DistributorName, defaultStr = "分销商" },
one_share = new { name = distributorCustom?.OneDistributionName, defaultStr = "一级分销名称" },
second_share = new { name = distributorCustom?.TwoDistributionName, defaultStr = "二级分销名称" },
three_share = new { name = distributorCustom?.ThreeDistributionName, defaultStr = "三级分销名称" },
},
apply = new
{
share_apply = new { name = distributorCustom?.DistributionApplication, defaultStr = "分销申请" },
share_apply_pact = new { name = distributorCustom?.ApplicationAgreement, defaultStr = "分销申请协议" },
apply_btn_color = distributorCustom?.ButtonTextColor,
apply_btn_background = distributorCustom?.ButtonColor,
apply_btn_title = distributorCustom?.ButtonText,
apply_btn_round = distributorCustom?.ButtonFilletPX,
apply_head_pic = distributorCustom?.HeadImage,
apply_end_pic = distributorCustom?.BottomImage
},
};
#endregion
#region 商品分类样式
var productCategoryStyle = productModule.GetProductCategoryStyleInfo(miniProgram.TenantId ?? 0, miniProgram.MallBaseId);
cat_style = new
{
cat_style = productCategoryStyle?.Type,
recommend_count = productCategoryStyle?.Style,
cat_goods_count = productCategoryStyle?.CategoryNum,
cat_goods_cols = productCategoryStyle?.RowNum
};
#endregion
} }
} }
var user_info = new object(); var user_info = new object();
if (RequestParm.OpenId != null && !string.IsNullOrWhiteSpace(RequestParm.OpenId)) if (RequestParm.OpenId != null && !string.IsNullOrWhiteSpace(RequestParm.OpenId))
{ {
var memberModel = userModule.GetAppletUserCenterStatistics(RequestParm.OpenId); var memberModel = userModule.GetAppletUserCenterStatistics(RequestParm.OpenId);
user_info = memberModel; user_info = memberModel;
} }
var miniPageList= programPageModule.GetMiniprogram_Page_ListExtModule(new RB_MiniProgram_Page_Extend() { MallBaseId = RequestParm.MallBaseId });
var objResult = new var objResult = new
{ {
home_pages = homePage, home_pages = homePage,
navbar, navbar,
user_info, user_info,
auth_page,//授权页面 setting,
bar_title=miniPageList?.Select(qitem=>new { name= qitem.PageName, value=qitem.PageUrl, new_name=qitem.SelfPageName }),//导航标题 share_setting,
cat_style
}; };
return ApiResult.Success(data: objResult); return ApiResult.Success(data: objResult);
} }
...@@ -1780,7 +2060,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1780,7 +2060,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
} }
}; };
data = new data = new
{ {
mall = new mall = new
......
...@@ -140,6 +140,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -140,6 +140,7 @@ namespace Mall.WebApi.Controllers.MallBase
else else
{ {
query.TenantId = UserInfo.TenantId; query.TenantId = UserInfo.TenantId;
query.MallBaseId = UserInfo.MallBaseId;
bool result = mallBaseModule.AddOrUpdateLogistics(query); bool result = mallBaseModule.AddOrUpdateLogistics(query);
if (result) if (result)
{ {
......
...@@ -1129,5 +1129,18 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1129,5 +1129,18 @@ namespace Mall.WebApi.Controllers.MallBase
} }
#endregion #endregion
#region 生产海报
/// <summary>
/// 商品海报
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsPoster() {
string address = new HtmlToImgHelper().GetHtmlToImage();
return ApiResult.Success("", address);
}
#endregion
} }
} }
\ No newline at end of file
...@@ -46,7 +46,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -46,7 +46,8 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.UserId = userInfo.UserId; demodel.UserId = userInfo.UserId;
var list = orderModule.GetGoodsShoppingCartPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = orderModule.GetGoodsShoppingCartPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new var MallModel = orderModule.GetMiniProgramExtend(userInfo.MallBaseId);
var listobj = list.Select(x => new
{ {
x.Id, x.Id,
x.GoodsId, x.GoodsId,
...@@ -61,6 +62,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -61,6 +62,14 @@ namespace Mall.WebApi.Controllers.MallBase
x.MallBaseId, x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}); });
List<object> robj = new List<object>() {
new {
MallId =MallModel?.MallBaseId??0,
MallName =MallModel?.MallName??"",
GoodsList=listobj
}
};
pagelist.pageData = robj;
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
} }
......
...@@ -19,6 +19,7 @@ using JWT.Algorithms; ...@@ -19,6 +19,7 @@ using JWT.Algorithms;
using JWT.Serializers; using JWT.Serializers;
using Mall.Common.Enum; using Mall.Common.Enum;
using Mall.CacheKey; using Mall.CacheKey;
using Mall.Common.Pay.WeChatPat;
namespace Mall.WebApi.Controllers.User namespace Mall.WebApi.Controllers.User
{ {
...@@ -193,6 +194,46 @@ namespace Mall.WebApi.Controllers.User ...@@ -193,6 +194,46 @@ namespace Mall.WebApi.Controllers.User
} }
} }
/// <summary>
/// 获取小程序token
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetMallToken(object requestMsg) {
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (requestParm.TenantId <= 0)
{
return ApiResult.ParamIsNull("请传递商户号");
}
if (requestParm.MallBaseId <= 0)
{
return ApiResult.ParamIsNull("请传递小程序id");
}
var appletWeChatModel = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend() { MallBaseId = requestParm.MallBaseId });
if (appletWeChatModel == null) {
return ApiResult.ParamIsNull("小程序不存在");
}
if (appletWeChatModel.TenantId != requestParm.TenantId) {
return ApiResult.ParamIsNull("商户号错误");
}
string token = CacheManager.AppletWeChat.WeiXinReidsCache.Get(appletWeChatModel.MiniAppId);
if (string.IsNullOrEmpty(token))
{
token = TokenHelper.GetLXYToken(token, appletWeChatModel.MiniAppId, appletWeChatModel.MiniAppSecret);
Task.Run(() => CacheManager.AppletWeChat.WeiXinReidsCache.Set(appletWeChatModel.MiniAppId, token));
}
if (!string.IsNullOrEmpty(token))
{
return ApiResult.Success("", token);
}
else {
return ApiResult.Failed();
}
}
#endregion #endregion
} }
} }
\ No newline at end of file
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