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
69803be8
Commit
69803be8
authored
Nov 27, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
6e17e6c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
8 deletions
+42
-8
PublishController.cs
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
+41
-8
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+1
-0
No files found.
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
View file @
69803be8
...
@@ -37,15 +37,21 @@ namespace Mall.WebApi.Controllers.AppletWeChat
...
@@ -37,15 +37,21 @@ namespace Mall.WebApi.Controllers.AppletWeChat
};
};
//读取小程序的配置文件
//读取小程序的配置文件
string
path
=
projectUrl
+
"/miniProject/common/vendor.js"
;
string
path
=
projectUrl
+
"/miniProject/common/vendor.js"
;
string
basePath
=
projectUrl
+
"/vendorbase.js"
;
string
jsonpath
=
projectUrl
+
"/miniProject/project.config.json"
;
string
jsonpath
=
projectUrl
+
"/miniProject/project.config.json"
;
string
basePath
=
projectUrl
+
"/vendorbase.js"
;
string
jsonbasePath
=
projectUrl
+
"/project.configbase.json"
;
string
jsonbasePath
=
projectUrl
+
"/project.configbase.json"
;
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
if
(
System
.
IO
.
File
.
Exists
(
path
)
&&
System
.
IO
.
File
.
Exists
(
jsonpath
))
if
(
System
.
IO
.
File
.
Exists
(
path
)
&&
System
.
IO
.
File
.
Exists
(
jsonpath
))
{
{
try
try
{
{
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive/common/vendor.js"
;
jsonpath
=
projectUrl
+
"/miniProjectLive/project.config.json"
;
}
string
txtStr
=
System
.
IO
.
File
.
ReadAllText
(
basePath
);
string
txtStr
=
System
.
IO
.
File
.
ReadAllText
(
basePath
);
string
newStr
=
txtStr
.
Replace
(
"$MallBaseId$"
,
query
.
MallBaseId
.
ToString
()).
Replace
(
"$TenantId$"
,
query
.
TenantId
.
ToString
()).
Replace
(
"$MiniAppId$"
,
model
.
MiniAppId
);
string
newStr
=
txtStr
.
Replace
(
"$MallBaseId$"
,
query
.
MallBaseId
.
ToString
()).
Replace
(
"$TenantId$"
,
query
.
TenantId
.
ToString
()).
Replace
(
"$MiniAppId$"
,
model
.
MiniAppId
);
System
.
IO
.
File
.
WriteAllText
(
path
,
newStr
);
System
.
IO
.
File
.
WriteAllText
(
path
,
newStr
);
...
@@ -115,9 +121,32 @@ namespace Mall.WebApi.Controllers.AppletWeChat
...
@@ -115,9 +121,32 @@ namespace Mall.WebApi.Controllers.AppletWeChat
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetPreviewAppletWeChat
()
public
ApiResult
GetPreviewAppletWeChat
()
{
{
var
parms
=
RequestParm
;
var
query
=
new
RB_MiniProgram_Extend
{
TenantId
=
UserInfo
.
TenantId
,
MallBaseId
=
parms
.
MallBaseId
};
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"您还未配置微信小程序基础信息"
);
}
try
try
{
{
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/preview?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
projectUrl
+
"/miniProject"
)}
&qr-format=base64"
;
string
path
=
projectUrl
+
"/miniProject"
;
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
{
query
.
Version
=
"1.0.00"
;
}
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive"
;
}
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/preview?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
path
)}
&qr-format=base64"
;
// string URL = $"http://127.0.0.1:{developerKitsPort}/v2/preview?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&qr-format=base64";
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
if
(
result
.
Length
>
200
&&
!
result
.
Contains
(
"data:image/png;base64,"
))
if
(
result
.
Length
>
200
&&
!
result
.
Contains
(
"data:image/png;base64,"
))
{
{
...
@@ -162,16 +191,20 @@ namespace Mall.WebApi.Controllers.AppletWeChat
...
@@ -162,16 +191,20 @@ namespace Mall.WebApi.Controllers.AppletWeChat
try
try
{
{
string
path
=
projectUrl
+
"/miniProject"
;
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
{
{
query
.
Version
=
"1.0.00"
;
//1111
query
.
Version
=
"1.0.00"
;
//1111
}
}
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive"
;
}
int
version
=
Convert
.
ToInt32
(
model
.
Version
.
Replace
(
"."
,
""
));
int
version
=
Convert
.
ToInt32
(
model
.
Version
.
Replace
(
"."
,
""
));
version
+=
1
;
version
+=
1
;
model
.
Version
=
version
.
ToString
().
Substring
(
0
,
version
.
ToString
().
Length
-
3
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
3
,
1
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
2
,
2
);
model
.
Version
=
version
.
ToString
().
Substring
(
0
,
version
.
ToString
().
Length
-
3
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
3
,
1
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
2
,
2
);
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/upload?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
path
)}
&version=V
{
model
.
Version
}
&desc=微信开发者工具HTTP上传&appid=
{
model
.
MiniAppId
}
"
;
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/upload?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
projectUrl
+
"/miniProject"
)}
&version=V
{
model
.
Version
}
&desc=微信开发者工具HTTP上传&appid=
{
model
.
MiniAppId
}
"
;
//
string URL = $"http://127.0.0.1:{developerKitsPort}/v2/upload?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&version=V{model.Version}&desc=微信开发者工具HTTP上传&appid={model.MiniAppId}";
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
JObject
parmsJob
=
JObject
.
Parse
(
result
);
JObject
parmsJob
=
JObject
.
Parse
(
result
);
if
(
parmsJob
.
ContainsKey
(
"code"
))
if
(
parmsJob
.
ContainsKey
(
"code"
))
...
@@ -576,8 +609,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
...
@@ -576,8 +609,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
{
{
var
parms
=
RequestParm
;
var
parms
=
RequestParm
;
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Live_HouseExtension_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Live_HouseExtension_Extend
>(
RequestParm
.
msg
.
ToString
());
bool
flag
=
appletWeChatModule
.
SetLiveQrCodeModule
(
extModel
)
;
bool
flag
=
appletWeChatModule
.
SetLiveQrCodeModule
(
extModel
);
return
flag
?
ApiResult
.
Success
():
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
/// <summary>
/// <summary>
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
69803be8
...
@@ -385,6 +385,7 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -385,6 +385,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
{
id
=
miniProgram
.
MallBaseId
,
id
=
miniProgram
.
MallBaseId
,
name
=
miniProgram
.
MallName
,
name
=
miniProgram
.
MallName
,
livePlayerPlugin
=
miniProgram
.
LivePlayerPlugin
,
user_id
=
0
,
user_id
=
0
,
created_at
=
miniProgram
.
CreateDate
.
HasValue
?
miniProgram
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
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"
)
:
""
,
updated_at
=
miniProgram
.
CreateDate
.
HasValue
?
miniProgram
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
...
...
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