Commit b8f6f4d8 authored by 吴春's avatar 吴春

发布

parent ad80e5a4
......@@ -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 });
}
......
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