From edc7913637eb38b22b800581d4aaba6ab543dfa1 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 19 Jun 2026 16:56:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=AE=8C=E6=88=90=20=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=A7=8B=2010%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactoryExportForms/FactoryExportForm.cs | 2 +- 29WxOrder/MainForm.cs | 130 +++++----- .../OrderForms/AfterSaleOrderListForm.cs | 12 +- .../OrderForms/AfterSaleReturnRefundForm.cs | 6 +- 29WxOrder/OrderForms/BuyOrderForms.cs | 2 +- 29WxOrder/OrderForms/BuyOrderListForm.cs | 14 +- 29WxOrder/OrderForms/OrderEdit.cs | 2 +- 29WxOrder/OrderForms/RemarkEditForm.cs | 2 +- 29WxOrder/OrderForms/SendOrderListForms.cs | 4 +- 29WxOrder/OrderForms/SuccessOrderListForm.cs | 6 +- 29WxOrderWpf/29WxOrderWpf.csproj | 43 +++- 29WxOrderWpf/App.xaml | 4 +- 29WxOrderWpf/App.xaml.cs | 116 ++++++++- 29WxOrderWpf/BaseWindows/BaseWindow.cs | 39 +++ .../Converters/TextToVisibilityConverter.cs | 36 +++ .../Ctrls/OrderCtrls/OrderListCtrl.xaml | 82 +++++++ .../Ctrls/OrderCtrls/OrderListCtrl.xaml.cs | 174 +++++++++++++ .../Ctrls/OrderCtrls/OrderListRowCtrl.xaml | 40 +++ .../Ctrls/OrderCtrls/OrderListRowCtrl.xaml.cs | 41 ++++ .../OrderCtrls/OrderListRowHeaderCtrl.xaml | 29 +++ .../OrderCtrls/OrderListRowHeaderCtrl.xaml.cs | 41 ++++ .../Ctrls/ShopCtrls/ShopDataGridCtrl.xaml | 73 ++++++ .../Ctrls/ShopCtrls/ShopDataGridCtrl.xaml.cs | 28 +++ .../Ctrls/ShopCtrls/ShopListCtrl.xaml | 145 +++++++++++ .../Ctrls/ShopCtrls/ShopListCtrl.xaml.cs | 191 +++++++++++++++ .../Ctrls/ShopCtrls/ShopListRowCtrl.xaml | 12 + .../Ctrls/ShopCtrls/ShopListRowCtrl.xaml.cs | 28 +++ .../Ctrls/ShopCtrls/ShopListViewModel.cs | 12 + 29WxOrderWpf/LoginWindows/LoginWindow.xaml | 11 +- 29WxOrderWpf/LoginWindows/LoginWindow.xaml.cs | 23 +- 29WxOrderWpf/MainWindow.xaml | 30 ++- 29WxOrderWpf/MainWindow.xaml.cs | 92 ++++++- 29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml | 158 ------------ 29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml.cs | 67 ----- 29WxOrderWpf/Styles/BaseButtonStyle.xaml | 70 +++++- 29WxOrderWpf/Styles/BaseDataGridStyle.xaml | 23 ++ 29WxOrderWpf/Styles/BaseTextBoxStyle.xaml | 23 ++ 29WxOrderWpf/Styles/BaseWindowStyle.xaml | 4 +- .../Styles/StaticColorBrushDictionary.xaml | 13 +- 29WxOrderWpf/Utils/UiCtrlUtils.cs | 70 ++++++ 29WxOrderWpf/packages.config | 4 + AllBase/29WxOrderAllBase.csproj | 3 +- AllBase/BaseClass.cs | 9 +- AllBase/BaseRegex.cs | 17 ++ AllBase/DouYinModel/Result/ShopLoginInfo.cs | 35 ++- AllBase/Helper/GlobalConfig.cs | 3 +- .../MvvmBaseClasses/PropertyNotifyObject.cs | 117 +++++++++ AllBase/Model/oms_wei_order_info.cs | 229 +++++++++++++++++- Work/29WxOrderWork.csproj | 1 + Work/BLL/ShopBLL.cs | 59 +++++ Work/Initialization.cs | 20 +- Work/UserLogin.cs | 2 +- 52 files changed, 2032 insertions(+), 365 deletions(-) create mode 100644 29WxOrderWpf/Converters/TextToVisibilityConverter.cs create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/ShopCtrls/ShopListViewModel.cs delete mode 100644 29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml delete mode 100644 29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml.cs create mode 100644 29WxOrderWpf/Styles/BaseDataGridStyle.xaml create mode 100644 29WxOrderWpf/Utils/UiCtrlUtils.cs create mode 100644 29WxOrderWpf/packages.config create mode 100644 AllBase/Model/MvvmBaseClasses/PropertyNotifyObject.cs create mode 100644 Work/BLL/ShopBLL.cs diff --git a/29WxOrder/FactoryExportForms/FactoryExportForm.cs b/29WxOrder/FactoryExportForms/FactoryExportForm.cs index 2746cf9..481ef7a 100644 --- a/29WxOrder/FactoryExportForms/FactoryExportForm.cs +++ b/29WxOrder/FactoryExportForms/FactoryExportForm.cs @@ -215,7 +215,7 @@ namespace _29WxOrder.FactoryExportForms public void UpdateOrderStatusAndEncrypt(string orderId) { DouYinOrderModel douYinOrderModel = this.lstDouYinOrder.Find(x => x.order_id == orderId); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (douYinOrderModel != null && shop != null) { DouyinApi dyapi = new DouyinApi(shop); diff --git a/29WxOrder/MainForm.cs b/29WxOrder/MainForm.cs index 47b8268..70701ea 100644 --- a/29WxOrder/MainForm.cs +++ b/29WxOrder/MainForm.cs @@ -41,6 +41,7 @@ using Work.Api; using Work.BaseForms; using Work.BuyUsers; using _29WxOrder.MyControl; +using Work.BLL; namespace _29WxOrder { @@ -352,7 +353,7 @@ namespace _29WxOrder { Task.Run(() => { - GetServerDouShop(); + GetServerShop(); }); } private void readBuyOrder(object sender, EventArgs e) @@ -1642,7 +1643,7 @@ namespace _29WxOrder DouOrderListInfo.Shop_order_listItem orderListItem = new DouOrderListInfo.Shop_order_listItem(); orderListItem.order_id = jOrderObj["shop_order_id"].ToString(); orderListItem.shop_id = shop.ShopId.ParseToInt(); - orderListItem.shop_name = shop.ShopName; + orderListItem.shop_name = shop.ShopAccount; orderListItem.post_tel = jOrderObj["receiver_info"]["post_tel"].ToString(); orderListItem.productName = jOrderObj["product_item"][0]["product_name"].ToString(); orderListItem.post_receiver = jOrderObj["receiver_info"]["post_receiver"].ToString(); @@ -1816,7 +1817,7 @@ namespace _29WxOrder foreach (DouYinOrderModel getOrderShop in onelist) { if (BaseClass.is_read_commission == 1) { break; } - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == getOrderShop.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == getOrderShop.shop_id.ToString()); if (shop != null && !string.IsNullOrEmpty(shop.Cookies)) { var td = CEFBrowser.DeleteCookieAsync(cefJuLiangWebBrowser.RequestContext.GetCookieManager(null)); @@ -2211,7 +2212,7 @@ namespace _29WxOrder DouyinApi apix = new DouyinApi(shop); apix.JsonData = dic; BaseClass.ShopId = shop.ShopId; - BaseClass.ShopName = shop.ShopName; + BaseClass.ShopName = shop.ShopAccount; string html = apix.GetOrderList(); for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++) @@ -2413,7 +2414,7 @@ namespace _29WxOrder #region 店铺 bool readshop = false; - public List GetServerDouShop() + public List GetServerShop() { List list = new List(); if (readshop == false) @@ -2431,64 +2432,68 @@ namespace _29WxOrder while (true) { page++; - var url = BaseClass.Build29WxObjString("shop&act=get_shop_list"); + //var url = BaseClass.BuildObjString("shop&act=get_shop_list"); + var url = BaseClass.Build29WxObjString("shop/get_shop_list"); var data = UserLogin.GetSignaturex() + "&page=" + page; var html = GetHtml.PostUtf8(url, data); - while (string.IsNullOrEmpty(html)) - { - Thread.Sleep(1000); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) html = GetHtml.PostUtf8(url, data); - } - if (string.IsNullOrEmpty(html) || !html.Contains("shop_name") || !html.Contains("shop_id") || !html.Contains("name") || !html.Contains("password")) + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) + || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) { break; } - var jArr = JObject.Parse(html)["data"]["list"]; + var jArr = JObject.Parse(html)["data"]; if (jArr.Count() == 0) break; foreach (JObject jObj in jArr) { - string shopStr = jObj.ToString(); - ShopLoginInfo shop = new ShopLoginInfo(); - shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); - if (shop.DbId == null) - continue; - shop.UserName = BaseRegex.GetStringJson(ref shopStr, "name"); - shop.ShopName = BaseRegex.GetStringJson(ref shopStr, "shop_name"); - shop.ApiAuthStatus = "读取中..."; - shop.LoginStatus = "读取中..."; - shop.Password = BaseRegex.GetStringJson(ref shopStr, "password"); - shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); + //string shopStr = jObj.ToString(); + //ShopLoginInfo shop = new ShopLoginInfo(); + //shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); + //if (shop.DbId == null) + // continue; + //shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); + //shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_name"); + //shop.ApiAuthStatus = "读取中..."; + //shop.LoginStatus = "读取中..."; + //shop.Password = BaseRegex.GetStringJson(ref shopStr, "password"); + //shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - url = BaseClass.Build29WxObjString("shop&act=get_shop_token"); - data = UserLogin.GetSignaturex() + "&shop_id=" + shop.ShopId; + //url = BaseClass.Build29WxObjString("shop&act=get_shop_token"); + //data = UserLogin.GetSignaturex() + "&shop_id=" + shop.ShopId; - string htmltoken = GetHtml.PostUtf8(url, data, "", 5); - for (int i = 0; i < 10 && (string.IsNullOrEmpty(htmltoken) || htmltoken.Replace(" ", "").Contains("\"code\":400")); i++) - { - Thread.Sleep(100); - htmltoken = GetHtml.PostUtf8(url, data, "", 5); - } - var jArrs = JObject.Parse(htmltoken)["data"]; - foreach (JObject jObjs in jArrs) - { - string tokens = jObjs.ToString(); - string token = BaseRegex.GetStringJson(ref tokens, "access_token"); - string app_key = BaseRegex.GetStringJson(ref tokens, "app_key"); - string expires_in = BaseRegex.GetStringJson(ref tokens, "expires_in"); - if (app_key == "7016502755254683171") - { - shop.AccessToken = token; - shop.TokenExpiresTime = Convert.ToDateTime(expires_in); - } - } + //string htmltoken = GetHtml.PostUtf8(url, data, "", 5); + //for (int i = 0; i < 10 && (string.IsNullOrEmpty(htmltoken) || htmltoken.Replace(" ", "").Contains("\"code\":400")); i++) + //{ + // Thread.Sleep(100); + // htmltoken = GetHtml.PostUtf8(url, data, "", 5); + //} + //var jArrs = JObject.Parse(htmltoken)["data"]; + //foreach (JObject jObjs in jArrs) + //{ + // string tokens = jObjs.ToString(); + // string token = BaseRegex.GetStringJson(ref tokens, "access_token"); + // string app_key = BaseRegex.GetStringJson(ref tokens, "app_key"); + // string expires_in = BaseRegex.GetStringJson(ref tokens, "expires_in"); + // if (app_key == "7016502755254683171") + // { + // shop.AccessToken = token; + // shop.TokenExpiresTime = Convert.ToDateTime(expires_in); + // } + //} - shop.Group = BaseRegex.GetStringJson(ref shopStr, "cat_name"); - shop.BuyAccount = BaseRegex.GetStringJson(ref shopStr, "buy_user_name"); - shop.UploadAccount = BaseRegex.GetStringJson(ref shopStr, "upload_user_name"); - if (list.Any(l => l.UserName == shop.UserName) || list.Any(l => l.ShopName == shop.ShopName)) + //shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "cat_name"); + //shop.BuyAccount = BaseRegex.GetStringJson(ref shopStr, "buy_user_name"); + //shop.UploadAccount = BaseRegex.GetStringJson(ref shopStr, "upload_user_name"); + + var shop = ShopBLL.DeserializationShop(jObj); + + if (list.Any(l => l.ShopId == shop.ShopId)) continue; list.Add(shop); @@ -2509,7 +2514,7 @@ namespace _29WxOrder string shopNames = ""; foreach (var shop in list) { - shopNames += shop.ShopName + ","; + shopNames += shop.ShopAccount + ","; } var cookies = GetServerShopCookies(shopNames); @@ -2520,9 +2525,9 @@ namespace _29WxOrder { for (int j = 0; data != null && j < data.Count(); j++) { - if (data[j][shop.ShopName] != null) + if (data[j][shop.ShopAccount] != null) { - shop.Cookies = data[j][shop.ShopName].ToString().Replace("&", "&").Replace("%", "%").Replace("+", "+"); + shop.Cookies = data[j][shop.ShopAccount].ToString().Replace("&", "&").Replace("%", "%").Replace("+", "+"); break; } } @@ -2581,7 +2586,10 @@ namespace _29WxOrder } #endregion } - GlobalConfig.ShopLoginList = list; + foreach (var shop in list) + { + GlobalConfig.ShopLoginList.Add(shop); + } CheckShopLogin(list); readshop = false; @@ -2597,11 +2605,11 @@ namespace _29WxOrder { var row = this.dgvShop.Rows.Cast().FirstOrDefault(r => r.Cells["colShopId"].Value?.ToString() == shop.ShopId); if (row == null) - dgvShop.Rows.Add(true, shop.ShopId, shop.UserName, shop.ShopName, shop.ApiAuthStatus, shop.LoginStatus); + dgvShop.Rows.Add(true, shop.ShopId, shop.LoginName, shop.ShopAccount, shop.ApiAuthStatus, shop.LoginStatus); else { - row.Cells["colShopAccount"].Value = shop.UserName; - row.Cells["colShopName"].Value = shop.ShopName; + row.Cells["colShopAccount"].Value = shop.LoginName; + row.Cells["colShopName"].Value = shop.ShopAccount; row.Cells["colAuthStatus"].Value = shop.ApiAuthStatus; row.Cells["colLoginStatus"].Value = shop.LoginStatus; } @@ -2636,7 +2644,7 @@ namespace _29WxOrder var data = UserLogin.GetSignaturex() + "×tamp=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "&shop_id=" + doushop.ShopId; var result = GetHtml.PostUtf8(url, data); - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopName == doushop.ShopName); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopAccount == doushop.ShopAccount); if (shop != null) { var loginResult = GetShopStatus(shop); @@ -2654,7 +2662,7 @@ namespace _29WxOrder shop.ExpiresTime = Convert.ToDateTime(expires_in); } if (!string.IsNullOrEmpty(shopToken)) shop.ShopToken = shopToken; - if (!string.IsNullOrEmpty(shopName)) shop.ShopName = shopName; + if (!string.IsNullOrEmpty(shopName)) shop.ShopAccount = shopName; if (!string.IsNullOrEmpty(mobile)) shop.Mobile = mobile; } else if (loginResult.Contains("未登录")) @@ -3055,7 +3063,7 @@ namespace _29WxOrder /// 店铺ID public void chaqi(string orderid, int color, string shopid) { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); if (shop != null) { DouyinApi apix = new DouyinApi(shop); @@ -3238,7 +3246,7 @@ namespace _29WxOrder if (text == "店铺账号") { string shopname = dgvShop.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.UserName == shopname); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.LoginName == shopname); ShopBrower shopBrower = new ShopBrower(); shopBrower.TitleText = "店铺后台"; shopBrower.shop = shop; @@ -3738,7 +3746,7 @@ namespace _29WxOrder DouyinApi apix = new DouyinApi(shop); apix.JsonData = dic; BaseClass.ShopId = shop.ShopId; - BaseClass.ShopName = shop.ShopName; + BaseClass.ShopName = shop.ShopAccount; string html = apix.GetOrderList(); for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++) @@ -3823,7 +3831,7 @@ namespace _29WxOrder { foreach (ShopLoginInfo shop in GlobalConfig.ShopLoginList) { - if (shop.ShopName == "开箱小店") + if (shop.ShopAccount == "开箱小店") { DouyinApi api = new DouyinApi(shop); api.CreateOrder(); diff --git a/29WxOrder/OrderForms/AfterSaleOrderListForm.cs b/29WxOrder/OrderForms/AfterSaleOrderListForm.cs index 7dae59a..0f68a71 100644 --- a/29WxOrder/OrderForms/AfterSaleOrderListForm.cs +++ b/29WxOrder/OrderForms/AfterSaleOrderListForm.cs @@ -111,7 +111,7 @@ namespace _29WxOrder.OrderForms isread = true; foreach (var shop in GlobalConfig.ShopLoginList) { - Invoke(new Action(() => { this.mainform.lblMsg.Text = "正在读取售后:" + shop.ShopName; })); + Invoke(new Action(() => { this.mainform.lblMsg.Text = "正在读取售后:" + shop.ShopAccount; })); int size = 10; int page = 0; if (shop.ApiAuthStatus != "授权成功") @@ -490,7 +490,7 @@ namespace _29WxOrder.OrderForms { int rowId = DgvSaleOrderList.Rows.Add( /*"售后单号"*/ afterSale.aftersale_info.aftersale_id, - /*"店铺名称"*/ shop.ShopName, + /*"店铺名称"*/ shop.ShopAccount, /*"店铺编号"*/ shop.ShopId, /*"上家ID"*/ up_product_id, /*"本店ID"*/ item.product_id, @@ -605,7 +605,7 @@ namespace _29WxOrder.OrderForms string name = DgvSaleOrderList.Columns[e.ColumnIndex].HeaderText; if (name == "售后订单编号") { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); ShopBrower shopBrower = new ShopBrower(); shopBrower.TitleText = "店铺后台-售后"; shopBrower.shop = shop; @@ -615,7 +615,7 @@ namespace _29WxOrder.OrderForms } else if (name == "订单号") { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); if (shop != null) { ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower(); @@ -753,7 +753,7 @@ namespace _29WxOrder.OrderForms { IEnumerable enumerableList = this.DgvSaleOrderList.Rows.Cast(); List list = (from item in enumerableList where item.Cells["col_order_id"].Value.ToString() == orderid select item).ToList(); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString()); if (shop != null) { DouyinApi dyapi = new DouyinApi(shop); @@ -898,7 +898,7 @@ namespace _29WxOrder.OrderForms } var shopid = DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["shopId"].Value.ToString(); string aftersale_id = DgvSaleOrderList.Rows[mouseEvent.RowIndex].Cells["col_aftersale_id"].Value.ToString(); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); ShopBrower shopBrower = new ShopBrower(); shopBrower.TitleText = "店铺后台-售后"; shopBrower.shop = shop; diff --git a/29WxOrder/OrderForms/AfterSaleReturnRefundForm.cs b/29WxOrder/OrderForms/AfterSaleReturnRefundForm.cs index 1aefe1a..cc9b11e 100644 --- a/29WxOrder/OrderForms/AfterSaleReturnRefundForm.cs +++ b/29WxOrder/OrderForms/AfterSaleReturnRefundForm.cs @@ -82,7 +82,7 @@ namespace _29WxOrder.OrderForms { if (lstProvince.Count == 0) { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId); DouyinApi api = new DouyinApi(shop); var address = api.GetAddressProvince(); //{"code":10000,"data":[{"province":"安徽省","province_id":34},{"province":"澳门特别行政区","province_id":82},{"province":"北京市","province_id":11},{"province":"重庆市","province_id":50},{"province":"福建省","province_id":35},{"province":"广东省","province_id":44},{"province":"甘肃省","province_id":62},{"province":"广西壮族自治区","province_id":45},{"province":"贵州省","province_id":52},{"province":"河北省","province_id":13},{"province":"湖北省","province_id":42},{"province":"黑龙江省","province_id":23},{"province":"河南省","province_id":41},{"province":"湖南省","province_id":43},{"province":"海南省","province_id":46},{"province":"吉林省","province_id":22},{"province":"江苏省","province_id":32},{"province":"江西省","province_id":36},{"province":"辽宁省","province_id":21},{"province":"内蒙古自治区","province_id":15},{"province":"宁夏回族自治区","province_id":64},{"province":"青海省","province_id":63},{"province":"四川省","province_id":51},{"province":"山东省","province_id":37},{"province":"上海市","province_id":31},{"province":"山西省","province_id":14},{"province":"陕西省","province_id":61},{"province":"天津市","province_id":12},{"province":"台湾省","province_id":71},{"province":"香港特别行政区","province_id":81},{"province":"新疆维吾尔自治区","province_id":65},{"province":"西藏自治区","province_id":54},{"province":"云南省","province_id":53},{"province":"浙江省","province_id":33}],"err_no":0,"log_id":"20220715142943010208016085061166AE","message":"success","msg":"success","sub_code":"","sub_msg":""} @@ -265,7 +265,7 @@ namespace _29WxOrder.OrderForms var prov = lstArea.FirstOrDefault(a => a.code.ToString() == item.Name); if (prov == null) { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId); DouyinApi api = new DouyinApi(shop); var area = api.GetAreasByProvince(item.Name.ToString()); if (area.Contains("\"message\":\"success\"") || area.Contains("\"code\":10000")) @@ -346,7 +346,7 @@ namespace _29WxOrder.OrderForms private void btnAcceptReturnRefund_Click(object sender, EventArgs e) { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == _shopId); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == _shopId); var type = "101"; diff --git a/29WxOrder/OrderForms/BuyOrderForms.cs b/29WxOrder/OrderForms/BuyOrderForms.cs index cb68f8e..45c2d9e 100644 --- a/29WxOrder/OrderForms/BuyOrderForms.cs +++ b/29WxOrder/OrderForms/BuyOrderForms.cs @@ -254,7 +254,7 @@ namespace _29WxOrder.OrderForms #region 更新订单 - shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == orderDetail.shop_id.ToString()); + shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == orderDetail.shop_id.ToString()); this.buyOrderListForm.UpdateOrderStatusAndEncrypt(orderDetail); #endregion diff --git a/29WxOrder/OrderForms/BuyOrderListForm.cs b/29WxOrder/OrderForms/BuyOrderListForm.cs index 8f3c943..e202ea5 100644 --- a/29WxOrder/OrderForms/BuyOrderListForm.cs +++ b/29WxOrder/OrderForms/BuyOrderListForm.cs @@ -78,7 +78,7 @@ namespace _29WxOrder.OrderForms for (int i = 0; i < CollectionClass.orderDataList.Count; i++) { DouYinOrderModel dymodel = CollectionClass.orderDataList[i]; - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == dymodel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == dymodel.shop_id.ToString()); if (BaseClass.isUseSimGetRealAddress && (dymodel.name.Contains("解密失败") || dymodel.mobile.Contains("#1##") || dymodel.mobile == "******")) { isdecryption = false; @@ -1003,7 +1003,7 @@ namespace _29WxOrder.OrderForms /// public void UpdateOrderStatusAndEncrypt(DouYinOrderModel douYinOrderModel, UpdateOrderType updateOrderType = UpdateOrderType.UpdateAll) { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (douYinOrderModel != null) { if (shop != null) @@ -1342,9 +1342,9 @@ namespace _29WxOrder.OrderForms string districtId = ""; BuyOrderForms.MatchAddress(ref address, ref province, ref provinceId, ref city, ref cityId, ref district, ref districtId); - var shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); string data = @"{""order_id"":""" + orderid + - @""",""shop_name"":""" + GetHtml.UrlEncodeUtf8(shop.ShopName) + + @""",""shop_name"":""" + GetHtml.UrlEncodeUtf8(shop.ShopAccount) + @""",""up_goods_id"":""" + upproductid.Replace("pdd-", "").Replace("pd-", "") + @""",""pay_name"":""" + GetHtml.UrlEncodeUtf8(orderDetail.name) + @""",""pay_phone"":""" + orderDetail.mobile + @@ -1404,7 +1404,7 @@ namespace _29WxOrder.OrderForms } else if (name == "订单号") { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); if (shop != null) { ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower(); @@ -1419,7 +1419,7 @@ namespace _29WxOrder.OrderForms string GetOrderStatusl(string orderid) { DouYinOrderModel douYinOrderModel = CollectionClass.orderDataList.Find(x => x.order_id == orderid); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (douYinOrderModel != null) { if (shop != null) @@ -1442,7 +1442,7 @@ namespace _29WxOrder.OrderForms var msg = BaseRegex.GetStringJson(ref htmljm, "sub_msg"); if (!string.IsNullOrEmpty(msg)) { - BaseMsgForm.ShowError(msg.Replace("access_token已过期", "店铺 " + shop.ShopName + " 授权已过期,请重新授权")); + BaseMsgForm.ShowError(msg.Replace("access_token已过期", "店铺 " + shop.ShopAccount + " 授权已过期,请重新授权")); } } } diff --git a/29WxOrder/OrderForms/OrderEdit.cs b/29WxOrder/OrderForms/OrderEdit.cs index 4ec5f45..4cba167 100644 --- a/29WxOrder/OrderForms/OrderEdit.cs +++ b/29WxOrder/OrderForms/OrderEdit.cs @@ -191,7 +191,7 @@ namespace _29WxOrder.OrderForms sb.Append("&remark=" + tbremark.Text); sb.Append("&is_update_order=0"); // 1修改状态0不修改状态 - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == orderDetail.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == orderDetail.shop_id.ToString()); if (shop != null) { orderDetail.remark = tbremark.Text.ToString(); diff --git a/29WxOrder/OrderForms/RemarkEditForm.cs b/29WxOrder/OrderForms/RemarkEditForm.cs index 7c7634c..5e20c2a 100644 --- a/29WxOrder/OrderForms/RemarkEditForm.cs +++ b/29WxOrder/OrderForms/RemarkEditForm.cs @@ -45,7 +45,7 @@ namespace _29WxOrder.OrderForms return; } - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (shop != null) { douYinOrderModel.remark = tbremark.Text.ToString(); diff --git a/29WxOrder/OrderForms/SendOrderListForms.cs b/29WxOrder/OrderForms/SendOrderListForms.cs index 6741629..aa04b81 100644 --- a/29WxOrder/OrderForms/SendOrderListForms.cs +++ b/29WxOrder/OrderForms/SendOrderListForms.cs @@ -465,7 +465,7 @@ namespace _29WxOrder.OrderForms #region 更新订单 DouYinOrderModel douYinOrderModel = CollectionClass.orderSenderDataList.Find(x => x.order_id == orderid); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (douYinOrderModel != null) { if (shop != null) @@ -809,7 +809,7 @@ namespace _29WxOrder.OrderForms { string orderid = DgvSendOrderList.Rows[e.RowIndex].Cells["col_order_id"].Value.ToString(); string shopid = DgvSendOrderList.Rows[e.RowIndex].Cells["col_shop_id"].Value.ToString(); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); if (shop != null) { ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower(); diff --git a/29WxOrder/OrderForms/SuccessOrderListForm.cs b/29WxOrder/OrderForms/SuccessOrderListForm.cs index 6d42d84..dc5c53a 100644 --- a/29WxOrder/OrderForms/SuccessOrderListForm.cs +++ b/29WxOrder/OrderForms/SuccessOrderListForm.cs @@ -92,7 +92,7 @@ namespace _29WxOrder.OrderForms CollectionClass.successOrderDataList.Add(douYinOrderModel); orderList.Add(douYinOrderModel); - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == douYinOrderModel.shop_id.ToString()); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString()); if (shop != null && douYinOrderModel.order_status != 4) // 订单状态不为4的放入列表,后面按时间段查询更新订单。 { if (!shopList.Contains(shop)) @@ -302,7 +302,7 @@ namespace _29WxOrder.OrderForms DouyinApi apix = new DouyinApi(shop); apix.JsonData = dic; BaseClass.ShopId = shop.ShopId; - BaseClass.ShopName = shop.ShopName; + BaseClass.ShopName = shop.ShopAccount; string html = apix.GetOrderList(); for (int i = 0; i < 5 && html.Contains("系统繁忙,请稍后重试"); i++) @@ -653,7 +653,7 @@ namespace _29WxOrder.OrderForms } else if (name == "订单号") { - ShopLoginInfo shop = GlobalConfig.ShopLoginList.Find(x => x.ShopId == shopid); + ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == shopid); if (shop != null) { ShopForms.ShopBrower shopBrower = new ShopForms.ShopBrower(); diff --git a/29WxOrderWpf/29WxOrderWpf.csproj b/29WxOrderWpf/29WxOrderWpf.csproj index 1df519d..54e45be 100644 --- a/29WxOrderWpf/29WxOrderWpf.csproj +++ b/29WxOrderWpf/29WxOrderWpf.csproj @@ -56,6 +56,9 @@ ..\DllReference\NaiBa.Util.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + @@ -81,10 +84,23 @@ BaseMsgWindow.xaml + + + OrderListRowCtrl.xaml + + + OrderListRowHeaderCtrl.xaml + + + ShopDataGridCtrl.xaml + + + ShopListCtrl.xaml + LoginWindow.xaml - + OrderListCtrl.xaml @@ -94,10 +110,27 @@ UcWindowBoxes.xaml + Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -114,7 +147,7 @@ MainWindow.xaml Code - + Designer MSBuild:Compile @@ -126,6 +159,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -177,6 +214,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -237,5 +275,6 @@ + \ No newline at end of file diff --git a/29WxOrderWpf/App.xaml b/29WxOrderWpf/App.xaml index 669f635..aa1c3d6 100644 --- a/29WxOrderWpf/App.xaml +++ b/29WxOrderWpf/App.xaml @@ -7,14 +7,16 @@ + - + + diff --git a/29WxOrderWpf/App.xaml.cs b/29WxOrderWpf/App.xaml.cs index b56936c..bd2ea5c 100644 --- a/29WxOrderWpf/App.xaml.cs +++ b/29WxOrderWpf/App.xaml.cs @@ -1,11 +1,15 @@ -using System; +using _29WxOrderWpf.BaseWindows; +using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; +using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; +using Work; +using Work.BaseForms; namespace _29WxOrderWpf { @@ -23,15 +27,107 @@ namespace _29WxOrderWpf args = e.Args; } - #region 后台修改logo - //// 替换字典程序logo等 - //Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径 - //BitmapImage newBitmapImage = new BitmapImage(imageUri); - //// 获取资源字典 - //ResourceDictionary dict = Application.Current.Resources; - //// 添加或更新资源 - //dict["main29WeixinIcon"] = newBitmapImage; - #endregion + try + { + //设置应用程序处理异常方式:ThreadException处理 + //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + //处理UI线程异常 + //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); + Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; + //处理非UI线程异常 + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + + //StartUp.Init(); + new Initialization().Get(); + + #region 贴牌 + //本地缓存文件 + string IgPakFile = "locales/ig.pak";//贴牌客服端码 + string OenVersionFile = "locales/igv.pak";//贴牌资源配置版本 + string IaPakFile = "locales/ia.pak";//logo + string IbPakFile = "locales/ib.pak";//ico + string IcPakFile = "locales/ic.pak";//功能配置 + //OenMechanism(IgPakFile, OenVersionFile, IaPakFile, IbPakFile, IcPakFile); + + #region 后台修改logo 贴牌用 + //// 替换字典程序logo等 + //Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径 + //BitmapImage newBitmapImage = new BitmapImage(imageUri); + //// 获取资源字典 + //ResourceDictionary dict = Application.Current.Resources; + //// 添加或更新资源 + //dict["main29WeixinIcon"] = newBitmapImage; + #endregion + #endregion + } + catch (Exception ex) + { + string str = GetExceptionMsg(ex, string.Empty); + NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str); + //BaseMsgForm.ShowError(str, "系统错误"); + BaseMsgWindow.ShowError(null, str, "系统错误"); + } + } + + //static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) + //{ + // string str = GetExceptionMsg(e.Exception, e.ToString()); + // NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str); + // BaseMsgWindow.ShowError(null, str, "系统错误"); + //} + + private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + { + string str = GetExceptionMsg(e.Exception, e.ToString()); + NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str); + BaseMsgWindow.ShowError(null, str, "系统错误"); + } + + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString()); + NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str); + BaseMsgWindow.ShowError(null, str, "系统错误"); + } + + /// + /// 生成自定义异常消息 + /// + /// 异常对象 + /// 备用异常消息:当ex为null时有效 + /// 异常字符串文本 + static string GetExceptionMsg(Exception ex, string backStr) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("****************************异常文本****************************"); + sb.AppendLine("【出现时间】:" + DateTime.Now.ToString()); + if (ex != null) + { + sb.AppendLine("【异常类型】:" + ex.GetType().Name); + sb.AppendLine("【异常信息】:" + ex.Message); + sb.AppendLine("【堆栈调用】:" + ex.StackTrace); + } + else + { + sb.AppendLine("【未处理异常】:" + backStr); + } + sb.AppendLine("***************************************************************"); + NaiBa.Util.Helper.LogHelper.WriteWithTime("Error:" + sb); + BaseMsgWindow.ShowError(null, sb.ToString(), "系统错误"); + return sb.ToString(); + } + + /// + /// Oen贴牌机制 + /// + /// 贴牌商客户端码文件 + /// 贴牌配置版本号文件 + /// ico本地缓存文件 + /// logo本地缓存文件 + /// 贴牌配置本地缓存文件 + private static void OenMechanism(string IgPakFile, string OenVersionFile, string IaPakFile, string IbPakFile, string IcPakFile) + { + //todo: 贴牌相关处理逻辑 } } } diff --git a/29WxOrderWpf/BaseWindows/BaseWindow.cs b/29WxOrderWpf/BaseWindows/BaseWindow.cs index 7df74b3..d658f8c 100644 --- a/29WxOrderWpf/BaseWindows/BaseWindow.cs +++ b/29WxOrderWpf/BaseWindows/BaseWindow.cs @@ -21,6 +21,45 @@ namespace _29WxOrderWpf.BaseWindows WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 8, ResizeBorderThickness = new Thickness(4), }); this.DataContext = this; + this.Loaded += BaseWindow_Loaded; + + SizeChanged += BaseWindow_SizeChanged; + } + + private void BaseWindow_SizeChanged(object sender, SizeChangedEventArgs e) + { + if (WindowState == WindowState.Maximized) + { + //// 获取当前屏幕的工作区(排除任务栏) + //var workArea = SystemParameters.WorkArea; + + //// 设置窗口位置和大小 + //this.Left = workArea.Left; + //this.Top = workArea.Top; + //this.Width = workArea.Width; + //this.Height = workArea.Height; + this.Padding = new Thickness(6); + } + else + this.Padding = new Thickness(0); + } + + private void BaseWindow_Loaded(object sender, RoutedEventArgs e) + { + if (SystemParameters.PrimaryScreenWidth < this.Width + 0) + this.Width = SystemParameters.PrimaryScreenWidth - 0; + if (SystemParameters.WorkArea.Height < this.Height + 0) + this.Height = SystemParameters.WorkArea.Height - 0; + + this.MaxHeight = SystemParameters.WorkArea.Height + 14; + //this.MaxWidth = SystemParameters.WorkArea.Width + 13; + + double screenWidth = SystemParameters.PrimaryScreenWidth; + double screenHeight = SystemParameters.WorkArea.Height; + double windowWidth = this.ActualWidth; + double windowHeight = this.ActualHeight; + this.Left = (screenWidth / 2) - (windowWidth / 2); + this.Top = (screenHeight / 2) - (windowHeight / 2); } } } diff --git a/29WxOrderWpf/Converters/TextToVisibilityConverter.cs b/29WxOrderWpf/Converters/TextToVisibilityConverter.cs new file mode 100644 index 0000000..7e46419 --- /dev/null +++ b/29WxOrderWpf/Converters/TextToVisibilityConverter.cs @@ -0,0 +1,36 @@ +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace _29WxOrderWpf.Converters +{ + public class HasTextToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return !value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); // 单向绑定可不实现 + } + } + + public class NotHasTextToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); // 单向绑定可不实现 + } + } +} diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml new file mode 100644 index 0000000..434f0d3 --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs new file mode 100644 index 0000000..b2cc5d6 --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml.cs @@ -0,0 +1,174 @@ +using AllBase; +using AllBase.Extension; +using AllBase.Helper; +using AllBase.Model; +using AllBase.Model.Result; +using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using Work; +using Work.BLL; + +namespace _29WxOrderWpf.Ctrls.OrderCtrls +{ + /// + /// OrderListCtrl.xaml 的交互逻辑 + /// + public partial class OrderListCtrl : UserControl + { + public ObservableCollection lstOrder { get; set; } = new ObservableCollection(); + public List lstOrder1 { get; set; } = new List(); + + + public OrderListCtrl() + { + InitializeComponent(); + DataContext = this; + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项 + //_myDataCollection.Add(newItem); // 添加到集合中 + //dataGrid.Items.Refresh();. + //dgOrder.Items.Add(1111111); + + //dgOrder.ItemsSource = lstOrder; + + //lbxOrder.ItemsSource = lstOrder; + Task.Run(() => + { + while (!MainWindow.Instance.hasReadShop) + { + Thread.Sleep(100); + } + + GetOrder(); + //GetOrderTest(); + }); + } + + void GetOrderTest() + { + for (int i = 0; i < 10000; i++) + { + //lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" }); + lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" }); + } + lstOrder.SortDesc(o => o.order_id.ParseToLong()); + } + + void GetOrder() + { + Task.Run(() => + { + int page = 0; + int totalPage = 1; + while (true) + { + if (page >= totalPage) + { + break; + } + + page++; + var url = BaseClass.Build29WxObjString("order/get_order_list"); + var data = UserLogin.GetSignaturex() + "&page=" + page; + var shop_id = string.Join(",", GlobalConfig.ShopLoginList.Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty())); + data += "&erp_shop_id_in=" + shop_id; + Dispatcher.Invoke(new Action(() => + { + if (!string.IsNullOrEmpty(txtShopName.Text.Trim())) + { + var shopNames = txtShopName.Text.Trim().Split(';').Where(s => !s.IsNullOrEmpty()).ToList(); + shop_id = string.Join(",", GlobalConfig.ShopLoginList.Where(s => shopNames.Contains(s.ShopAccount)).Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty())); + } + })); + Thread.Sleep(200); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + break; + } + + var jArr = JObject.Parse(html)["data"]; + if (jArr.Count() == 0) + break; + + foreach (JObject jObj in jArr) + { + Dispatcher.Invoke(new Action(() => + { + var order = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(jObj)); + var orderExist = this.lstOrder.FirstOrDefault(o => o.order_id == order.order_id); + if (orderExist != null) + this.lstOrder.Remove(orderExist); + + var nextOrder = this.lstOrder.FirstOrDefault(o => o.create_time < order.create_time); + if (nextOrder != null) + { + lstOrder.Insert(lstOrder.IndexOf(nextOrder), order); + } + else + { + lstOrder.Add(order); + } + })); + } + } + }); + } + + + + private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var orderId = ((sender as Border)?.Tag).ParseToString(); + try + { + Clipboard.SetText(orderId); + } + catch (Exception ex) + { + } + } + + private void btnMultiShopChoice_Click(object sender, RoutedEventArgs e) + { + MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged; + MainWindow.Instance.shopListCtrl.Visibility = Visibility.Visible; + MainWindow.Instance.shopListCtrl.IsVisibleChanged += ShopListCtrl_IsVisibleChanged; + } + + private void ShopListCtrl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (!MainWindow.Instance.shopListCtrl.IsVisible && MainWindow.Instance.shopListCtrl.IsAcceptChoiceShop == true) + { + var list = MainWindow.Instance.shopListCtrl.lbxShop.ItemsSource as ObservableCollection; + if (list != null) + this.txtShopName.Text = string.Join(";", list.Where(s => s.IsSelect == true).Select(s => s.ShopAccount)); + + + } + MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged; + } + } +} diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml new file mode 100644 index 0000000..1bbe7b4 --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml.cs new file mode 100644 index 0000000..9608bfc --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowCtrl.xaml.cs @@ -0,0 +1,41 @@ +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.OrderCtrls +{ + /// + /// OrderListRowCtrl.xaml 的交互逻辑 + /// + public partial class OrderListRowCtrl : UserControl + { + public OrderListRowCtrl() + { + InitializeComponent(); + } + + private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var orderId = ((sender as Border)?.Tag).ParseToString(); + try + { + Clipboard.SetText(orderId); + } + catch (Exception ex) + { + } + } + } +} diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml new file mode 100644 index 0000000..021603c --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml.cs new file mode 100644 index 0000000..eeaf151 --- /dev/null +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowHeaderCtrl.xaml.cs @@ -0,0 +1,41 @@ +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.OrderCtrls +{ + /// + /// OrderListRowHeaderCtrl.xaml 的交互逻辑 + /// + public partial class OrderListRowHeaderCtrl : UserControl + { + public OrderListRowHeaderCtrl() + { + InitializeComponent(); + } + + private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var orderId = ((sender as Border)?.Tag).ParseToString(); + try + { + Clipboard.SetText(orderId); + } + catch (Exception ex) + { + } + } + } +} diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml b/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml new file mode 100644 index 0000000..1139bd2 --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml.cs b/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml.cs new file mode 100644 index 0000000..6aa1d3b --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopDataGridCtrl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.ShopCtrls +{ + /// + /// ShopDataGridCtrl.xaml 的交互逻辑 + /// + public partial class ShopDataGridCtrl : UserControl + { + public ShopDataGridCtrl() + { + InitializeComponent(); + } + } +} diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml new file mode 100644 index 0000000..7e28d08 --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml.cs b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml.cs new file mode 100644 index 0000000..58f5f33 --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListCtrl.xaml.cs @@ -0,0 +1,191 @@ +using _29WxOrderWpf.Utils; +using AllBase.Helper; +using AllBase.Model.Result; +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.ShopCtrls +{ + /// + /// ShopListCtrl.xaml 的交互逻辑 + /// + public partial class ShopListCtrl : UserControl + { + public bool? IsAcceptChoiceShop { get; set; } = false; + CheckBox chkSelectAll = null; + public ShopListCtrl() + { + InitializeComponent(); + DataContext = this; + } + + private void shopListCtrl_Loaded(object sender, RoutedEventArgs e) + { + this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList; + + Task.Run(() => { + while(MainWindow.Instance.hasReadShop == false) + { + Thread.Sleep(100); + } + + Dispatcher.Invoke(new Action(() => { + cmbGroup.Items.Clear(); + cmbGroup.Items.Add(""); + foreach (var group in GlobalConfig.ShopLoginList.Select(s => s.GroupName).Distinct()) + { + if (!string.IsNullOrEmpty(group)) + this.cmbGroup.Items.Add(group); + } + cmbNotes.Items.Clear(); + cmbNotes.Items.Add(""); + foreach (var notes in GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct()) + { + if (!string.IsNullOrEmpty(notes)) + this.cmbNotes.Items.Add(notes); + } + + })); + }); + + } + + private void dgShopHeader_ColumnDisplayIndexChanged(object sender, DataGridColumnEventArgs e) + { + } + + private void dgShopHeader_LayoutUpdated(object sender, EventArgs e) + { + foreach (var item in lbxShop.Items) + { + ListBoxItem container = (ListBoxItem)lbxShop.ItemContainerGenerator.ContainerFromIndex(lbxShop.Items.IndexOf(item)); + if (container != null) + { + // 找到grid控件并修改列大小 + Grid grid = UiCtrlUtils.FindVisualChild(container, "gridListItem"); + if (grid != null) + { + for(int i = 0; i< grid.ColumnDefinitions.Count; i++) + { + if (dgShopHeader.Columns.Count > i) + { + // 最后一列因滚动条变窄,已在表头补偿 + if (i == grid.ColumnDefinitions.Count - 1) + grid.ColumnDefinitions[i].Width = new GridLength(Math.Max(0, dgShopHeader.Columns[i].ActualWidth - 0)); + else + grid.ColumnDefinitions[i].Width = new GridLength(dgShopHeader.Columns[i].ActualWidth); + } + } + } + } + } + } + + private void ChkSelectAll_Checked(object sender, RoutedEventArgs e) + { + foreach (var shop in GlobalConfig.ShopLoginList.ToList()) + { + //shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool(); + shop.IsSelect = true; + } + } + + private void ChkSelectAll_Unchecked(object sender, RoutedEventArgs e) + { + foreach (var shop in GlobalConfig.ShopLoginList.ToList()) + { + //shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool(); + shop.IsSelect = false; + } + } + + private void ChkSelectAll_Loaded(object sender, RoutedEventArgs e) + { + chkSelectAll = sender as CheckBox; + } + + private void CheckBox_Click(object sender, RoutedEventArgs e) + { + chkSelectAll.Checked -= ChkSelectAll_Checked; + chkSelectAll.Unchecked -= ChkSelectAll_Unchecked; + if (GlobalConfig.ShopLoginList.All(s => s.IsSelect)) + chkSelectAll.IsChecked = true; + else if (GlobalConfig.ShopLoginList.All(s => !s.IsSelect)) + chkSelectAll.IsChecked = false; + else + chkSelectAll.IsChecked = null; + chkSelectAll.Checked += ChkSelectAll_Checked; + chkSelectAll.Unchecked += ChkSelectAll_Unchecked; + } + + private void cmbNotes_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + } + + private void cmbGroup_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + } + + private void btnSearch_Click(object sender, RoutedEventArgs e) + { + ObservableCollection shops = new ObservableCollection(); + foreach (var shop in GlobalConfig.ShopLoginList) + { + if (!shop.ShopAccount.ParseToString().Contains(txtShopName.Text)) + continue; + if (!shop.GroupName.ParseToString().Contains(cmbGroup.Text)) + continue; + if (!shop.Notes.ParseToString().Contains(cmbNotes.Text)) + continue; + + shops.Add(shop); + } + this.lbxShop.ItemsSource = shops; + } + + private void btnRestore_Click(object sender, RoutedEventArgs e) + { + txtShopName.Text = ""; + cmbNotes.Text = ""; + cmbGroup.Text = ""; + this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList; + } + + private void btnRefreshShop_Click(object sender, RoutedEventArgs e) + { + MainWindow.Instance.GetServerShop(); + } + + private void btnCancelSelectShop_Click(object sender, RoutedEventArgs e) + { + this.IsAcceptChoiceShop = false; + MainWindow.Instance.gridUser.Visibility = Visibility.Hidden; + } + + + private void btnApplySelectShop_Click(object sender, RoutedEventArgs e) + { + this.IsAcceptChoiceShop = true; + MainWindow.Instance.gridUser.Visibility = Visibility.Hidden; + } + } +} diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml new file mode 100644 index 0000000..c8c97ad --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml.cs b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml.cs new file mode 100644 index 0000000..e7a1866 --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListRowCtrl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.ShopCtrls +{ + /// + /// ShopListRowCtrl.xaml 的交互逻辑 + /// + public partial class ShopListRowCtrl : UserControl + { + public ShopListRowCtrl() + { + InitializeComponent(); + } + } +} diff --git a/29WxOrderWpf/Ctrls/ShopCtrls/ShopListViewModel.cs b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListViewModel.cs new file mode 100644 index 0000000..41b5b7e --- /dev/null +++ b/29WxOrderWpf/Ctrls/ShopCtrls/ShopListViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace _29WxOrderWpf.Ctrls.ShopCtrls +{ + internal class ShopListViewModel + { + } +} diff --git a/29WxOrderWpf/LoginWindows/LoginWindow.xaml b/29WxOrderWpf/LoginWindows/LoginWindow.xaml index 710deac..dbab790 100644 --- a/29WxOrderWpf/LoginWindows/LoginWindow.xaml +++ b/29WxOrderWpf/LoginWindows/LoginWindow.xaml @@ -12,7 +12,7 @@ - + @@ -26,6 +26,7 @@ + @@ -52,15 +53,19 @@ - + + + + - + diff --git a/29WxOrderWpf/LoginWindows/LoginWindow.xaml.cs b/29WxOrderWpf/LoginWindows/LoginWindow.xaml.cs index 875f0c4..6106c5a 100644 --- a/29WxOrderWpf/LoginWindows/LoginWindow.xaml.cs +++ b/29WxOrderWpf/LoginWindows/LoginWindow.xaml.cs @@ -32,7 +32,7 @@ namespace _29WxOrderWpf.LoginWindows { public static ConcurrentList UserParamList { get; set; } = new ConcurrentList(); - bool isLogin = false; + public bool IsLogin { get; set; } = false; string[] argsuser; @@ -43,6 +43,7 @@ namespace _29WxOrderWpf.LoginWindows if (!string.IsNullOrEmpty(BaseClass.ProgramName)) { lblAppName.Content = BaseClass.ProgramName; + MainWindow.Instance.lblAppName.Content = lblAppName.Content; } this.Title = "用户登录"; @@ -51,6 +52,10 @@ namespace _29WxOrderWpf.LoginWindows private void loginWindow_Loaded(object sender, RoutedEventArgs e) { +#if DEBUG + chkDebug.Visibility = Visibility.Visible; +#endif + GetUserList(); foreach (var user in UserParamList) { @@ -83,7 +88,7 @@ namespace _29WxOrderWpf.LoginWindows //else // e.Cancel = true; - if (!isLogin) + if (!IsLogin) { if (BaseMsgWindow.ShowConfirm(this, "是否关闭软件?\r\n必须登录账户才能使用,无账户请先注册一个。", "请先登录或者注册").DialogResult == true) Process.GetCurrentProcess().Kill(); @@ -136,7 +141,7 @@ namespace _29WxOrderWpf.LoginWindows }); SaveUserList(); } - this.isLogin = true; + this.IsLogin = true; this.Close(); } @@ -193,5 +198,17 @@ namespace _29WxOrderWpf.LoginWindows { BaseClass.Remember = chkRemember.IsChecked.ParseToBool(); } + + private void chkDebug_Checked(object sender, RoutedEventArgs e) + { + if (chkDebug.IsChecked == true) + { + BaseClass.LoginApiUrl = BaseClass.DebugUrl; + } + else + { + BaseClass.LoginApiUrl = BaseClass.ServerUrl; + } + } } } diff --git a/29WxOrderWpf/MainWindow.xaml b/29WxOrderWpf/MainWindow.xaml index a6e3e6f..631cc2e 100644 --- a/29WxOrderWpf/MainWindow.xaml +++ b/29WxOrderWpf/MainWindow.xaml @@ -4,18 +4,40 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:_29WxOrderWpf" - xmlns:orderctrls="clr-namespace:_29WxOrderWpf.OrderCtrls" + xmlns:orderctrls="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls" + xmlns:shopctrls="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls" xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls" mc:Ignorable="d" Style="{StaticResource BaseNoneBorderWindowStyle}" - Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded" Closing="BaseWindow_Closing"> + x:Name="mainWindow" Title="MainWindow" Height="900" Width="1600" Loaded="Window_Loaded" Closing="BaseWindow_Closing"> - + + + + + + + + + + + - + + + + + + + + + + diff --git a/29WxOrderWpf/MainWindow.xaml.cs b/29WxOrderWpf/MainWindow.xaml.cs index 5069c44..43c6449 100644 --- a/29WxOrderWpf/MainWindow.xaml.cs +++ b/29WxOrderWpf/MainWindow.xaml.cs @@ -1,10 +1,14 @@ using _29WxOrderWpf.BaseWindows; -using _29WxOrderWpf.OrderCtrls; +using _29WxOrderWpf.Ctrls.OrderCtrls; using AllBase; +using AllBase.DouYinModel.Result; using AllBase.Extension; +using AllBase.Helper; using AllBase.Model; +using AllBase.Model.Result; using NaiBa.Util; using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -27,7 +31,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Xml.Linq; using Work; +using Work.BLL; namespace _29WxOrderWpf { @@ -36,13 +42,15 @@ namespace _29WxOrderWpf /// public partial class MainWindow : BaseWindow { + public static MainWindow Instance { get; private set; } + public MainWindow() { InitializeComponent(); this.DataContext = this; + Instance = this; - this.Height = 800; - this.Width = 1600; + gridUser.Visibility = Visibility.Collapsed; } private void Window_Loaded(object sender, RoutedEventArgs e) @@ -54,6 +62,16 @@ namespace _29WxOrderWpf loginWindow.Owner = this; loginWindow.ShowDialog(); #endregion + + if (loginWindow.IsLogin) + { + //shopListCtrl.Visibility = Visibility.Visible; + orderListCtrl.Visibility = Visibility.Visible; + Task.Run(() => + { + GetServerShop(); + }); + } } #region 反抓包功能 @@ -175,5 +193,73 @@ namespace _29WxOrderWpf else e.Cancel = true; } + + public bool readShop { get; set; } = false; + public bool hasReadShop { get; set; } = false; + public void GetServerShop() + { + if (readShop == false) + { + List list = new List(); + Dispatcher.Invoke(new Action(() => + { + })); + readShop = true; + int page = 0; + while (true) + { + page++; + var url = BaseClass.Build29WxObjString("shop/get_shop_list"); + var data = UserLogin.GetSignaturex() + "&page=" + page; + data += "&is_get_erp_shop_id=true"; + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) + || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) + { + break; + } + + var jArr = JObject.Parse(html)["data"]; + if (jArr.Count() == 0) + break; + + foreach (JObject jObj in jArr) + { + var shop = ShopBLL.DeserializationShop(jObj); + + var shopExist = list.Where(l => l.ShopId == shop.ShopId).ToList(); + if (shopExist != null) + shopExist.Remove(shop); + + list.Add(shop); + if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire)) + { + Dispatcher.Invoke(new Action(() => + { + GlobalConfig.ShopLoginList.Add(shop); + })); + } + } + } + + Dispatcher.Invoke(new Action(() => + { + foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList()) + { + GlobalConfig.ShopLoginList.Remove(shop); + } + foreach (var shop in GlobalConfig.ShopLoginList.Where(s => s.is_point_shop_expire).ToList()) + { + GlobalConfig.ShopLoginList.Remove(shop); + } + })); + readShop = false; + hasReadShop = true; + } + } } } diff --git a/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml b/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml deleted file mode 100644 index da3b41b..0000000 --- a/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml.cs b/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml.cs deleted file mode 100644 index 58dad5e..0000000 --- a/29WxOrderWpf/OrderCtrls/OrderListCtrl.xaml.cs +++ /dev/null @@ -1,67 +0,0 @@ -using AllBase; -using AllBase.Extension; -using AllBase.Model; -using NaiBa.Util.Extension; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace _29WxOrderWpf.OrderCtrls -{ - /// - /// OrderListWindow.xaml 的交互逻辑 - /// - public partial class OrderListWindow : UserControl - { - public ObservableCollection lstOrder { get; set; } = new ObservableCollection(); - public List lstOrder1 { get; set; } = new List(); - - - public OrderListWindow() - { - InitializeComponent(); - } - - private void Window_Loaded(object sender, RoutedEventArgs e) - { - //MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项 - //_myDataCollection.Add(newItem); // 添加到集合中 - //dataGrid.Items.Refresh();. - //dgOrder.Items.Add(1111111); - - dgOrder.ItemsSource = lstOrder; - - lbxOrder.ItemsSource = lstOrder; - for (int i = 0; i < 10000; i++) - { - //lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" }); - lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" }); - } - lstOrder.SortDesc(o => o.order_id.ParseToLong()); - - } - - private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - var orderId = ((sender as Border)?.Tag).ParseToString(); - try - { - Clipboard.SetText(orderId); - } - catch (Exception ex) - { - } - } - } -} diff --git a/29WxOrderWpf/Styles/BaseButtonStyle.xaml b/29WxOrderWpf/Styles/BaseButtonStyle.xaml index d637e48..b397793 100644 --- a/29WxOrderWpf/Styles/BaseButtonStyle.xaml +++ b/29WxOrderWpf/Styles/BaseButtonStyle.xaml @@ -41,8 +41,8 @@ + BorderBrush="{DynamicResource mainColorDarkBrush}" CornerRadius="0" + BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"> + + \ No newline at end of file diff --git a/29WxOrderWpf/Styles/BaseDataGridStyle.xaml b/29WxOrderWpf/Styles/BaseDataGridStyle.xaml new file mode 100644 index 0000000..687c0d0 --- /dev/null +++ b/29WxOrderWpf/Styles/BaseDataGridStyle.xaml @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/29WxOrderWpf/Styles/BaseTextBoxStyle.xaml b/29WxOrderWpf/Styles/BaseTextBoxStyle.xaml index f3afa27..7b70d2b 100644 --- a/29WxOrderWpf/Styles/BaseTextBoxStyle.xaml +++ b/29WxOrderWpf/Styles/BaseTextBoxStyle.xaml @@ -22,6 +22,29 @@ + + \ No newline at end of file diff --git a/29WxOrderWpf/Styles/BaseWindowStyle.xaml b/29WxOrderWpf/Styles/BaseWindowStyle.xaml index 5c3701b..8024cbc 100644 --- a/29WxOrderWpf/Styles/BaseWindowStyle.xaml +++ b/29WxOrderWpf/Styles/BaseWindowStyle.xaml @@ -4,7 +4,7 @@ @@ -13,7 +13,7 @@ - + diff --git a/29WxOrderWpf/Styles/StaticColorBrushDictionary.xaml b/29WxOrderWpf/Styles/StaticColorBrushDictionary.xaml index 541fba4..cd118fa 100644 --- a/29WxOrderWpf/Styles/StaticColorBrushDictionary.xaml +++ b/29WxOrderWpf/Styles/StaticColorBrushDictionary.xaml @@ -4,8 +4,19 @@ - + + + + + + + + + + + + \ No newline at end of file diff --git a/29WxOrderWpf/Utils/UiCtrlUtils.cs b/29WxOrderWpf/Utils/UiCtrlUtils.cs new file mode 100644 index 0000000..30e24ed --- /dev/null +++ b/29WxOrderWpf/Utils/UiCtrlUtils.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace _29WxOrderWpf.Utils +{ + public class UiCtrlUtils + { + /// + /// 查找模板控件的子控件 + /// + /// + /// + /// + public static T FindVisualChild(DependencyObject obj) where T : DependencyObject + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + if (child != null && child is T) + { + return (T)child; + } + else + { + T childOfChild = FindVisualChild(child); + if (childOfChild != null) + { + return childOfChild; + } + } + } + return null; + } + + /// + /// 查找模板控件的子控件 + /// + /// + /// + /// + /// + public static T FindVisualChild(DependencyObject obj, string xName) where T : DependencyObject + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + string controlName = child?.GetValue(Control.NameProperty) as string; + if (controlName == xName) + { + return (T)child; + } + else + { + T childOfChild = FindVisualChild(child, xName); + if (childOfChild != null) + { + return childOfChild; + } + } + } + return null; + } + } +} diff --git a/29WxOrderWpf/packages.config b/29WxOrderWpf/packages.config new file mode 100644 index 0000000..a2bcb38 --- /dev/null +++ b/29WxOrderWpf/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/AllBase/29WxOrderAllBase.csproj b/AllBase/29WxOrderAllBase.csproj index 321187f..098f261 100644 --- a/AllBase/29WxOrderAllBase.csproj +++ b/AllBase/29WxOrderAllBase.csproj @@ -58,7 +58,7 @@ DEBUG;TRACE true full - x86 + AnyCPU false prompt MinimumRecommendedRules.ruleset @@ -138,6 +138,7 @@ + diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 0c04393..a7376d2 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -23,7 +23,8 @@ namespace AllBase public static int VersionCount = 100; - public static string ServerUrl = "http://1.13.195.131:9000"; + public static string ServerUrl { get; set; } = "http://1.13.195.131:9000"; + public static string DebugUrl { get; set; } = "http://localhost:9000"; /// @@ -42,11 +43,9 @@ namespace AllBase /// public static string routeInUse = "buy_order_api"; - public static string MyApiUrl = "https://new.qixiaoke.com"; - - public static string ApiUrl = "http://xiaohuomao.nai8.net";//"http://xiaohuomao.nai8.net";//"http://192.168.8.191"; //" "http://192.168.8.191" http://ddapi.nai8.net:29999"; - public static bool UserApi = true; + public static string ApiUrl { get; set; } = "http://xiaohuomao.nai8.net"; //"http://xiaohuomao.nai8.net";//"http://192.168.8.191"; //" "http://192.168.8.191" http://ddapi.nai8.net:29999"; + public static bool UserApi { get; set; } = true; public static string PddUid = ""; public static string TaoBaoUid = ""; public static string ALUid = ""; diff --git a/AllBase/BaseRegex.cs b/AllBase/BaseRegex.cs index 34edd4d..4d1a998 100644 --- a/AllBase/BaseRegex.cs +++ b/AllBase/BaseRegex.cs @@ -443,6 +443,7 @@ namespace AllBase return true; return false; } + /// /// 获取值 /// @@ -563,6 +564,22 @@ namespace AllBase return i; return 0; } + + /// + /// 获取值 + /// + /// + /// + /// + public static bool GetBoolJson(ref string html, string reg) + { + var temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*(true|false)"); + bool res; + if (bool.TryParse(temp, out res)) + return res; + return false; + } + /// /// 时间戳转字符串时间 /// diff --git a/AllBase/DouYinModel/Result/ShopLoginInfo.cs b/AllBase/DouYinModel/Result/ShopLoginInfo.cs index 4a5e4c4..3e21f3f 100644 --- a/AllBase/DouYinModel/Result/ShopLoginInfo.cs +++ b/AllBase/DouYinModel/Result/ShopLoginInfo.cs @@ -1,19 +1,40 @@ -using System; +using AllBase.Model.MvvmBaseClasses; +using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AllBase.Model.Result { - public class ShopLoginInfo + public class ShopLoginInfo : PropertyNotifyObject { + /// + /// 是否被选中 + /// + public bool IsSelect + { + get { return this.GetValue(x => x.IsSelect); } + set { this.SetValue(x => x.IsSelect, value); } + } + /// + /// 是否被过滤掉 + /// + public bool IsFilter + { + get { return this.GetValue(x => x.IsFilter); } + set { this.SetValue(x => x.IsFilter, value); } + } public string DbId { get; set; } - public string UserName { get; set; } + public string CompanyName { get; set; } + public string LoginName { get; set; } public string Password { get; set; } public string ShopId { get; set; } - public string ShopName { get; set; } + public string ShopAccount { get; set; } public string Mobile { get; set; } + public string ErpShopId { get; set; } + public string SubUserName { get; set; } public string ShopToken { get; set; } public string Signature { get; set; } public string TouTiaoId { get; set; } @@ -28,7 +49,8 @@ namespace AllBase.Model.Result /// 拍单(采购)用户账户 /// public string BuyAccount { get; set; } - public string Group { get; set; } + public string GroupName { get; set; } + public string Notes { get; set; } public string LastRefreshDate { get; set; } public string AccessToken { get; set; } @@ -37,5 +59,8 @@ namespace AllBase.Model.Result public DateTime AddTime { get; set; } public DateTime ExpiresTime { get; set; } public DateTime TokenExpiresTime { get; set; } + + public bool is_point_shop_expire { get; set; } + public int expire_time { get; set; } } } diff --git a/AllBase/Helper/GlobalConfig.cs b/AllBase/Helper/GlobalConfig.cs index fa4190a..591faa8 100644 --- a/AllBase/Helper/GlobalConfig.cs +++ b/AllBase/Helper/GlobalConfig.cs @@ -3,6 +3,7 @@ using AllBase.Model; using AllBase.Model.Result; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -14,7 +15,7 @@ namespace AllBase.Helper /// /// 店铺列表 /// - public static List ShopLoginList { get; set; } = new List(); + public static ObservableCollection ShopLoginList { get; set; } = new ObservableCollection(); public static SystemSettings SystemSettings { get; set; } diff --git a/AllBase/Model/MvvmBaseClasses/PropertyNotifyObject.cs b/AllBase/Model/MvvmBaseClasses/PropertyNotifyObject.cs new file mode 100644 index 0000000..2f40f14 --- /dev/null +++ b/AllBase/Model/MvvmBaseClasses/PropertyNotifyObject.cs @@ -0,0 +1,117 @@ +using NPOI.Util; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model.MvvmBaseClasses +{ + public class PropertyNotifyObject + : NotifyPropertyBase, IDisposable + { + public PropertyNotifyObject() + { + } + + Dictionary _ValueDictionary = new Dictionary(); + + #region 根据属性名得到属性值 + public T GetPropertyValue(string propertyName) + { + if (string.IsNullOrEmpty(propertyName)) + throw new ArgumentException("invalid property name: " + propertyName); + object _propertyValue; + if (!_ValueDictionary.TryGetValue(propertyName, out _propertyValue)) + { + _propertyValue = default(T); + _ValueDictionary.Add(propertyName, _propertyValue); + } + return (T)_propertyValue; + } + #endregion + + public void SetPropertyValue(string propertyName, T value) + { + if (!_ValueDictionary.ContainsKey(propertyName) || _ValueDictionary[propertyName] != (object)value) + { + _ValueDictionary[propertyName] = value; + OnPropertyChanged(propertyName); + } + } + + #region Dispose + public void Dispose() + { + DoDispose(); + } + ~PropertyNotifyObject() + { + DoDispose(); + } + void DoDispose() + { + if (_ValueDictionary != null) + _ValueDictionary.Clear(); + } + #endregion + } + + public static class PropertyNotifyObjectEx + { + public static U GetValue(this T t, Expression> exp) where T : PropertyNotifyObject + { + string _pN = MyCommMetoh.GetPropertyName(exp); + return t.GetPropertyValue(_pN); + } + + public static void SetValue(this T t, Expression> exp, U value) where T : PropertyNotifyObject + { + string _pN = MyCommMetoh.GetPropertyName(exp); + t.SetPropertyValue(_pN, value); + } + } + + public class NotifyPropertyBase : INotifyPropertyChanged + { + #region INotifyPropertyChanged + public void OnPropertyChanged(string propertyName) + { + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + public event PropertyChangedEventHandler PropertyChanged; + #endregion + } + + public static class NotifyPropertyBaseEx + { + public static void OnPropertyChanged(this T npb, Expression> exp) where T : NotifyPropertyBase, new() + { + string _PropertyName = MyCommMetoh.GetPropertyName(exp); + npb.OnPropertyChanged(_PropertyName); + } + } + + public class MyCommMetoh + { + //得到属性的名称 + public static string GetPropertyName(Expression> exp) + { + string _pName = ""; + if (exp.Body is MemberExpression) + { + _pName = (exp.Body as MemberExpression).Member.Name; + } + else if (exp.Body is UnaryExpression) + { + _pName = ((exp.Body as UnaryExpression).Operand as MemberExpression).Member.Name; + } + return _pName; + } + } +} diff --git a/AllBase/Model/oms_wei_order_info.cs b/AllBase/Model/oms_wei_order_info.cs index f5640a3..86427ce 100644 --- a/AllBase/Model/oms_wei_order_info.cs +++ b/AllBase/Model/oms_wei_order_info.cs @@ -11,7 +11,234 @@ namespace AllBase.Model { public bool is_select { get; set; } public long id { get; set; } - public string order_id { get; set; } + public long shop_id { get; set; } public string shop_name { get; set; } + /// + /// 商户ID + /// + public string merchant_id { get; set; } + public string order_id { get; set; } + /// + /// 买家身份标识 + /// + public string openid { get; set; } + public int create_time { get; set; } + public int update_time { get; set; } + public string unionid { get; set; } + /// + /// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消; + /// + public int? status { get; set; } + /// + /// 售后信息json + /// + public string aftersale_detail { get; set; } + /// + /// 支付信息 + /// + public string pay_info { get; set; } + /// + /// 额外信息 + /// + public string ext_info { get; set; } + /// + /// 商品总价 + /// + public int? product_price { get; set; } + /// + /// 订单金额,单位为分,order_price=original_order_price-discounted_price-deduction_price-change_down_price + /// + public int? order_price { get; set; } + /// + /// 采购价,单位为分 + /// + public int? purchase_price { get; set; } + /// + /// 采购时间 + /// + public int? purchase_time { get; set; } + /// + /// 运费,单位为分 + /// + public int? freight { get; set; } + /// + /// 平台服务费(微信小店:预计技术服务费),单位为分 + /// + public int? predict_commission_fee { get; set; } + /// + /// 达人佣金(微信小店:分账金额),单位为分 + /// + public int? commission_amount { get; set; } + /// + /// 优惠券优惠金额,单位为分 + /// + public int? discounted_price { get; set; } + /// + /// 采购状态,默认值为:0未采购,推送仓库时修改为1采购 + /// + public int? purchase_status { get; set; } + /// + /// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时) + /// + public int? delivery_deadline { get; set; } + /// + /// 发货时间 + /// + public int? delivery_time { get; set; } + /// + /// 收货人姓名 + /// + public string user_name { get; set; } + /// + /// 邮编 + /// + public string postal_code { get; set; } + public string province_name { get; set; } + public string city_name { get; set; } + /// + /// 区 + /// + public string county_name { get; set; } + /// + /// 详细地址 + /// + public string detail_info { get; set; } + public string tel_number { get; set; } + /// + /// 门牌号码 + /// + public string house_number { get; set; } + /// + /// 虚拟发货订单联系方式(deliver_method=1时返回) + /// + public string virtual_order_tel_number { get; set; } + /// + /// 额外的联系方式信息(虚拟号码相关) + /// + public string tel_number_ext_info { get; set; } + /// + /// 0:不使用虚拟号码,1:使用虚拟号码 + /// + public int? use_tel_number { get; set; } + /// + /// 标识当前店铺下一个唯一的用户收货地址 + /// + public string hash_code { get; set; } + /// + /// 发货物流信息JSON + /// + public string delivery_product_info { get; set; } + /// + /// 发货完成时间,秒级时间戳 + /// + public int? ship_done_time { get; set; } + /// + /// 电子面单代发时的订单密文 + /// + public string ewaybill_order_code { get; set; } + /// + /// 结算信息json + /// + public string settle_info { get; set; } + /// + /// 订单审核状态(0待审核1已审核) + /// + public int? audit_status { get; set; } + /// + /// 订单审核时间 + /// + public DateTime audit_time { get; set; } + /// + /// erp发货快递公司 + /// + public string erp_send_company { get; set; } + /// + /// erp发货快递单号 + /// + public string erp_send_code { get; set; } + /// + /// erp发货状态 + /// + public int? erp_send_status { get; set; } + /// + /// erp发货时间 + /// + public DateTime erp_send_time { get; set; } + /// + /// 旗帜颜色备注,1:灰旗,2:红旗,3:橙旗,4:绿旗,5:天蓝旗,6:紫旗 + /// + public int? colour_flag { get; set; } + /// + /// 旗帜备注时间 + /// + public DateTime colour_flag_update_time { get; set; } + /// + /// 供应商备注异常单 + /// + public string supplier_remark_exception { get; set; } + /// + /// 礼物单状态,默认值0:不存在礼物单,1:礼物单已发货,2:礼物单信息已更正 + /// + public int? gift_order_status { get; set; } + /// + /// 店铺备注:取微信ext_info.merchant_notes + /// + public string shop_remark { get; set; } + /// + /// 软件备注 + /// + public string soft_remark { get; set; } + /// + /// 外采金额(单位:分,整数存储) + /// + public int? out_amount { get; set; } + /// + /// 外采账户 + /// + public string out_account { get; set; } + /// + /// 外采订单号 + /// + public string out_order_no { get; set; } + /// + /// 外采快递公司 + /// + public string out_express_company { get; set; } + /// + /// 外采快递单号 + /// + public string out_express_no { get; set; } + /// + /// 外采是否发货(0 未发货,1 已发货) + /// + public int? out_shipped { get; set; } + /// + /// 判断是否优化过发货0 未优化, 1已优化 + /// + public int? is_shipment_optimized { get; set; } + /// + /// 判断是否优随机使用快递单号0 未使用, 1已使用 + /// + public int? is_express_no_used { get; set; } + /// + /// 外采订单售后状态 + /// + public string out_after_sale_status { get; set; } + /// + /// 是否支持运费险:0-不支持,1-支持 + /// + public int? has_freight_insurance { get; set; } + /// + /// 运费险金额(单位:元) + /// + public decimal? freight_insurance_amount { get; set; } + /// + /// 是否外采礼物单:0-否,1-是(外采订单) + /// + public int? external_gift { get; set; } + /// + /// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号 + /// + public decimal? transfer_warehouse_status { get; set; } } } diff --git a/Work/29WxOrderWork.csproj b/Work/29WxOrderWork.csproj index cf4bfa2..eb8f142 100644 --- a/Work/29WxOrderWork.csproj +++ b/Work/29WxOrderWork.csproj @@ -193,6 +193,7 @@ UcTreeView.cs + diff --git a/Work/BLL/ShopBLL.cs b/Work/BLL/ShopBLL.cs new file mode 100644 index 0000000..72fcb84 --- /dev/null +++ b/Work/BLL/ShopBLL.cs @@ -0,0 +1,59 @@ +using AllBase; +using AllBase.Model.Result; +using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Work.BLL +{ + public class ShopBLL + { + public static List DeserializationShop(string shopJson, string shopDataName = "data") + { + List list = new List(); + if (!shopJson.Contains(shopDataName)) + return list; + + var jArr = JObject.Parse(shopJson)[shopDataName]; + if (jArr.Count() == 0) + return list; + + foreach (JObject jObj in jArr) + { + var shop = DeserializationShop(jObj); + if (shop != null) + list.Add(shop); + } + return list; + } + + public static ShopLoginInfo DeserializationShop(JObject shopObj) + { + string shopStr = shopObj.ToString(); + ShopLoginInfo shop = new ShopLoginInfo(); + shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); + if (shop.DbId == null) + return null; + shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); + shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass"); + shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); + shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account"); + shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name"); + shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "group_name"); + shop.Cookies = shopObj["cookie"].ParseToString().Replace("&", "&").Replace("%", "%").Replace("+", "+").Replace(""", "\""); + shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); + shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); + shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); + shop.AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time") == null ? DateTime.MinValue : Convert.ToDateTime(BaseRegex.GetStringJson(ref shopStr, "add_time")); + shop.is_point_shop_expire = BaseRegex.GetBoolJson(ref shopStr, "is_point_shop_expire"); + shop.expire_time = BaseRegex.GetIntJson(ref shopStr, "expire_time"); + shop.ErpShopId = BaseRegex.GetStringJson(ref shopStr, "erp_shop_id"); + + return shop; + } + } +} diff --git a/Work/Initialization.cs b/Work/Initialization.cs index 8a84e7d..74327f6 100644 --- a/Work/Initialization.cs +++ b/Work/Initialization.cs @@ -34,14 +34,14 @@ namespace Work BaseClass.IsMainCompany = true; } BaseClass.IsBuyer = FileBase.Exists(Application.StartupPath + "\\buyer.ini"); - new Thread(Update).Start();//--------检查更新 - new Thread(GetAuthConfig).Start(); - new Thread(new JumpUpProductNew().Ini).Start(); - new Thread(CheckFiles).Start(); - new Thread(UpdateTime).Start(); - new Thread(GetMacCode).Start(); + //new Thread(Update).Start();//--------检查更新 + //new Thread(GetAuthConfig).Start(); + //new Thread(new JumpUpProductNew().Ini).Start(); + //new Thread(CheckFiles).Start(); + //new Thread(UpdateTime).Start(); + //new Thread(GetMacCode).Start(); - //new Thread(CheckUpdataFile).Start(); + //////new Thread(CheckUpdataFile).Start(); CheckHecker r = new CheckHecker(); new Thread(r.Check).Start();//防止破解 if (!File.Exists(ConfigFilePach)) @@ -64,7 +64,8 @@ namespace Work MessageBox.Show("配置文件异常,自动重置"); WriteFile(); } - GetPublicIp(); + // 获取本机IP + //GetPublicIp(); } @@ -140,7 +141,10 @@ namespace Work } } else//如果自动更新文件不存在,则强制更新主文件 + { GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath); + } + try { Process.Start(upfilepath); diff --git a/Work/UserLogin.cs b/Work/UserLogin.cs index f36c359..7f1157f 100644 --- a/Work/UserLogin.cs +++ b/Work/UserLogin.cs @@ -311,7 +311,7 @@ namespace Work return time1; } return GetSignature(isPhoneOrder) + "&version=" + BaseClass.VersionCount + "&uid=" + BaseClass.UserId + "&key=" + BaseClass.UserKey + - "&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) + + "&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) + "&user_name=" + BaseClass.UserName + "&sid=" + shopId + "&shop=" + GetHtml.UrlEncodeUtf8(shopName); }