Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
4a733c10
Commit
4a733c10
authored
Jun 04, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
111
parents
1d15cf17
de40a998
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
651 additions
and
50 deletions
+651
-50
Mall.Common.csproj
Mall.Common/Mall.Common.csproj
+1
-0
HtmlToImgHelper.cs
Mall.Common/Plugin/HtmlToImgHelper.cs
+227
-0
StringHelper.cs
Mall.Common/Plugin/StringHelper.cs
+18
-0
RB_Logistics.cs
Mall.Model/Entity/BaseSetUp/RB_Logistics.cs
+8
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+2
-2
UserModule.cs
Mall.Module.User/UserModule.cs
+1
-1
RB_Distributor_HPGradeInfoRepository.cs
Mall.Repository/User/RB_Distributor_HPGradeInfoRepository.cs
+3
-0
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+326
-46
MallBaseController.cs
Mall.WebApi/Controllers/MallBase/MallBaseController.cs
+1
-0
AppletGoodsController.cs
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
+13
-0
AppletOrderController.cs
Mall.WebApi/Controllers/Product/AppletOrderController.cs
+10
-1
AppletLoginController.cs
Mall.WebApi/Controllers/User/AppletLoginController.cs
+41
-0
No files found.
Mall.Common/Mall.Common.csproj
View file @
4a733c10
...
@@ -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" />
...
...
Mall.Common/Plugin/HtmlToImgHelper.cs
0 → 100644
View file @
4a733c10
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
;
}
}
}
Mall.Common/Plugin/StringHelper.cs
View file @
4a733c10
...
@@ -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>
...
...
Mall.Model/Entity/BaseSetUp/RB_Logistics.cs
View file @
4a733c10
...
@@ -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
;
}
}
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
4a733c10
...
@@ -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
)
...
...
Mall.Module.User/UserModule.cs
View file @
4a733c10
...
@@ -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
;
}
}
...
...
Mall.Repository/User/RB_Distributor_HPGradeInfoRepository.cs
View file @
4a733c10
...
@@ -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
();
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
4a733c10
This diff is collapsed.
Click to expand it.
Mall.WebApi/Controllers/MallBase/MallBaseController.cs
View file @
4a733c10
...
@@ -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
)
{
{
...
...
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
View file @
4a733c10
...
@@ -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
Mall.WebApi/Controllers/Product/AppletOrderController.cs
View file @
4a733c10
...
@@ -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
);
}
}
...
...
Mall.WebApi/Controllers/User/AppletLoginController.cs
View file @
4a733c10
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment