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
b8f6f4d8
Commit
b8f6f4d8
authored
Jun 23, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发布
parent
ad80e5a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
PublishController.cs
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
+27
-11
No files found.
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
View file @
b8f6f4d8
...
...
@@ -37,13 +37,29 @@ namespace Mall.WebApi.Controllers.AppletWeChat
//读取小程序的配置文件
string
path
=
projectUrl
+
"/miniProject/common/vendor.js"
;
string
basePath
=
projectUrl
+
"/vendorbase.js"
;
if
(
System
.
IO
.
File
.
Exists
(
path
))
string
jsonpath
=
projectUrl
+
"/miniProject/project.config.json"
;
string
jsonbasePath
=
projectUrl
+
"/project.configbase.json"
;
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
if
(
System
.
IO
.
File
.
Exists
(
path
)&&
System
.
IO
.
File
.
Exists
(
jsonpath
))
{
string
txtStr
=
System
.
IO
.
File
.
ReadAllText
(
basePath
);
try
{
string
txtStr
=
System
.
IO
.
File
.
ReadAllText
(
basePath
);
string
newStr
=
txtStr
.
Replace
(
"$MallBaseId$"
,
query
.
MallBaseId
.
ToString
()).
Replace
(
"$TenantId$"
,
query
.
TenantId
.
ToString
()).
Replace
(
"$MiniAppId$"
,
model
.
MiniAppId
);
System
.
IO
.
File
.
WriteAllText
(
path
,
newStr
);
string
txtStrjson
=
System
.
IO
.
File
.
ReadAllText
(
jsonbasePath
);
string
newStrjson
=
txtStrjson
.
Replace
(
"$MiniAppId$"
,
model
.
MiniAppId
);
System
.
IO
.
File
.
WriteAllText
(
jsonpath
,
newStrjson
);
string
newStr
=
txtStr
.
Replace
(
"$MallBaseId$"
,
query
.
MallBaseId
.
ToString
()).
Replace
(
"$TenantId$"
,
query
.
TenantId
.
ToString
());
System
.
IO
.
File
.
WriteAllText
(
path
,
newStr
);
return
ApiResult
.
Success
(
"基础信息配置成功"
);
return
ApiResult
.
Success
(
"基础信息配置成功"
);
}
catch
(
Exception
ex
)
{
return
ApiResult
.
Failed
(
ex
.
ToString
());
}
}
else
{
...
...
@@ -145,16 +161,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat
try
{
if
(
string
.
IsNullOrWhiteSpace
(
query
.
Version
))
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
{
query
.
Version
=
"1.0.00"
;
query
.
Version
=
"1.0.00"
;
//1111
}
int
version
=
Convert
.
ToInt32
(
query
.
Version
.
Replace
(
"."
,
""
));
int
version
=
Convert
.
ToInt32
(
model
.
Version
.
Replace
(
"."
,
""
));
version
+=
1
;
query
.
Version
=
version
.
ToString
().
Substring
(
0
,
version
.
ToString
().
Length
-
3
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
3
,
1
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
1
,
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
(
projectUrl
+
"/miniProject"
)}
&version=V
{
query
.
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
,
""
);
JObject
parmsJob
=
JObject
.
Parse
(
result
);
if
(
parmsJob
.
ContainsKey
(
"code"
))
...
...
@@ -162,7 +178,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
return
ApiResult
.
Failed
(
parmsJob
.
GetValue
(
"message"
).
ToString
());
}
//更新版本
appletWeChatModule
.
UpdateVersion
(
query
);
appletWeChatModule
.
UpdateVersion
(
model
);
return
ApiResult
.
Success
(
"上传成功"
,
new
{
result
,
URL
});
}
...
...
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