1 bxx相关逻辑 2 店铺活动相关逻辑
This commit is contained in:
1 parent
fc017993df
commit
b44fa2a6c3
35 files changed
+460
-3861
No files matched your search
@@ -16,7 +16,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
public partial class AdminAccountForm : BaseForm
|
||||
{
|
||||
public static List<DouShopSubAccountInfo> AllUsers { get; set; } = new List<DouShopSubAccountInfo>();
|
||||
public static List<ShopSubAccountInfo> AllUsers { get; set; } = new List<ShopSubAccountInfo>();
|
||||
public MainForm Mf { get; set; } = null;
|
||||
public string Uid { get; set; } = "";
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
|
||||
{
|
||||
string oStr = JsonHelper.SerializeObject(obj);
|
||||
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
|
||||
ShopSubAccountInfo user = new ShopSubAccountInfo();
|
||||
user.id = BaseRegex.GetIntJson(ref oStr, "id");
|
||||
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
|
||||
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
@@ -204,7 +205,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
|
||||
pageCount = Math.Max(pageCount, 1);
|
||||
|
||||
return AdminShopListForm.DeserializationShop(html);
|
||||
return ShopBLL.DeserializationShop(html);
|
||||
}
|
||||
|
||||
private void btnEmpty_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
List<string> lstShopLoginName = new List<string>();
|
||||
|
||||
List<DouShopSubAccountInfo> lstSubSa = new List<DouShopSubAccountInfo>();
|
||||
List<ShopSubAccountInfo> lstSubSa = new List<ShopSubAccountInfo>();
|
||||
public AdminShopAddSubSaForm(List<string> ShopSelectIds = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -79,7 +79,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
|
||||
{
|
||||
string oStr = JsonHelper.SerializeObject(obj);
|
||||
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
|
||||
ShopSubAccountInfo user = new ShopSubAccountInfo();
|
||||
user.id = BaseRegex.GetIntJson(ref oStr, "id");
|
||||
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
|
||||
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
@@ -287,7 +288,8 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
case "删除":
|
||||
if (BaseMsgForm.ShowConfirm("确定删除店铺吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
return;
|
||||
AdminDelServerShop(shop);
|
||||
if (ShopBLL.AdminDelServerShop(shop))
|
||||
SearchShop(this.ucSplitPage1.CurrentPage);
|
||||
break;
|
||||
case "编辑":
|
||||
ShopAddEditForm editForm = new ShopAddEditForm(shop);
|
||||
@@ -351,12 +353,12 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
else
|
||||
{
|
||||
AdminAddServerShop(shopInfo);
|
||||
ShopBLL.AdminAddServerShop(shopInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AdminMdyServerShop(shopInfo);
|
||||
ShopBLL.AdminMdyServerShop(shopInfo);
|
||||
}
|
||||
SearchShop(this.ucSplitPage1.CurrentPage);
|
||||
}
|
||||
@@ -422,165 +424,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
|
||||
pageCount = Math.Max(pageCount, 1);
|
||||
|
||||
return DeserializationShop(html);
|
||||
}
|
||||
|
||||
public static List<ShopLoginInfo> AdminGetServerShopLstByIds(List<string> shop_ids)
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
shop_ids = shop_ids.Where(s => !string.IsNullOrEmpty(s)).ToList();
|
||||
|
||||
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&shop_ids='" + string.Join("','", shop_ids) + "'";
|
||||
data += "&page_size=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("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
|
||||
{
|
||||
return new List<ShopLoginInfo>();
|
||||
}
|
||||
|
||||
return DeserializationShop(html);
|
||||
}
|
||||
|
||||
public static string AdminGetServerShopLstForSetCookie(ShopLoginInfo loginShop, List<ShopLoginInfo> lstRst)
|
||||
{
|
||||
if (lstRst == null)
|
||||
lstRst = new List<ShopLoginInfo>();
|
||||
|
||||
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&search_user_name=" + loginShop.UserName +
|
||||
"&search_login_name=" + loginShop.LoginName;
|
||||
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"))
|
||||
{
|
||||
return "获取失败:" + BaseRegex.GetStringJson(ref html, "msg");
|
||||
}
|
||||
|
||||
lstRst.AddRange(DeserializationShop(html));
|
||||
|
||||
return "success";
|
||||
}
|
||||
|
||||
public static List<ShopLoginInfo> DeserializationShop(string shopJson)
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
if (!shopJson.Contains("data"))
|
||||
return list;
|
||||
|
||||
var jArr = JObject.Parse(shopJson)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return list;
|
||||
|
||||
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.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.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name");
|
||||
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
|
||||
shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group");
|
||||
shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie");
|
||||
shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+");
|
||||
shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2").ParseToString();
|
||||
shop.Cookies2 = shop.Cookies2.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.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2");
|
||||
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
|
||||
shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining");
|
||||
|
||||
list.Add(shop);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string AdminAddServerShop(ShopLoginInfo _shop)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("shop/admin_add_shop");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
+ "&shop_user_name=" + _shop.UserName
|
||||
+ "&login_name=" + _shop.LoginName
|
||||
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
|
||||
+ "&shop_id=" + _shop.ShopId
|
||||
+ "&shop_account=" + _shop.ShopAccount
|
||||
+ "&cookie=" + _shop.Cookies
|
||||
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
|
||||
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName)
|
||||
+ "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes)
|
||||
+ "&login_status=" + _shop.LoginStatus;
|
||||
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200"))
|
||||
{
|
||||
var msg = BaseRegex.GetStringJson(ref result, "msg");
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
msg = "店铺保存失败!";
|
||||
BaseMsgForm.ShowError(msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string AdminMdyServerShop(ShopLoginInfo _shop)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("shop/admin_mdy_shop");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
+ "&shop_user_name=" + _shop.UserName
|
||||
+ "&login_name=" + _shop.LoginName
|
||||
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
|
||||
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
|
||||
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName)
|
||||
+ "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes);
|
||||
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200"))
|
||||
{
|
||||
var msg = BaseRegex.GetStringJson(ref result, "msg");
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
msg = "店铺保存失败!";
|
||||
BaseMsgForm.ShowError(msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void AdminDelServerShop(ShopLoginInfo _shop)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("shop/admin_del_shop");
|
||||
var data = UserLogin.GetSignaturex() + "&login_name=" + _shop.LoginName
|
||||
+ "&shop_user_name=" + _shop.UserName;
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200"))
|
||||
BaseMsgForm.ShowError("删除失败:" + BaseRegex.GetStringJson(ref result, "msg"));
|
||||
else
|
||||
{
|
||||
SearchShop(this.ucSplitPage1.CurrentPage);
|
||||
}
|
||||
return ShopBLL.DeserializationShop(html);
|
||||
}
|
||||
|
||||
private void btnCheck_Click(object sender, EventArgs e)
|
||||
@@ -642,7 +486,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
var shop = shops.FirstOrDefault(v => v.LoginName == shopLoginNames[i]);
|
||||
|
||||
// 先从服务端取最新cookie
|
||||
var serverCampanys = AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
|
||||
var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
|
||||
var serverShop = serverCampanys.FirstOrDefault();
|
||||
if (shop != null && serverShop != null)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@ using Work;
|
||||
using Work.BLL.Tools;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.KJDForms.ToolForms;
|
||||
using TemuKJD.BLL;
|
||||
|
||||
namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
public partial class AdminShopLoginForm : LRBaseForm
|
||||
@@ -167,7 +169,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
newShop.LoginStatus = "登录成功";
|
||||
newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
|
||||
var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
var html = ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
if (!html.Contains("\"code\":200"))
|
||||
isSuccess = false;
|
||||
}
|
||||
@@ -266,7 +268,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
newShop.LoginStatus2 = "国际版在线";
|
||||
newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
|
||||
var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
var html = ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
if (!html.Contains("\"code\":200"))
|
||||
isSuccess = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user