cef版本升级 店铺超管商品上货测试成功。
This commit is contained in:
1 parent
fe2d2883db
commit
1f7a719b39
45 files changed
+4634
-480
No files matched your search
@@ -0,0 +1,94 @@
|
||||
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;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
public class ShopBrowserObject
|
||||
{
|
||||
public delegate void InfoReceivedHandler(string information);
|
||||
public event InfoReceivedHandler OnInfoReceived;
|
||||
|
||||
public string getProduct(string sProdId, long supplierId)
|
||||
{
|
||||
var prodId = sProdId.ParseToLong();
|
||||
if (prodId <= 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("商品Id不存在!");
|
||||
return "failed";
|
||||
}
|
||||
var shop = AdminShopForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ToString());
|
||||
if (supplierId <= 0 || shop == null)
|
||||
{
|
||||
BaseMsgForm.ShowError("店铺不存在!");
|
||||
return "failed";
|
||||
}
|
||||
|
||||
Task.Run(() => {
|
||||
var shop1 = shop;
|
||||
var prodId1 = prodId;
|
||||
var html = ProductQuery(shop1, prodId1.ToString());
|
||||
if (html.Contains("\"success\":true") && html.Contains("\"result\""))
|
||||
{
|
||||
JObject obj = JObject.Parse(html);
|
||||
try
|
||||
{
|
||||
var result = JsonHelper.SerializeObject(obj["result"]);
|
||||
TemuProductInfo product = JsonHelper.DeserializeJsonToObject<TemuProductInfo>(result);
|
||||
|
||||
|
||||
// 创建 SaveFileDialog 的实例
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
|
||||
// 单线程单元(STA)模式运行文件对话框,否则会报错。
|
||||
System.Threading.Thread InvokeThread = new System.Threading.Thread(new System.Threading.ThreadStart(()=> {
|
||||
|
||||
// 设置对话框的属性
|
||||
saveFileDialog.Title = "保存商品";
|
||||
saveFileDialog.Filter = "商品文件 (*.prd)|*.prd|所有文件 (*.*)|*.*"; // 过滤文件类型
|
||||
saveFileDialog.FileName = product.productId.ParseToString(); // 默认文件名
|
||||
saveFileDialog.DefaultExt = "txt"; // 默认文件扩展名
|
||||
|
||||
// 显示对话框并获取结果
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// 用户点击了“保存”按钮,此时可以获取文件的路径
|
||||
string filePath = saveFileDialog.FileName;
|
||||
// 在这里处理文件保存逻辑,例如写入数据到文件
|
||||
System.IO.File.WriteAllText(filePath, result);
|
||||
}
|
||||
//BaseMsgForm.ShowInfo("商品保存成功!");
|
||||
OnInfoReceived("商品保存成功!");
|
||||
}));
|
||||
InvokeThread.SetApartmentState(System.Threading.ApartmentState.STA);
|
||||
InvokeThread.Start();
|
||||
InvokeThread.Join();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string ProductQuery(ShopLoginInfo shop, string prodId)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/query";
|
||||
string body = @"{""productId"":" + prodId + @",""productEditTaskUid"":""""}";
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?from=productList&productId=" + prodId;
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user