Commit 9c53baef authored by 吴春's avatar 吴春

提交代码

parent 8fb99e6f
......@@ -1017,7 +1017,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.OrderSuccessTpl,
page = "index",
page = "pages/index/index.html",
data = new
{
character_string6 = new
......
......@@ -128,7 +128,7 @@ namespace Mall.Module.User
/// <param name="OrderPay">支付金额</param>
/// <param name="GoodsName">商品</param>
/// <returns></returns>
public bool SendOrderSucceedMsg(int TenantId, int MallBaseId, string OpenId, string OrderNo, string OrderCreate, string OrderPay, string GoodsName)
public bool SendOrderSucceedMsg(int TenantId, int MallBaseId, string OpenId, string OrderNo, string OrderCreate, string OrderMoney, string GoodsName)
{
var appletWeChatModel = programRepository.GetListRepository(new RB_MiniProgram_Extend { TenantId = TenantId, MallBaseId = MallBaseId }).FirstOrDefault();
......@@ -150,7 +150,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.OrderSuccessTpl,
page = "index",
page = "pages/order/index/index",
data = new
{
character_string6 = new
......@@ -163,7 +163,7 @@ namespace Mall.Module.User
},
amount3 = new
{
value = OrderPay
value = "¥" + OrderMoney
},
thing1 = new
{
......@@ -240,7 +240,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.OrderCancelTpl,
page = "index",
page = "pages/order/index/index",
data = new
{
character_string1 = new
......@@ -253,7 +253,7 @@ namespace Mall.Module.User
},
amount4 = new
{
value = OrderMoney
value = "¥" + OrderMoney
},
name8 = new
{
......@@ -331,7 +331,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.OrderDeliverGoodsTpl,
page = "index",
page = "pages/order/index/index",
data = new
{
thing8 = new
......@@ -420,7 +420,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.RefundTpl,
page = "index",
page = "pages/order/index/index",
data = new
{
character_string4 = new
......@@ -433,7 +433,7 @@ namespace Mall.Module.User
},
amount2 = new
{
value = OrderMoney
value = OrderMoney+ "元"
},
thing1 = new
{
......@@ -508,7 +508,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.ActiveStateTpl,
page = "index",
page = Mall.Common.Config.FirstPage,
data = new
{
thing1 = new
......@@ -592,7 +592,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.AuditResultTpl,
page = "index",
page = Mall.Common.Config.FirstPage,
data = new
{
thing4 = new
......@@ -655,7 +655,7 @@ namespace Mall.Module.User
/// <param name="OpenId"></param>
/// <param name="Monry">提现金额</param>
/// <param name="ServiceCharge">手续费</param>
/// <param name="Type">Type</param>
/// <param name="Type">打款方式</param>
/// <param name="Remark">打款原因</param>
/// <returns></returns>
public bool SendWithdrawSucceedMsg(int TenantId, int MallBaseId, string OpenId, string Monry, string ServiceCharge, string Type, string Remark)
......@@ -680,16 +680,16 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.ReflectSuccessTpl,
page = "index",
page = Mall.Common.Config.FirstPage,
data = new
{
amount1 = new
{
value = Monry
value = "¥" + Monry
},
amount2 = new
{
value = ServiceCharge
value = "¥" + ServiceCharge
},
thing3 = new
{
......@@ -766,7 +766,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.ReflectFailTpl,
page = "index",
page = Mall.Common.Config.FirstPage,
data = new
{
amount1 = new
......@@ -844,7 +844,7 @@ namespace Mall.Module.User
{
touser = OpenId,
template_id = appletWeChatModel.MembersLevelChangeTpl,
page = "index",
page = Mall.Common.Config.FirstPage,
data = new
{
thing3 = new
......@@ -957,6 +957,6 @@ namespace Mall.Module.User
#endregion
}
}
......@@ -327,10 +327,7 @@ namespace Mall.Module.User
{
goodsName += "等" + orderGoodsList.Count + "件商品";
}
appletWeChatModule.SendOrderSucceedMsg(oldOrder.TenantId, oldOrder.MallBaseId, umodel.OpenId, oldOrder.OrderNo, oldOrder.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), "微信", goodsName);
appletWeChatModule.SendOrderSucceedMsg(oldOrder.TenantId, oldOrder.MallBaseId, umodel.OpenId, oldOrder.OrderNo, oldOrder.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), (oldOrder.Income ?? 0).ToString(), goodsName);
}
return flag;
}
......
......@@ -240,7 +240,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
}
var appletWeChatModel = appletWeChatModule.GetTenantListModule(new RB_MiniProgram_Extend { TenantId = Convert.ToInt32(parmsInfo.uid), MallBaseId = parmsInfo.MallBaseId }).FirstOrDefault();
string OpenId = "ow_7I5XC1-RGwwk8QANBmWKYKmOc"; //GetHelpByWx(code, appletWeChatModel);
bool flag = appletWeChatModule.SendOrderSucceedMsg(Convert.ToInt32(parmsInfo.uid), parmsInfo.MallBaseId, OpenId, "1176", "2020-05-12 14:01:12", "微信", "测试商品请勿购买");
bool flag = appletWeChatModule.SendOrderSucceedMsg(Convert.ToInt32(parmsInfo.uid), parmsInfo.MallBaseId, OpenId, "SNO215445555", "2020-05-12 14:01:12", "¥500", "测试商品请勿购买");
if (flag)
{
return ApiResult.Success();
......
......@@ -9,6 +9,7 @@ using System.Threading;
using System.Text.RegularExpressions;
using Test.DBHelper;
using MySql.Data.MySqlClient;
using System.Linq;
namespace Test.Helper
{
......@@ -23,7 +24,8 @@ namespace Test.Helper
public static void GetData()
{
string cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; HJ_SESSION_ID=7vk71fa0f18fbqh525spku825f; _csrf=a8195370a076c6ca402e1bcfe99202bab6fe6db797e12d3b3c962b8ab05858c6a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22LKtJyYWEFsOkis_aatuA-fbrGZvhC3fp%22%3B%7D";
GetGategoryImgList(cookie);
// GetGategoryImgList(cookie);
GetDestinationList(cookie);
}
public static void GetPage(string cookie)
......@@ -37,9 +39,9 @@ namespace Test.Helper
Console.WriteLine(index + "/" + list.Count + item.title + "分类Start");
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO RB_Miniprogram_Page_Templ(PageName,IsUse,IsShowNav,IsHome,TenantId,MallBaseId,CreateDate,CreateBy,Status)");
builder.AppendFormat(" VALUES('{0}',{1},{2},{3},1,1,'{4}',1,0);SELECT LAST_INSERT_ID()", item.title,item.is_disable,item.show_navs,item.is_home_page, DateTime.Now);
builder.AppendFormat(" VALUES('{0}',{1},{2},{3},1,1,'{4}',1,0);SELECT LAST_INSERT_ID()", item.title, item.is_disable, item.show_navs, item.is_home_page, DateTime.Now);
List<MySqlParameter> paramsList = new List<MySqlParameter>();
try
{
var res = DBHelper.MySqlHelper.ExecuteScalar(DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, builder.ToString(), paramsList.ToArray());
......@@ -54,12 +56,12 @@ namespace Test.Helper
{
StringBuilder builder2 = new StringBuilder();
builder2.AppendFormat(" INSERT INTO rb_miniprogram_page_templ_details(PageTemplID,NavName,TemplateId,TemplateShowName)");
builder2.AppendFormat(" VALUES({0},'{1}',{2},'{3}');SELECT LAST_INSERT_ID()", item.id, subItem.template, subItem.template_id, string.Format("#{0}:{1}",subItem.template_id,subItem.template));
builder2.AppendFormat(" VALUES({0},'{1}',{2},'{3}');SELECT LAST_INSERT_ID()", item.id, subItem.template, subItem.template_id, string.Format("#{0}:{1}", subItem.template_id, subItem.template));
var res2 = DBHelper.MySqlHelper.ExecuteScalar(DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, builder2.ToString(), null);
}
}
}
catch (Exception ex)
{
......@@ -70,7 +72,7 @@ namespace Test.Helper
}
}
}
/// <summary>
/// 获取页面数据
/// </summary>
......@@ -108,7 +110,7 @@ namespace Test.Helper
return list;
}
/// <summary>
/// 获取模板
/// </summary>
......@@ -123,12 +125,12 @@ namespace Test.Helper
Console.WriteLine(index + "/" + list.Count + item.name + "分类Start");
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO rb_miniprogram_template(TenantId,MallBaseId,TemplateName,TemplateData,CreateDate,CreateBy,Status)");
builder.AppendFormat(" VALUES(1,1,'{0}',@data,'{1}',1,0);SELECT LAST_INSERT_ID()", item.name, DateTime.Now);
builder.AppendFormat(" VALUES(1,1,'{0}',@data,'{1}',1,0);SELECT LAST_INSERT_ID()", item.name, DateTime.Now);
List<MySqlParameter> paramsList = new List<MySqlParameter>();
paramsList.Add(new MySqlParameter()
{
ParameterName= "@data",
Value= item.data.Replace(@"\", "")
ParameterName = "@data",
Value = item.data.Replace(@"\", "")
});
try
{
......@@ -199,7 +201,7 @@ namespace Test.Helper
var index = 1;
foreach (var item in CategoryList)
{
Console.WriteLine(index+"/"+ CategoryList.Count + item.name + "分类Start");
Console.WriteLine(index + "/" + CategoryList.Count + item.name + "分类Start");
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO rb_material_group(Name,Type,Sort,Recycled,Status,TenantId,MallBaseId,CreateDate,UpdateDate)");
builder.AppendFormat(" VALUES('{0}',{1},{2},1,0,1,1,'{3}','{4}');SELECT LAST_INSERT_ID()", item.name, item.type, item.is_recycle, DateTime.Now, DateTime.Now);
......@@ -241,7 +243,7 @@ namespace Test.Helper
var existsSubObj = DBHelper.MySqlHelper.ExecuteScalar(DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, existsSubSql, null);
if (existsSubObj != null && Convert.ToInt32(existsSubObj) > 0)
{
// Int32.TryParse(existsSubObj.ToString(), out parentId);
// Int32.TryParse(existsSubObj.ToString(), out parentId);
}
else
{
......@@ -271,6 +273,56 @@ namespace Test.Helper
}
}
/// <summary>
/// 获取分类
/// </summary>
/// <param name="cookie"></param>
static void GetDestinationList(string cookie)
{
var query = GetDestinationModel(cookie);
try
{
if (query != null && query.data.district.Any())
{
var index = 1;
foreach (var item in query.data.district)
{
Console.WriteLine(index + "/" + query.data.district.Count + item.name + "地区Start");
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" INSERT INTO rb_destination(ID,Name,ParentID,CodeLevel,Area)");
builder.AppendFormat(" VALUES({0},'{1}',{2},'{3}','{4}');", item.id, item.name, item.parent_id, 2, "1");
foreach (var twoItem in item.list)
{
builder.AppendFormat(" INSERT INTO rb_destination(ID,Name,ParentID,CodeLevel,Area)");
builder.AppendFormat(" VALUES({0},'{1}',{2},'{3}','{4}');", twoItem.id, twoItem.name, twoItem.parent_id, 3, "1");
foreach (var threeItem in twoItem.list)
{
builder.AppendFormat(" INSERT INTO rb_destination(ID,Name,ParentID,CodeLevel,Area)");
builder.AppendFormat(" VALUES({0},'{1}',{2},'{3}','{4}');", threeItem.id, threeItem.name, threeItem.parent_id, 4, "1");
}
}
var res = DBHelper.MySqlHelper.ExecuteScalar(DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, builder.ToString(), null);
Thread.Sleep(1000 * 5);
}
}
}
catch (Exception)
{
}
}
/// <summary>
/// 生成图片
/// </summary>
......@@ -326,7 +378,7 @@ namespace Test.Helper
List<CategoryImg> list = new List<CategoryImg>();
string imgApi = "https://wx.weibaoge.cn/web/index.php?r=common%2Fattachment%2Flist&page={0}&attachment_group_id={1}&type=image&is_recycle=0&keyword=";
string newImaApi = string.Format(imgApi, pageIndex, Id);
// cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={'keyword':'','status':'-1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null}; HJ_SESSION_ID=kmmormovvm2u9qh5drkgsbj1ta; _csrf=7a980bb65eabe0ac3d77199092030044b17ae9779de00eaed628c8095ab2fe0ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22rsnZWVWkZkpfvVhLBXu8sGG3px0Dgcsx%22%3B%7D";
// cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={'keyword':'','status':'-1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null}; HJ_SESSION_ID=kmmormovvm2u9qh5drkgsbj1ta; _csrf=7a980bb65eabe0ac3d77199092030044b17ae9779de00eaed628c8095ab2fe0ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22rsnZWVWkZkpfvVhLBXu8sGG3px0Dgcsx%22%3B%7D";
string jsonData = HttpGet(newImaApi, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
{
......@@ -359,6 +411,30 @@ namespace Test.Helper
return list;
}
/// <summary>
/// 获取商品分类
/// </summary>
/// <param name="cookie"></param>
/// <returns></returns>
static ImportData GetDestinationModel(string cookie)
{
ImportData model = new ImportData();
string ApiUrl = "http://wx.weibaoge.cn/web/index.php?r=district%2Findex&level=3";
string jsonData = HttpGet(ApiUrl, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
{
JObject obj = JObject.Parse(jsonData);
model = Newtonsoft.Json.JsonConvert.DeserializeObject<ImportData>(obj.ToString());
}
return model;
}
/// <summary>
/// Get获取数据
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.Model
{
class Destination
{
}
public class ImportData
{
public int code { get; set; }
public string msg { get; set; }
public alldistrict data { get; set; }
}
public class alldistrict
{
public List<district> district { get; set; }
}
public class district
{
public int id { get; set; }
public string name { get; set; }
public int parent_id { get; set; }
public string level { get; set; }
public List<district> list { get; set; }
}
}
......@@ -54,6 +54,7 @@
<Compile Include="DBHelper\MySqlHelper.cs" />
<Compile Include="Helper\MallHelper.cs" />
<Compile Include="Model\Category.cs" />
<Compile Include="Model\Destination.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
......
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