Files
KJD_WebService/TEMUKJD/KJDForms/SalesCenterForms/LimitedSalesManagerActiveForm.cs
T

695 lines
35 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TemuKJD.KJDForms.SalesCenterForms
{
public partial class LimitedSalesManagerActiveForm : Form
{
private DouShopLoginInfo shop = null;
private CheckBox chkSelectAll = null;
public List<string> lstActiveId = new List<string>();
public SeckillingAndLimitedSalesForm seckillingAndLimitedSalesForm = null;
string _signature = "";
string _timeSpan = "";
public bool isGetActiveSuccess = false;
public List<ActiveInfo> activeList = new List<ActiveInfo>();
bool isAll = true;
public LimitedSalesManagerActiveForm(DouShopLoginInfo _shop = null)
{
InitializeComponent();
shop = _shop;
cmbActState.SelectedIndex = 0;
cmbType.SelectedIndex = 0;
txtActivity.Focus();
//设置全选按钮
chkSelectAll = dgvActive.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false);
dgvActive.Columns["colSelect"].HeaderText = "";
chkSelectAll.Width = chkSelectAll.Height = 13;
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged; //全选事件
}
private void LimitedSalesManagerActiveForm_Load(object sender, EventArgs e)
{
Task.Run(() =>
{
this.SearchActivitys();
});
}
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
{
if (!chkSelectAll.Checked)
{
if (isAll)
{
foreach (DataGridViewRow row in dgvActive.Rows)
{
long ActiveId = row.Cells["colActivityId"].Value.ParseToLong();
row.Cells["colSelect"].Value = false;
lstActiveId.Remove(ActiveId.ToString());
}
}
else
{
isAll = true;
foreach (DataGridViewRow row in dgvActive.Rows)
{
long ActiveId = row.Cells["colActivityId"].Value.ParseToLong();
if (lstActiveId.Contains(ActiveId.ToString()))
row.Cells["colSelect"].Value = true;
else
row.Cells["colSelect"].Value = false;
}
}
}
else
{
foreach (DataGridViewRow row in dgvActive.Rows)
{
row.Cells["colSelect"].Value = true;
long ActiveId = row.Cells["colActivityId"].Value.ParseToLong();
if (!lstActiveId.Any(p => p == ActiveId.ToString()))
lstActiveId.Add(ActiveId.ToString());
}
}
}
private void dgvActive_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvActive.Columns[e.ColumnIndex].HeaderText;
string columnName = dgvActive.Columns[e.ColumnIndex].Name;
long ActiveId = dgvActive.Rows[e.RowIndex].Cells["colActivityId"].Value.ParseToLong();
var row = dgvActive.Rows[e.RowIndex];
switch (columnName)
{
case "colSelect":
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
if (dgvActive.Rows[e.RowIndex].Cells["colSelect"].Value.ParseToBool())
{
if (lstActiveId.Any(p => p == ActiveId.ToString()))
lstActiveId.RemoveAll(p => p == ActiveId.ToString());
lstActiveId.Add(ActiveId.ToString());
}
else
lstActiveId.Remove(ActiveId.ToString());
if (dgvActive.Rows.Cast<DataGridViewRow>().All(r => r.Cells["colSelect"].Value.ParseToBool()))
chkSelectAll.Checked = true;
else
{
isAll = false;
chkSelectAll.Checked = false;
}
break;
}
}
public void GetActive()
{
if (shop == null)
return;
ShowVisitorMessage("");
Task.Run(() =>
{
if (shop.LoginStatus == "登录成功")
seckillingAndLimitedSalesForm.GetActiveByCef(this.shop);
var rowsTemp = dgvActive.Rows.Cast<DataGridViewRow>().ToList();
rowsTemp.Reverse();
});
}
public void GetActiveSim(string listUrl, string referrerUrl, Dictionary<string, string> headers, string firstPageData = "")
{
ShowVisitorMessage("");
int total = -1;
int number = 0;
string result = "";
if (!string.IsNullOrEmpty(firstPageData))
result = firstPageData;
//获取所有活动
DateTime date = DateTime.Now.Date;
_timeSpan = BaseRegex.GetMatchRegexString(ref listUrl, "&_=([\\s\\S]+?)&");
if (string.IsNullOrEmpty(_timeSpan))
_timeSpan = BaseRegex.GetMatchRegexString(ref listUrl, "&_=([\\s\\S]+?)");
if (string.IsNullOrEmpty(_timeSpan))
_timeSpan = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now).ToString();
_signature = BaseRegex.GetMatchRegexString(ref listUrl, "&_signature=([\\s\\S]+?)&");
if (string.IsNullOrEmpty(_signature))
{
var listUrl2 = listUrl + "&";
_signature = BaseRegex.GetMatchRegexString(ref listUrl2, "&_signature=([\\s\\S]+?)&");
}
listUrl = "https://fxg.jinritemai.com/shop/promotion/listFlashWithTimeLimit?campaign_status=&shop_stype=&page=1&pageSize=20&_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
for (int i = 1; i < 9999; i++)
{
result = "";
number += 20;
for (int j = 0; j < 3 && !result.Contains("\"st\":0"); j++)
{
CommonSimRequest simRequest = new CommonSimRequest();
simRequest.Accept = "application/json, text/plain, */*";
if (headers.ContainsKey("Accept"))
simRequest.Accept = headers["Accept"];
if (headers.ContainsKey("UserAgent"))
simRequest.UserAgent = headers["UserAgent"];
var cookie = shop.Cookies;
var rUrl = listUrl.Replace("page=1", "page=" + i);
result = simRequest.Request_Get(rUrl, referrerUrl, new Dictionary<string, string>(), cookie);
if (j > 0)
{
Thread.Sleep(Randomx.GetId(2000, 3000));
}
}
if (result.Contains("\"st\":0,\"msg\":\"\",\"code\":0,") && !seckillingAndLimitedSalesForm.cancellationTokenSource.IsCancellationRequested)
{
this.isGetActiveSuccess = true;
var jObj = JObject.Parse(result);
var aList = JsonHelper.DeserializeJsonToList<ActiveInfo>(jObj["data"]["flash_list"]?.ToString());
foreach (var info in aList)
{
if (this.activeList.Any(p => p.campaign_id == info.campaign_id))
this.activeList.RemoveAll(p => p.campaign_id == info.campaign_id);
this.activeList.Add(info);
}
Thread.Sleep(Randomx.GetId(1500, 2000));
}
else
{
isGetActiveSuccess = false;
break;
}
if (number >= total)
break;
}
Invoke(new Action(() =>
{
if (seckillingAndLimitedSalesForm.cancellationTokenSource.IsCancellationRequested)
{
this.statusBar.lblTaskStatus.Text = "获取中断";
}
else if (!isGetActiveSuccess)
{
this.statusBar.lblTaskStatus.Text = "获取活动信息失败";
}
else
{
this.statusBar.lblTaskStatus.Text = "获取完成";
}
this.statusBar.pgbTaskProgress.Value = 0;
this.statusBar.pgbTaskProgress.Text = 0 + "/" + 0;
this.statusBar.pgbTaskProgress.Maximum = 0;
}));
}
public void ShowVisitorMessage(string msg, string activityId = "")
{
Invoke(new Action(() =>
{
this.label1.Text = msg;
if (!string.IsNullOrEmpty(activityId))
{
var row = this.dgvActive.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => activityId == r.Cells["colActivityId"].Value?.ToString());
if (row != null)
{
row.Cells["colMessage"].Value = msg;
if (msg.EndsWith("修改成功!")) {
row.Cells["colActiveState"].Value = "待查询";
row.Cells["colPreStartTime"].Value = "待查询";
row.Cells["colStartTime"].Value = "待查询";
row.Cells["colEndTime"].Value = "待查询";
row.Cells["colPrefereType"].Value = "待查询";
}
}
}
}));
}
public void ClearData()
{
this.lstActiveId.Clear();
this.activeList.Clear();
this.dgvActive.Rows.Clear();
}
private void btnSearch_Click(object sender, EventArgs e)
{
SearchActivitys();
}
private void SearchActivitys()
{
ClearData();
ShowVisitorMessage("");
ShowVisitorMessage("查询开始");
if (this.activeList.Count == 0)
{
if (seckillingAndLimitedSalesForm.cancellationTokenSource.IsCancellationRequested)
seckillingAndLimitedSalesForm.cancellationTokenSource = new CancellationTokenSource();
GetActiveSim("https://fxg.jinritemai.com/shop/promotion/listFlashWithTimeLimit?campaign_status=&shop_stype=&page=1&pageSize=20&_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature, "https://fxg.jinritemai.com/market/center/tools/limitsales", new Dictionary<string, string>());
}
string name = "", id = "", stateText = "", stateVal = "", typeText = "", typeVal = "";
Invoke(new Action(() =>
{
name = txtActivity.Text.Trim();
id = txtProID.Text.Trim();
stateText = cmbActState.SelectedItem.ToString();
stateVal = stateText == "全部" ? "" : (stateText == "进行中" ? "1" : (stateText == "已结束" ? "2" : (stateText == "未开始" ? "0" : "3")));
typeText = cmbType.SelectedItem.ToString();
typeVal = typeText == "全部" ? "" : (typeText == "打折" ? "3" : (typeText == "直降" ? "2" : "1"));
}));
if ((name == "" && id == "" && stateVal == "" && typeVal == "" && this.dgvActive.Rows.Count == activeList.Count) || activeList.Count == 0)
{
ShowVisitorMessage("查询完成!");
return;
}
Task.Run(() =>
{
List<ActiveInfo> infos = new List<ActiveInfo>();
var listUrl = "https://fxg.jinritemai.com/shop/promotion/listFlashWithTimeLimit?title=&campaign_status=&shop_stype=&product_id=" + id + "&page=1&pageSize=20&_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
int total = -1;
int number = 0;
string result = "";
for (int i = 1; i < 9999; i++)
{
result = "";
number += 20;
for (int j = 0; j < 3 && !result.Contains("\"st\":0"); j++)
{
CommonSimRequest simRequest = new CommonSimRequest();
simRequest.Accept = "application/json, text/plain, */*";
var cookie = shop.Cookies;
var rUrl = listUrl.Replace("page=1", "page=" + i);
result = simRequest.Request_Get(rUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales", new Dictionary<string, string>(), cookie);
if (j > 0)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
}
}
if (result.Contains("\"st\":0") && !seckillingAndLimitedSalesForm.cancellationTokenSource.IsCancellationRequested)
{
if (total == -1)
{
total = BaseRegex.GetIntJson(ref result, "total");
}
var jObj = JObject.Parse(result);
var aList = JsonHelper.DeserializeJsonToList<ActiveInfo>(jObj["data"]["flash_list"]?.ToString());
if (!string.IsNullOrEmpty(name))
aList = aList.Where(x => x.title == name).ToList();
if (!string.IsNullOrEmpty(stateVal))
aList = aList.Where(x => x.campaign_status == stateVal).ToList();
if (!string.IsNullOrEmpty(typeVal))
aList = aList.Where(x => x.shop_stype == typeVal).ToList();
int totals = aList.Count;
Invoke(new Action(() =>
{
//dgvActive.Rows.Clear();
isAll = false;
for (int j = 0; j < totals; j++)
{
var info = aList[j];
var shop_stype = info.shop_stype == "1" ? "一口价" : (info.shop_stype == "3" ? "打折" : "直降");
var status = info.campaign_status == "2" ? "已结束" : (info.campaign_status == "1" ? "进行中" : (info.campaign_status == "0" ? "未开始" : "已失效"));
if (lstActiveId.Contains(info.campaign_id))
this.dgvActive.Rows.Add(true, info.campaign_id, info.title, info.pre_begin_time, info.begin_time, info.end_time, shop_stype, status);
else
this.dgvActive.Rows.Add(false, info.campaign_id, info.title, info.pre_begin_time, info.begin_time, info.end_time, shop_stype, status);
}
}));
foreach (var info in aList)
{
infos.Add(info);
}
Thread.Sleep(Randomx.GetId(1500, 2000));
}
if (number >= total)
break;
}
ShowVisitorMessage("查询完成!");
});
}
private void btnReload_Click(object sender, EventArgs e)
{
this.txtActivity.Text = string.Empty;
this.txtProID.Text = string.Empty;
this.cmbActState.SelectedIndex = 0;
this.cmbType.SelectedIndex = 0;
}
private void btnDelete_Click(object sender, EventArgs e)
{
lstActiveId = dgvActive.Rows.Cast<DataGridViewRow>()
.Where(r => r.Cells["colSelect"].Value.ParseToBool() == true)
.Select(r => r.Cells["colActivityId"].Value.ToString()).ToList();
if (lstActiveId.Count == 0 || dgvActive.Rows.Count == 0)
{
BaseMsgForm.ShowInfo("请选择待删除的活动!");
return;
}
if (BaseMsgForm.ShowConfirm("确定要删除活动吗?确认删除后,将永久删除,无法恢复!").DialogResult == DialogResult.OK)
{
ShowVisitorMessage("");
Task.Run(() =>
{
List<string> lstActiveIdTemp = new List<string>();
lstActiveIdTemp.AddRange(lstActiveId);
foreach (var id in lstActiveIdTemp)
{
long ActiveId = id.ParseToLong();
DelActive(ActiveId);
}
});
}
}
public void DelActive(long ActiveId, bool isRemoveInDgv = true)
{
var deleteUrl = "https://fxg.jinritemai.com/shop/promotion/setFlashStatus?_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
var cookies = shop.Cookies;
DataGridViewRow row = null;
row = dgvActive.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colActivityId"].Value.ParseToLong() == ActiveId);
if (row == null)
return;
string name = row.Cells["colActivityName"].Value.ToString();
var colActiveState = row.Cells["colActiveState"].Value.ToString();
// 未失效活动先设置失效
if (colActiveState == "进行中" || colActiveState == "未开始")
{
//Invoke(new Action(() => { row.Cells["colMessage"].Value = name + "活动" + colActiveState + ",请先设置失效,再删除!"; }));
//continue;
SetActiveInvalid(ActiveId.ToString());
Thread.Sleep(Randomx.GetId(250, 500));
}
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
var postData = "{\"campaign_id\":\"" + ActiveId + "\",\"status\":3}";
string result = request.Request_PostByBigLength(deleteUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales", dicts, cookies, postData, false);
if (result.Contains("{\"st\":0,\"msg\":\"\",\"code\":0,"))
{
if (isRemoveInDgv)
{
Invoke(new Action(() => { row.Cells["colMessage"].Value = "删除完成,活动已删除!"; }));
ShowVisitorMessage("删除完成,活动" + name + "已删除!");
}
Thread.Sleep(Randomx.GetId(250, 500));
if (isRemoveInDgv)
{
lstActiveId.Remove(ActiveId.ToString());
activeList.Remove(activeList.Where(x => x.campaign_id == ActiveId.ToString()).FirstOrDefault());
}
}
else
{
Invoke(new Action(() => { row.Cells["colMessage"].Value = "删除失败:" + BaseRegex.GetStringJson(ref result, "msg"); }));
}
}
private void btnInvalid_Click(object sender, EventArgs e)
{
if (lstActiveId.Count == 0 || dgvActive.Rows.Count == 0)
{
BaseMsgForm.ShowInfo("请选择待失效的活动!");
return;
}
if (BaseMsgForm.ShowConfirm("确定要把活动设置为失效吗?").DialogResult == DialogResult.OK)
{
Task.Run(() =>
{
for (int i = 0; i < dgvActive.Rows.Count; i++)
{
DataGridViewRow row = dgvActive.Rows[i];
SetActiveInvalid(row.Cells["colActivityId"].Value.ToString());
}
});
}
}
private void SetActiveInvalid(string activityId)
{
var row = this.dgvActive.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colActivityId"].Value.ToString() == activityId);
if (row == null)
return;
var failUrl = "https://fxg.jinritemai.com/shop/promotion/setFlashStatus?_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
var cookies = shop.Cookies;
long ActiveId = row.Cells["colActivityId"].Value.ParseToLong();
if (lstActiveId.Any(p => p == ActiveId.ToString()))
{
string name = row.Cells["colActivityName"].Value.ToString();
var colActiveState = row.Cells["colActiveState"].Value.ToString();
if (colActiveState != "进行中" && colActiveState != "未开始")
{
Invoke(new Action(() => { row.Cells["colMessage"].Value = name + "活动" + colActiveState + ",无需再设置失效!"; }));
return;
}
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
var postData = "{\"campaign_id\":\"" + ActiveId + "\",\"status\":2}";
string result = request.Request_PostByBigLength(failUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales", dicts, cookies, postData, false);
if (result.Contains("{\"st\":0,\"msg\":\"\",\"code\":0,"))
{
Invoke(new Action(() =>
{
var activeInfo = activeList.Where(x => x.campaign_id == ActiveId.ToString()).FirstOrDefault();
if (activeInfo != null)
{
activeInfo.campaign_status = "3";
row.Cells["colActiveState"].Value = "已失效";
row.Cells["colMessage"].Value = "设置失效已完成!";
}
}));
Thread.Sleep(Randomx.GetId(250, 500));
}
else
{
Invoke(new Action(() => { row.Cells["colMessage"].Value = "设置失效失败 :" + BaseRegex.GetStringJson(ref result, "msg"); }));
}
}
}
private void btnEdit_Click(object sender, EventArgs e)
{
//if (dgvActive.Rows.Count == 0)
//{
// BaseMsgForm.ShowInfo("请先获取活动列表!");
// return;
//}
//if (lstActiveId.Count == 0)
//{
// BaseMsgForm.ShowInfo("请选择待失效的活动!");
// return;
//}
//var cookies = shop.Cookies;
//for (int i = 0; i < dgvActive.Rows.Count; i++)
//{
// DataGridViewRow row = dgvActive.Rows[i];
// long ActiveId = row.Cells["colActivityId"].Value.ParseToLong();
// if (lstActiveId.Any(p => p == ActiveId.ToString()))
// {
// string name = row.Cells["colActivityName"].Value.ToString();
// var colActiveState = row.Cells["colActiveState"].Value.ToString();
// if (colActiveState != "进行中" && colActiveState != "未开始")
// {
// BaseMsgForm.ShowInfo("只能编辑进行中或者未开始的活动," + name + "活动" + colActiveState + "!");
// continue;
// }
// ShowVisitorMessage("");
// var status = 1;
// if (colActiveState == "未开始")
// status = 0;
// CommonSimRequest simRequest = new CommonSimRequest();
// var rUrl = "https://fxg.jinritemai.com/byteshop/promotion/detailFlashAndGoods?campaign_id=" + ActiveId + "&filter_unable_product=0&_bid=ecom_market_shop&appid=1&_= " + _underline + " & _signature = " + _signature;
// var result = simRequest.Request_Get(rUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?id=" + ActiveId + "&refer=edit&status=" + status, new Dictionary<string, string>(), cookies);
// if (result.Contains("{\"st\":0,\"msg\":\"\",\"code\":0,"))
// {
// ActiveInfoEdit infoEdit = new ActiveInfoEdit();
// infoEdit.campaign_id = ActiveId.ToString();
// JObject o1 = JObject.Parse(result);
// JObject o2 = JObject.Parse(o1["data"]?.ToString());
// infoEdit.sub_stype = o2["sub_stype"].ToString().ParseToInt();
// infoEdit.title = o2["title"].ToString();
// infoEdit.pre_begin_time = o2["pre_begin_time"].ToString();
// infoEdit.begin_time = o2["begin_time"].ToString();
// infoEdit.end_time = o2["end_time"].ToString();
// infoEdit.order_expire_time = o2["order_expire_time"].ToString();
// infoEdit.shop_stype = o2["shop_stype"].ToString();
// infoEdit.time_set_type = o2["time_set_type"].ToString();
// infoEdit.status = o2["status"].ToString().ParseToInt();
// infoEdit.stock_type = o2["stock_type"].ToString();
// infoEdit.sold_out_type = o2["sold_out_type"].ToString();
// infoEdit.promotion_goods = new List<Promotion_Goods>();
// JArray arr = JArray.Parse(o2["promotion_goods"].ToString());
// for (int x = 0; x < arr.Count; x++)
// {
// JObject ox = JObject.Parse(arr[x].ToString());
// Promotion_Goods _Goods = new Promotion_Goods();
// _Goods.product_id = ox["product_id"].ToString();
// _Goods.title = ox["title"].ToString();
// _Goods.cover = ox["cover"].ToString();
// _Goods.config_scope = ox["config_scope"].ToString().ParseToInt();
// _Goods.promotion_skus = new List<Promotion_Skus>();
// JArray arrSku = JArray.Parse(ox["promotion_skus"].ToString());
// for (int j = 0; j < arrSku.Count; j++)
// {
// JObject oj = JObject.Parse(arrSku[j].ToString());
// Promotion_Skus skus = new Promotion_Skus();
// skus.id = oj["id"].ToString();
// skus.camp_stock_num = oj["camp_stock_num"].ToString().ParseToInt();
// skus.camp_left_stock_num = oj["camp_left_stock_num"].ToString().ParseToInt();
// skus.price = oj["price"].ToString().ParseToInt();
// skus.user_limit = oj["user_limit"].ToString();
// skus.origin_price = oj["origin_price"].ToString().ParseToInt();
// skus.stock = oj["stock"].ToString().ParseToInt();
// skus.specification = oj["specification"].ToString();
// skus.shop_svalue = oj["shop_svalue"].ToString().ParseToInt();
// skus.redline_price = oj["redline_price"].ToString().ParseToInt();
// _Goods.promotion_skus.Add(skus);
// }
// infoEdit.promotion_goods.Add(_Goods);
// }
// var editUrl = "https://fxg.jinritemai.com/byteshop/promotion/editFlashAndGoods?_bid=ecom_market_shop&appid=1&_= " + _underline + " & _signature = " + _signature;
// var postProData = string.Empty;
// postProData = postProData + "{\"sub_stype\":\"" + infoEdit.sub_stype + "\",\"shop_stype\":\"" + infoEdit.shop_stype + "\",\"title\":\"" + infoEdit.title + "\",\"time_set_type\":\"" + infoEdit.time_set_type + "\",\"promotion_goods\":[";
// foreach (var goods in infoEdit.promotion_goods)
// {
// postProData = postProData + "{\"product_id\":\"" + goods.product_id + "\",\"title\":\"" + goods.title + "\",\"cover\":\"" + goods.cover + "\",\"config_scope\":\"" + goods.config_scope + "\",\"promotion_skus\":[";
// if (goods.promotion_skus.Count > 0)
// {
// DouProductPromotionListSkuInfoEditForm skuInfoEdit = new DouProductPromotionListSkuInfoEditForm(goods, infoEdit.shop_stype);
// skuInfoEdit.ShowDialog();
// if (skuInfoEdit.DialogResult == DialogResult.OK)
// {
// foreach (var skus in skuInfoEdit.skuList)
// {
// postProData = postProData + "{\"id\":\"" + skus.id + "\",\"camp_stock_num\":\"" + skus.camp_stock_num + "\",\"user_limit\":\"" + skus.user_limit + "\",\"price\":\"" + skus.price + "\",\"shop_svalue\":\"" + skus.shop_svalue + "\"},";
// }
// }
// }
// postProData = postProData.Trim(',') + "]},";
// }
// postProData = postProData.Trim(',') + "],\"order_expire_time\":\"" + infoEdit.order_expire_time + "\",\"pre_begin_time\":\"" + infoEdit.pre_begin_time + "\",\"begin_time\":\"" + infoEdit.begin_time + "\",\"end_time\":\"" + infoEdit.end_time + "\",\"sold_out_type\":\"" + infoEdit.sold_out_type + "\",\"create_action_type\":\"0\",\"campaign_id\":\"" + infoEdit.campaign_id + "\"}";
// CommonSimRequest simRequest1 = new CommonSimRequest();
// simRequest1.ContentType = "application/json";
// var editResult = simRequest1.Request_PostByBigLength(editUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?id=" + ActiveId + "&refer=edit&status=" + status, new Dictionary<string, string>(), cookies, postProData, false);
// if (editResult.Contains("{\"st\":0,\"msg\":\"\",\"code\":0,"))
// {
// ShowVisitorMessage("修改完成,活动已修改!");
// Thread.Sleep(1000);
// }
// else
// {
// Invoke(new Action(() => { row.Cells["colMessage"].Value = "修改失败:" + BaseRegex.GetStringJson(ref editResult, "msg"); }));
// }
// }
// }
//}
}
public string GetProductByActivityId(string activityId, string cookies)
{
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
string reqUrl = "https://fxg.jinritemai.com/byteshop/promotion/detailFlashAndGoods?campaign_id=" + activityId + "&filter_unable_product=0&_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
string refUrl = "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?id=" + activityId + "&refer=edit&status=1";
string result = request.Request_Get(reqUrl, refUrl, dicts, cookies);
return result;
//https://fxg.jinritemai.com/byteshop/promotion/detailFlashAndGoods?campaign_id=7129422311865811232&filter_unable_product=0&_bid=ecom_market_shop&appid=1
//https://fxg.jinritemai.com/market/center/tools/limitsales/detail?id=7129422311865811232&refer=edit&status=1
}
//根据id获取sku
public string GetSkusByProductIds(string postData, string cookies)
{
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
string reqUrl = "https://fxg.jinritemai.com/byteshop/promotion/batchGetSkuByProductIds?_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
string result = request.Request_PostByBigLength(reqUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?refer=new", dicts, cookies, postData);
return result;
}
public string checkFlashAndGoods(string postData, string cookies)
{
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
string reqUrl = "https://fxg.jinritemai.com/byteshop/promotion/checkFlashAndGoods?_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
string result = request.Request_PostByBigLength(reqUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?refer=new", dicts, cookies, postData);
return result;
}
public string createFlashAndGoods(string postData, string cookies)
{
CommonSimRequest request = new CommonSimRequest();
request.ContentType = "application/json";
Dictionary<string, string> dicts = new Dictionary<string, string>();
string reqUrl = "https://fxg.jinritemai.com/byteshop/promotion/createFlashAndGoods?_bid=ecom_market_shop&appid=1&_=" + _timeSpan + "&_signature=" + _signature;
string result = request.Request_PostByBigLength(reqUrl, "https://fxg.jinritemai.com/market/center/tools/limitsales/detail?refer=new", dicts, cookies, postData);
return result;
}
}
public class ActiveInfo
{
public string campaign_id { get; set; }
public string stype { get; set; }
public string title { get; set; }
public string pre_begin_time { get; set; }
public string begin_time { get; set; }
public string end_time { get; set; }
public string status { get; set; }
public string shop_stype { get; set; }
public string intro { get; set; }
public string campaign_status { get; set; }
public string warm_up { get; set; }
}
}