1131 lines
35 KiB
C#
1131 lines
35 KiB
C#
/*
|
|
* 主要基类
|
|
* 肖俊
|
|
* 2012-5-9
|
|
*/
|
|
using AllBase.DouYinModel.Result;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AllBase
|
|
{
|
|
public static class BaseClass
|
|
{
|
|
#region oem贴牌参数
|
|
public static string OemId { get; set; } = "";
|
|
public static string OemName { get; set; } = "";
|
|
public static bool IsOemOwner { get; set; } = false;
|
|
public static string AgentName { get; set; } = "";
|
|
public static string AgentCode { get; set; } = "";
|
|
public static bool IsShowRegister { get; set; } = true;
|
|
public static bool IsShowOpenAccount { get; set; } = true;
|
|
/// <summary>
|
|
/// 礼品单oem额外价格
|
|
/// </summary>
|
|
public static decimal OemGiftAmount { get; set; } = 0;
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 版本ID
|
|
/// </summary>
|
|
|
|
public static int VersionCount = 282;
|
|
|
|
public static string ServerUrl { get; set; } = "http://1.13.195.131:9000";
|
|
public static string DebugUrl { get; set; } = "http://localhost:9000";
|
|
|
|
|
|
/// <summary>
|
|
/// 版本号
|
|
/// </summary>
|
|
public static string Varsion = (VersionCount / 100.0).ToString("f2");
|
|
|
|
public static bool isUseSimGetOrder = false;
|
|
/// <summary>
|
|
/// 是否开启模拟解密
|
|
/// </summary>
|
|
public static bool isUseSimGetRealAddress = false;
|
|
|
|
/// <summary>
|
|
/// 当前使用的路由
|
|
/// </summary>
|
|
public static string routeInUse = "buy_order_api";
|
|
|
|
|
|
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 = "";
|
|
public static string Jxsid = "";
|
|
|
|
/// <summary>
|
|
/// 代理版本号
|
|
/// </summary>
|
|
public static int oem_version = 0;
|
|
|
|
public static string ProgramName = "29供应链-微信小店订单管理";
|
|
public static string ProgromLogo = "";
|
|
public static string ProgromLogoIco = "";
|
|
public static string ToolName = "29供应链-微信小店订单管理工具";
|
|
//public static string MainPath = "douyin";
|
|
public static string MainPath = "29wx";
|
|
public static string ServiceQQ = "569588500";
|
|
public static Image LoginImage = null;
|
|
public static Image LogoImage = null;
|
|
public static Icon Ico = null;
|
|
public static int bili = 5;
|
|
public static FontFamily font = null;//字体
|
|
public static IntPtr pati;
|
|
/// <summary>
|
|
/// IP地址和名称
|
|
/// </summary>
|
|
public static string IPAddress = "127.0.0.1";
|
|
public static string IPAddressName = "127.0.0.1";
|
|
|
|
/// <summary>
|
|
/// 是否操作总公司
|
|
/// </summary>
|
|
public static bool IsMainCompany = false;
|
|
public static bool IsBuyer = false;
|
|
/// <summary>
|
|
/// 外部版本开启拼多多
|
|
/// </summary>
|
|
public static bool IsPinduoduo = false;
|
|
public static bool IsJinBao = false;
|
|
public static bool IsTaoKe = false;
|
|
public static bool IsPinbaobao = false;
|
|
public static bool IsXiaoNaiNiu = false;
|
|
public static bool IsJingXi = false;
|
|
public static bool SafeModel = false;
|
|
public static string AlimamaDomain = "";
|
|
public static string AlimamaPid = "";
|
|
//public static string ClientId = "9558f920cf77403bb475243fe44482ad";
|
|
public static string ApiKey = "a55ef8306263e335d3c0d332a94c9dbc24347cc1";
|
|
public static List<string> ClientIdx = new List<string>();
|
|
|
|
/// <summary>
|
|
/// 启用新版签名验证算法
|
|
/// </summary>
|
|
public static bool NewSignatureAuth = true;
|
|
|
|
public static Dictionary<string, string> serverDic = new Dictionary<string, string>();//存放服务地址
|
|
|
|
//public static string ServerUrl = "http://psbx.9u99.com/index.php?s=/";
|
|
public static string PXServerUrl = "http://px.jindouduo.com/";//螃蟹工具
|
|
public static string NbAssistantUrl = "http://nbzlw.e57.cn/";//奶爸助理
|
|
|
|
public static string TutuGateUrlx = "http://tt.deifei.cn/";//途途上货助手
|
|
public static string MicrowoodUrlx = "http://dd.pinsubao.com/";//微木REP
|
|
public static string BullUrlx = "http://wdt.qimake.cn/";//蛮牛工具
|
|
public static string MicrowoodOrderUrlx = "http://wnm.pinsubao.com/";//微木订单
|
|
public static string OrderGoldUrlx = "http://dianjin.6nt.cn/";//点金工具箱
|
|
public static string KaiDaToolUrlx = "http://kd.qimake.cn/";//凯达工具
|
|
public static string JfGjUrlx = "http://jfgj.qixiaoker.com/";//飓风管家
|
|
public static string JfDeliverUrlx = "http://jffh.qixiaoker.com/";//飓风发货
|
|
|
|
public static string TaoBaoLoginUrl = "https://login.taobao.com/member/login.jhtml";
|
|
|
|
// public static string AL1688LoginUrl = "https://work.1688.com/home/buyer.htm?_path_=buyer2017Base/2017buyerbase_trade/buyList&spm=a262jm.9273823.wkalibar.d8.5d884aadnN1j9G";
|
|
|
|
public static string PddMobileUrl = "https://yangkeduo.com/";
|
|
public static string PddMobileUrlx = "http://yangkeduo.com/";
|
|
|
|
public static string duoduojinbaoURL = "";
|
|
public static string taobaolianmengURL = "";
|
|
|
|
#region 设置参数
|
|
/// <summary>
|
|
/// 是否读取佣金 0是读取 1不读取
|
|
/// </summary>
|
|
public static int is_read_commission = 0;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 店铺子账号字典
|
|
/// </summary>
|
|
public static Dictionary<string, DouSubAccountModelItem> dousubaccountDic = new Dictionary<string, DouSubAccountModelItem>();
|
|
public static int readOrderTime = 0;
|
|
|
|
/// <summary>
|
|
/// 巨量百应用户cookies
|
|
/// </summary>
|
|
public static string baiyincookies = "";
|
|
/// <summary>
|
|
/// 订单开始时间
|
|
/// </summary>
|
|
public static DateTime OrderBeginTime = DateTime.Now.AddDays(-60);
|
|
/// <summary>
|
|
/// 用于判断唯一性
|
|
/// </summary>
|
|
public static Dictionary<long, ProductBase> Products = new Dictionary<long, ProductBase>();
|
|
/// <summary>
|
|
/// 用于循环输出
|
|
/// </summary>
|
|
public static List<ProductBase> ProductUse = new List<ProductBase>();
|
|
/// <summary>
|
|
/// 进度条矩阵
|
|
/// </summary>
|
|
public static Dictionary<string, ProcessBase> ProcessList = new Dictionary<string, ProcessBase>();
|
|
/// <summary>
|
|
/// 上传过的
|
|
/// </summary>
|
|
public static List<string> ProductIds = new List<string>();
|
|
//public static int MaxValue, MinValue, ThisValue;
|
|
public static bool GetProductsSuccess = false;
|
|
|
|
public static bool SetProductView = false;
|
|
public static int TempSecond = 86400;
|
|
/// <summary>
|
|
/// 订单监控延迟
|
|
/// </summary>
|
|
public static int OrderStep = 5;
|
|
public static int RankPage = 3;
|
|
/// <summary>
|
|
/// 采集最低销量
|
|
/// </summary>
|
|
public static int MinSales = 0;
|
|
public static int MinPercent = 0;
|
|
public static int MinLevel = 0;
|
|
public static int Points { get; set; }
|
|
/// <summary>
|
|
/// 店铺充值月费
|
|
/// </summary>
|
|
public static int ShopPointsPerMonth { get; set; } = 30;
|
|
public static decimal RechargeAmountTotal { get; set; } = 0;
|
|
public static decimal Balance { get; set; } = 0;
|
|
public static decimal PostagePerOrder { get; set; } = 2.2m;
|
|
public static decimal PostagePerOrderDiff { get { return Math.Max(0, PostagePerOrder - 2.2m); } }
|
|
public static decimal RefundPostagePerOrder { get; set; } = 2.5m;
|
|
public static decimal RefundPostagePerOrderDiff { get { return Math.Max(0, RefundPostagePerOrder - 2.5m); } }
|
|
public static int AlimamaPageCount = 0;
|
|
public static bool CloudTitle = false;
|
|
public static bool CloudBrand = false;
|
|
public static bool CloudSellerNick = false;
|
|
public static bool CloudProduct = false;
|
|
public static bool ImageSheild = true;
|
|
/// <summary>
|
|
/// 内部版
|
|
/// </summary>
|
|
public static bool InSideVersion = false;
|
|
public static decimal MaxPrice = 0;
|
|
public static decimal MinPrice = 0;
|
|
public static decimal MinBackMoney = 0;
|
|
public static decimal Price = 5;
|
|
public static int TimeOut = 45;
|
|
public static int ThreadCount = 3;
|
|
public static int MainCatId = 0;
|
|
public static int GroupId = 0;
|
|
/// <summary>
|
|
/// 所在企业ID
|
|
/// </summary>
|
|
public static int CompanyId = 0;
|
|
/// <summary>
|
|
/// 企业名称
|
|
/// </summary>
|
|
public static string CompanyName = "";
|
|
/// <summary>
|
|
/// 到期时间
|
|
/// </summary>
|
|
public static string EndDate = "";
|
|
/// <summary>
|
|
/// 图片API
|
|
/// </summary>
|
|
public static string LoginApiUrl = ServerUrl;
|
|
public static string ImageApiUrl = "https://new.qixiaoke.com/index.php?obj=api/image";
|
|
//public static string LoginApiUrl = "http://order.qixiaoke.com/";//"http://192.168.8.9:8080/";
|
|
//public static string LoginApiUrl = "http://127.0.0.1:81/";
|
|
public static string BigDataApiUrl = "http://bigdata.qixiaoke.com/";
|
|
public static string UserAgentUrl = LoginApiUrl + "userAgent.php";
|
|
public static string GateApi = "";
|
|
public static string ExpressSite = "http://www.1064kk.com/";
|
|
public static string NewExpSite = "http://xinfen.xmby.tech/";
|
|
|
|
public static string QqGroupNum = "";
|
|
public static string QqGroupUrl = "";
|
|
public static string WechatUrl = "";
|
|
public static string IeUrlShow = "";
|
|
public static string JinBaoJump = "";
|
|
|
|
/// <summary>
|
|
/// 店铺旺旺名
|
|
/// </summary>
|
|
public static string ShopName = "";
|
|
public static string ShopId = "";
|
|
/// <summary>
|
|
/// 拼多多店铺ID
|
|
/// </summary>
|
|
public static int MallId = 0;
|
|
public static int ReceiverId = 0;
|
|
//public static string TbTokenUrl = "";
|
|
public static string NewCookies = "";
|
|
public static bool MustGetShopInfo = false;
|
|
public static bool MustGetFormAlive = false;
|
|
public static string ChromeChatHtml = "";
|
|
public static string ChromeUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
|
|
public static string PddShopChromeUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.4.45 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/2.6.0.26";
|
|
public static string ChromeCookies = "";
|
|
public static string ChromeJinBaoCookies = "";
|
|
public static string ChromeTbLmCookies = "";
|
|
public static string ChromeJdLmCookies = "";
|
|
|
|
public static string OrderId = "";//限制的订单
|
|
public static string PayMobile = "";//当前买手账号
|
|
public static bool SlideFormIsClose = true;//限制的窗体是否关闭(未关闭不允许弹出新的滑动窗体)
|
|
|
|
//针对淘宝模拟接口限制
|
|
public static bool SlideIsClose = false;//限制的窗体是否关闭(未关闭不允许弹出新的滑动窗体)
|
|
public static bool SlideCookiesReplace = false;//限制的窗体是否关闭(未关闭不允许弹出新的滑动窗体)
|
|
public static string SlideUrl = "";//限制的url
|
|
public static string x5Sec = "";
|
|
|
|
//针对淘宝cef限制
|
|
public static string SlideUrlx = "";//限制的url
|
|
public static string x5Secx = "";
|
|
|
|
public static string loadUrl = "";//限制的买手号订单列表
|
|
public static string verify_auth_token = "";
|
|
public static string verify_auth_token_prodetails = "";
|
|
public static bool isverfiy_finish = true;
|
|
//public static bool startGetRefundOrder = false;
|
|
|
|
public static bool IsUpdateExp = false;//修改物流
|
|
public static bool IsBuyEmptyBagSuccess = true;//购买空包是否成功标识
|
|
public static string EmptyBagType = "LPD";//快递网类型
|
|
public static string EmptyBagExp = "";//快递单快递
|
|
|
|
public static string SendErrorExpTime = "11";//发错误单的开始时间
|
|
public static string UpdateErrorExpTime = "10";//修改错误单的开始时间
|
|
public static bool PhonePay = true;//是否通过手机端购买
|
|
public static bool IsFinishSpellOrder = true;//是否已完成拼团--一键拼团使用
|
|
//public static bool IsFinishBuyOrder = true;//是否已完成拍单--连续拍单使用
|
|
public static string payPwd = "";//支付密码
|
|
public static bool IsRandomBuyer = false;//是否随机买手号
|
|
|
|
public static int sendOrderMin = 5;//发货初始倒计时分钟
|
|
public static int sendOrderSecond = 60;//发货倒计时秒
|
|
|
|
public static int StartReadOrderMin = 8;//读取订单倒计时分钟
|
|
public static int StartReadOrderSecond = 10;//读取订单倒计时秒
|
|
|
|
public static bool IsCloudBuyOrder = false;//云拍单(拼多多批发,多买手)
|
|
public static bool IsFactory = false; // 是否工厂模式
|
|
public static bool IsContinueBuy = false;//是否连续拍单
|
|
public static string DuoduoJinbaoUrl = "";//手动填写的多多进宝推广url
|
|
public static string DuoduoJinbaoDefaultUrl = "";//多多进宝推广url 默认
|
|
public static bool IsLoadDdJinBao = false;//拍单时是否用多多进宝的url
|
|
public static bool IsUpdateMobile = true;//是否修改收货人的手机号
|
|
public static string AntiContent = "";//发货用
|
|
public static bool AfterSaleTip = false;//售后提醒--默认关闭
|
|
public static bool IsFilterWord = true;//自动回复过滤违禁词--默认开启
|
|
public static string FilterWord = "";//过滤的违禁词
|
|
public static bool AutoReply = false;//客服集成是否自动回复
|
|
public static bool IsCustomService = false;//是否开启客服集成--默认关闭
|
|
public static bool IsOrderManage = true;//是否开启订单管理
|
|
public static bool NewCusSystem = false;//是否新方式的客服集成
|
|
public static bool IsSearchSame = true;//是否开启搜同款功能
|
|
public static bool IsOpenSound = false;//是否开启声音提醒
|
|
public static int AfterSaleTime = 30;//读取售后单的时间--默认30天
|
|
public static int WorkOrderTime = 30;//读取工单的时间--默认30天
|
|
public static bool IsLoginFinish = false;//是否登录完成
|
|
public static bool sOenVideoGuidance = true;//是否有视频指南
|
|
public static int UpdChoice = 1;//防滥发修改选项 1:都修改 2:不修改手机号
|
|
public static bool isOpenPangxie = false;//是否开启螃蟹
|
|
public static bool isEasyOrder = false;//开启分批发货
|
|
public static bool LoseMoneyNoBuy = true;//亏本单不拍 默认开启
|
|
public static bool IsImgShow = true;//是否显示规格图 默认开启
|
|
public static bool IsAutoSend = true;//是否拼多多自动发货 默认开启
|
|
public static bool IsAutoSendTb = true;//是否淘宝自动发货 默认开启
|
|
|
|
public static bool IsLoadByDefaultWeb = true;//是否通过电脑默认自身的浏览器打开商品详情 默认开启
|
|
public static bool isHljArear = false;//是否是黑龙江地区 默认关闭
|
|
public static bool testtb = true;//测试淘宝
|
|
public static bool IsSaveNote = false;//是否保存后台备注
|
|
public static bool IsAutoApplyRefund = false;//是否自动去上家申请退款
|
|
public static bool IsRefund = false;//店铺自动同意退款 退款后买手去上家退款
|
|
public static bool IsHasReceipt = false;//是否开启已有揽收信息再发货
|
|
public static bool TbLimitShow = true;//开启时淘宝买手号限制时自定弹框
|
|
public static bool DesSwitch = false;//是否开启随机解密方式 默认关闭 以服务端为准
|
|
public static int DesRsvTypeRate = 5;//开启RSV解密方式比例 默认50% 以服务端为准
|
|
public static bool SendSet = false;//开启发货时间设置开关
|
|
public static int SendTime = 13;//开启发货时间设置
|
|
public static bool SwitchBuyer = false;//点击拍单订单详情自动切换买手号 默认关闭
|
|
public static int ModeType = 0;//查看拍单订单详情方式 默认模式一
|
|
public static int GetTbExpressModeType = 0;//获取淘宝物流详情方式 默认模式一
|
|
|
|
public static int GetOrderPice = 0;//设置不读单的金额
|
|
|
|
public static int OrderDisplay = 0;//0全部 1单 2双 订单显示
|
|
|
|
|
|
#region 防滥发设置
|
|
public static string AddressDetailFormat = "";
|
|
public static string MobileFormat = "";
|
|
|
|
public static string Address_add = "拨打姓名后括号的电话";//拍单时追加地址的后面
|
|
public static bool Address_Add_Specialword = false;
|
|
public static long Mobile_Change;
|
|
|
|
#region 新版泛滥发设置
|
|
public static string OwerSetMobile;//自定义拍单号码
|
|
public static bool SpecCodeName;//名字加特殊字符
|
|
public static bool AddRealMobile;//添加真实号码
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 所有店铺的clientId token的过期时间
|
|
/// </summary>
|
|
public static Dictionary<string, string> ShopTokenTime = new Dictionary<string, string>();
|
|
|
|
/// <summary>
|
|
/// 当前所有cookies
|
|
/// </summary>
|
|
public static Dictionary<string, Dictionary<string, string>> CookiesAll = new Dictionary<string, Dictionary<string, string>>();
|
|
/// <summary>
|
|
/// 当前所有cookies对应字符串
|
|
/// </summary>
|
|
public static Dictionary<string, string> CookiesAllString = new Dictionary<string, string>();
|
|
|
|
|
|
/// <summary>
|
|
/// API接口是否可用
|
|
/// </summary>
|
|
public static bool ApiCanUse = false;
|
|
/// <summary>
|
|
/// 启用昨日订单
|
|
/// </summary>
|
|
public static bool OrderYesterday = false;
|
|
/// <summary>
|
|
/// 店铺名
|
|
/// </summary>
|
|
public static string ShopNameString = "";
|
|
/// <summary>
|
|
/// 店铺网址
|
|
/// </summary>
|
|
public static string ShopUrl = "";
|
|
/// <summary>
|
|
/// 1:正在获取token,2:结束,3:执行,0:空闲
|
|
/// </summary>
|
|
//public static int TbTokenGeting = 0;
|
|
/// <summary>
|
|
/// 代理列表
|
|
/// </summary>
|
|
public static List<string> Proxy = new List<string>();
|
|
/// <summary>
|
|
/// 标题中不能包含的词
|
|
/// </summary>
|
|
public static List<string> CantTitleKeywords = new List<string>();
|
|
/// <summary>
|
|
/// 不能使用的分类
|
|
/// </summary>
|
|
public static List<string> CantCatId = new List<string>();
|
|
/// <summary>
|
|
/// 不能使用的标题
|
|
/// </summary>
|
|
public static List<string> CantTitle = new List<string>();
|
|
/// <summary>
|
|
/// 不能使用的品牌
|
|
/// </summary>
|
|
public static List<string> CantBrand = new List<string>();
|
|
|
|
|
|
public static string HadNoteId = "";
|
|
/// <summary>
|
|
/// 网址正则
|
|
/// </summary>
|
|
public static string LinkRegex = @"<a[\s]+[^>]*href[\s]*=[\s]*[""']{0,1}([^\s^>^""^']*)[^>]*>(.*?)</a>";
|
|
/// <summary>
|
|
/// 网址正则
|
|
/// </summary>
|
|
public static string LinkRegexOut = @"<a[\s]+[^>]*href[\s]*=[\s]*[""']{0,1}(http[s]*://[^\s^>^""^']*)[^>]*>(.*?)</a>";
|
|
/// <summary>
|
|
/// Api对接密码
|
|
/// </summary>
|
|
public static string ApiKeyword = "xiaojun&find_gold_cat";
|
|
/// <summary>
|
|
/// 接口缓存信息
|
|
/// </summary>
|
|
public static string UserAgent = null;
|
|
/// <summary>
|
|
/// 接口缓存信息
|
|
/// </summary>
|
|
public static string ViewCode = null;
|
|
/// <summary>
|
|
/// 百度权重缓存信息
|
|
/// </summary>
|
|
public static string ViewCodex = null;
|
|
/// <summary>
|
|
/// 是否暂停
|
|
/// </summary>
|
|
public static bool IsStop = false;
|
|
/// <summary>
|
|
/// 是否测试
|
|
/// </summary>
|
|
public static bool IsTest = false;
|
|
/// <summary>
|
|
/// 是否正在执行
|
|
/// </summary>
|
|
public static bool IsRunning = false;
|
|
/// <summary>
|
|
/// 权重更新时间
|
|
/// </summary>
|
|
public static int TimeBaiduRank = 0;
|
|
/// <summary>
|
|
/// 排名更新时间
|
|
/// </summary>
|
|
public static int TimeKeywordRank = 0;
|
|
/// <summary>
|
|
/// 时间差
|
|
/// </summary>
|
|
public static int TimeDifferent = 0;
|
|
/// <summary>
|
|
/// 硬件信息
|
|
/// </summary>
|
|
public static string MacInfo = "";
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static string UserName = "";
|
|
/// <summary>
|
|
/// 注册昵称
|
|
/// </summary>
|
|
public static string NickName = "";
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static int UserId = 0;
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static int UserKey = 0;
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static int SiteBuildThreadCount = 0;
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static int UserVersion = 0;
|
|
/// <summary>
|
|
/// 注册用户名
|
|
/// </summary>
|
|
public static string UserVersionString = "";
|
|
/// <summary>
|
|
/// 注册密码
|
|
/// </summary>
|
|
public static string PassWord = "";
|
|
/// <summary>
|
|
/// 间隔时间
|
|
/// </summary>
|
|
public static int WaitTime = 300;
|
|
|
|
/// <summary>
|
|
/// 注册密码
|
|
/// </summary>
|
|
public static string LogPatch = "";
|
|
|
|
|
|
public static bool Remember = false;
|
|
public static bool AutoLogin = false;
|
|
|
|
/// <summary>
|
|
/// 拼多多防滥发
|
|
/// </summary>
|
|
public static bool PreveSpam = false;
|
|
/// <summary>
|
|
/// 获取数据库链接
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
//public static string GetDataString()
|
|
//{
|
|
// if (IsMysqlDataBase)
|
|
// {
|
|
// return "Max Pool Size = 512;Database='" + DataBase + "';Data Source='" + DataIp +
|
|
// "';Port=3306;User Id='" + DataUser + "';Password='" + DataPass + "';Charset=gbk;";
|
|
// }
|
|
// return "server=" + DataIp + ";database=" + DataBase + ";uid=" + DataUser + ";pwd=" + DataPass;
|
|
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 接口程序
|
|
/// </summary>
|
|
public static List<string> ApiList = new List<string>();
|
|
/// <summary>
|
|
/// 国内代理列表
|
|
/// </summary>
|
|
public static List<string> ProxyIn = new List<string>();
|
|
/// <summary>
|
|
/// 美国代理列表
|
|
/// </summary>
|
|
public static List<string> ProxyOut = new List<string>();
|
|
/// <summary>
|
|
/// 美国代理列表
|
|
/// </summary>
|
|
public static List<string> ProxyHttps = new List<string>();
|
|
/// <summary>
|
|
/// 指数代理列表
|
|
/// </summary>
|
|
public static List<string> IpChangeList = new List<string>();
|
|
|
|
/// <summary>
|
|
/// CPU使用率
|
|
/// </summary>
|
|
public static int CpuUser = 0;
|
|
/// <summary>
|
|
/// CPU温度
|
|
/// </summary>
|
|
public static int CpuTemperature = 0;
|
|
/// <summary>
|
|
/// 数据库正在执行线程数
|
|
/// </summary>
|
|
public static int DataUpdateThread = 0;
|
|
|
|
public static string PassWordBak { get; set; }
|
|
public static string Mobile { get; set; }
|
|
public static string ParentAuthority { get; set; }
|
|
public static string ForbiddenPage { get; set; }
|
|
public static string UserAuthority { get; set; }
|
|
public static string ParentUserName { get; set; }
|
|
public static string MainUserName { get { return string.IsNullOrEmpty(ParentUserName) ? UserName : ParentUserName; } }
|
|
public static int SaLevel { get; set; }
|
|
public static bool IsLoginSuccess { get; set; }
|
|
|
|
/// <summary>
|
|
/// CPU使用率更新线程
|
|
/// </summary>
|
|
public static void UpdateCpuThread()
|
|
{
|
|
PerformanceCounter CpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
|
|
int i;
|
|
double all;
|
|
while (true)
|
|
{
|
|
all = 0;
|
|
for (i = 1; i < 6; i++)
|
|
{
|
|
all += CpuCounter.NextValue();
|
|
Thread.Sleep(50);
|
|
}
|
|
CpuUser = (int)all / i;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// DateTime时间格式转换为Unix时间戳格式
|
|
/// </summary>
|
|
/// <param name="time"></param>
|
|
/// <returns></returns>
|
|
public static int ConvertDateTimeInt(DateTime time)
|
|
{
|
|
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
|
return (int)(time - startTime).TotalSeconds;
|
|
}
|
|
|
|
/// <summary>
|
|
/// DateTime时间格式转换为Unix时间戳格式 13位
|
|
/// </summary>
|
|
/// <param name="time"></param>
|
|
/// <returns></returns>
|
|
public static long ConvertDateTimeLong(DateTime time)
|
|
{
|
|
//TimeSpan ts = time - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
|
TimeSpan ts = time - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
|
return Convert.ToInt64(ts.TotalMilliseconds);
|
|
}
|
|
|
|
/// <summary>
|
|
/// C#格式时间转换为Unix时间戳(秒)
|
|
/// </summary>
|
|
/// <param name="time"></param>
|
|
/// <returns></returns>
|
|
public static int DateTimeToTimestampSeconds(DateTime time)
|
|
{
|
|
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
|
return (int)(time - startTime).TotalSeconds;
|
|
}
|
|
|
|
/// <summary>
|
|
/// C#格式时间转换为Unix时间戳(毫秒)
|
|
/// </summary>
|
|
/// <param name="time"></param>
|
|
/// <returns></returns>
|
|
public static long DateTimeToTimestampMilliseconds(DateTime time)
|
|
{
|
|
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
|
return (long)(time - startTime).TotalMilliseconds;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计算字节长度
|
|
/// </summary>
|
|
/// <param name="word"></param>
|
|
/// <returns></returns>
|
|
public static int GetCharLength(string word)
|
|
{
|
|
if (string.IsNullOrEmpty(word))
|
|
return 0;
|
|
return Encoding.GetEncoding("gbk").GetBytes(word).Length;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 时间戳转为C#格式时间
|
|
/// </summary>
|
|
/// <param name="timeStamp"></param>
|
|
/// <returns></returns>
|
|
public static DateTime StampToDateTime(int timeStamp)
|
|
{
|
|
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
|
long lTime = long.Parse(timeStamp + "0000000");
|
|
TimeSpan toNow = new TimeSpan(lTime);
|
|
return dateTimeStart.Add(toNow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 时间戳转为C#格式时间
|
|
/// </summary>
|
|
/// <param name="timeStamp"></param>
|
|
/// <returns></returns>
|
|
public static DateTime StampToDateTimex(long timeStamp)
|
|
{
|
|
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
|
long lTime = long.Parse(timeStamp + "0000");
|
|
TimeSpan toNow = new TimeSpan(lTime);
|
|
return dateTimeStart.Add(toNow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置粘贴板
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public static void SetClipboard(string message)
|
|
{
|
|
try
|
|
{
|
|
Clipboard.SetDataObject(message);
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 获取服务器的精准时间
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static DateTime GetServerTimeString()
|
|
{
|
|
int time = GetTime();
|
|
DateTime t = StampToDateTime(time);
|
|
return t;
|
|
}
|
|
/// <summary>
|
|
/// 获取绝对时间
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetTime()
|
|
{
|
|
return ConvertDateTimeInt(DateTime.Now) + TimeDifferent;
|
|
}
|
|
/// <summary>
|
|
/// 获取绝对时间
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetTime(DateTime t)
|
|
{
|
|
return ConvertDateTimeInt(t) + TimeDifferent;
|
|
}
|
|
/// <summary>
|
|
/// MD5加密
|
|
/// </summary>
|
|
/// <param name="instring"></param>
|
|
/// <returns></returns>
|
|
public static string GetMd5(string instring)
|
|
{
|
|
byte[] result = Encoding.UTF8.GetBytes(instring.Trim());
|
|
MD5 md5 = new MD5CryptoServiceProvider();
|
|
byte[] output = md5.ComputeHash(result);
|
|
return BitConverter.ToString(output).Replace("-", "");
|
|
}
|
|
/// <summary>
|
|
/// MD5加密
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetMd5(byte[] result)
|
|
{
|
|
MD5 md5 = new MD5CryptoServiceProvider();
|
|
byte[] output = md5.ComputeHash(result);
|
|
return BitConverter.ToString(output).Replace("-", "");
|
|
}
|
|
|
|
/// <summary>
|
|
/// MD5加密
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static long GetLong(byte[] result)
|
|
{
|
|
return
|
|
Convert.ToInt64(
|
|
BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(result), 4,
|
|
8).Replace("-", ""), 16);
|
|
}
|
|
|
|
/// <summary>
|
|
/// MD5 16位加密转long
|
|
/// </summary>
|
|
/// <param name="url"></param>
|
|
/// <returns></returns>
|
|
public static long GetLong(string url)
|
|
{
|
|
if (string.IsNullOrEmpty(url))
|
|
return 0;
|
|
return Convert.ToInt64(BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(url)), 4, 8).Replace("-", ""), 16);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取文件MD5值
|
|
/// </summary>
|
|
/// <param name="FilePath"></param>
|
|
/// <returns></returns>
|
|
public static string GetFileMd5(string FilePath)
|
|
{
|
|
try
|
|
{
|
|
FileStream get_file = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
System.Security.Cryptography.MD5CryptoServiceProvider get_md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
|
byte[] hash_byte = get_md5.ComputeHash(get_file);
|
|
string resule = System.BitConverter.ToString(hash_byte);
|
|
resule = resule.Replace("-", "");
|
|
get_file.Close();
|
|
return resule;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 签名算法
|
|
/// </summary>
|
|
/// <param name="s">随机数</param>
|
|
/// <returns>加密签名结果</returns>
|
|
public static string Encryption(int s)
|
|
{
|
|
string ss = s.ToString();
|
|
if (ss.Length > 8)
|
|
{
|
|
ss = ss.Substring(ss.Length - 8);
|
|
s = int.Parse(ss);
|
|
if (s < 100000000)
|
|
s += 100000000;
|
|
}
|
|
byte[] kb = Encoding.ASCII.GetBytes(s.ToString());
|
|
double y = s * 1.8061825125;
|
|
y += 4852095.48659959;
|
|
y += kb[3] * 943579.486548;
|
|
y += kb[7] + 4889894.30184;
|
|
byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
|
y -= 458735.48548;
|
|
y -= k[6] * 458720.454545;
|
|
y -= k[2] * 5447826.96889;
|
|
byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
|
y += 34779810.2455;
|
|
y -= k1[1] * 57942.0564845;
|
|
y -= k1[5] * 1548.487866;
|
|
string c = ((int)y).ToString();
|
|
return GetMd5(c); //返回签名的MD5结果
|
|
}
|
|
/// <summary>
|
|
/// 生成OBJ路径
|
|
/// </summary>
|
|
/// <param name="file"></param>
|
|
/// <returns></returns>
|
|
public static string BuildObjString(string file)
|
|
{
|
|
if (IsJingXi)
|
|
return LoginApiUrl + "index.php?obj=jingxi/" + file;
|
|
if (IsXiaoNaiNiu)
|
|
return LoginApiUrl + "index.php?obj=littlecow/" + file;
|
|
if (IsPinbaobao)
|
|
return LoginApiUrl + "index.php?obj=pinbaobao/" + file;
|
|
if (IsBuyer)
|
|
return LoginApiUrl + "index.php?obj=findgoldcat_buyer/" + file;
|
|
if (IsMainCompany)
|
|
return LoginApiUrl + "index.php?obj=findgoldcat_main/" + file;
|
|
return LoginApiUrl + "index.php?obj=findgoldcat/" + file;
|
|
}
|
|
|
|
public static string DouYinBuildObjString(string file)
|
|
{
|
|
return LoginApiUrl + "index.php?obj=" + BaseClass.MainPath + "/" + file;
|
|
}
|
|
|
|
public static string BuildDefaultObjString(string file, bool IsLoginDef = false)
|
|
{
|
|
return LoginApiUrl + "/" + file + "?obj=" + "/" + file;
|
|
}
|
|
|
|
public static string Build29WxObjString(string file, bool IsLoginDef = false)
|
|
{
|
|
return LoginApiUrl + "/wxxd_" + file + "?obj=" + BaseClass.MainPath + "/wxxd_" + file;
|
|
}
|
|
public static string Build29PDDObjString(string file, bool IsLoginDef = false)
|
|
{
|
|
return LoginApiUrl + "/bxx_" + file + "?obj=" + BaseClass.MainPath + "/bxx_" + file;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回固定字节长度
|
|
/// </summary>
|
|
/// <param name="word"></param>
|
|
/// <param name="len"></param>
|
|
/// <returns></returns>
|
|
public static string SubCharLength(string word, int len)
|
|
{
|
|
if (string.IsNullOrEmpty(word))
|
|
return word;
|
|
word = word.Trim();
|
|
word = word.Replace("..", ".").Replace("..", ".");
|
|
word = word.Replace(" ", " ").Replace(" ", " ");
|
|
if (GetCharLength(word) <= len)
|
|
return word;
|
|
while (GetCharLength(word) > len)
|
|
{
|
|
word = word.Substring(0, word.Length - 1);
|
|
}
|
|
return word;
|
|
}
|
|
}
|
|
|
|
public class KeyValueBase
|
|
{
|
|
public KeyValueBase(string key, string value)
|
|
{
|
|
Key = key;
|
|
Value = value;
|
|
}
|
|
|
|
public string Key;
|
|
public string Value;
|
|
/// <summary>
|
|
/// 店铺ID
|
|
/// </summary>
|
|
public string Id = "";
|
|
public string CatName = "";
|
|
}
|
|
|
|
public class BuyOrderTemp
|
|
{
|
|
public string ShopName;//店铺名称
|
|
public string OrderId;//客户单号
|
|
public string BuyOrderId;//拍单单号
|
|
public string BuyUser;//拍单账户
|
|
public string BuyTime;//拍单账户
|
|
public string PayAccountZFB;//拍单支付宝账户
|
|
}
|
|
|
|
public class KeyValuesBase
|
|
{
|
|
public KeyValuesBase(string key, string value1)
|
|
{
|
|
Key = key;
|
|
Value1 = value1;
|
|
}
|
|
public KeyValuesBase(string key, string value1, string value2, string value3)
|
|
{
|
|
Key = key;
|
|
Value1 = value1;
|
|
Value2 = value2;
|
|
Value3 = value3;
|
|
}
|
|
public KeyValuesBase(string key, string value1, string value2)
|
|
{
|
|
Key = key;
|
|
Value1 = value1;
|
|
Value2 = value2;
|
|
}
|
|
|
|
public string Key;
|
|
public string Value1;
|
|
public string Value2;
|
|
public string Value3;
|
|
|
|
public int Rank = 0;
|
|
}
|
|
|
|
public class CatProudctBase
|
|
{
|
|
public int CatId = 0;
|
|
public Dictionary<long, string> Products = new Dictionary<long, string>();
|
|
}
|
|
|
|
public class MarketProductBase
|
|
{
|
|
public string ProductId = "";
|
|
public string Title = "";
|
|
public string CatIds = "";
|
|
public string Image = "";
|
|
public string CampaignId = "";
|
|
public string Token = "";
|
|
}
|
|
|
|
public class ProcessBase
|
|
{
|
|
public int Min = 0;
|
|
public int Max = 0;
|
|
public int Value = 0;
|
|
}
|
|
|
|
public class ProductBase
|
|
{
|
|
public long Id;
|
|
public long UpId;
|
|
public string Title;
|
|
public string OuterId;
|
|
public decimal Price;
|
|
public bool HadFastCar = false;
|
|
/// <summary>
|
|
/// 需要上传
|
|
/// </summary>
|
|
public bool MustUpdate = false;
|
|
}
|
|
public class ProductCollectBase
|
|
{
|
|
/// <summary>
|
|
/// 更新SKU是否成功
|
|
/// </summary>
|
|
public bool UpdateSuccess = false;
|
|
public long id = 0;
|
|
public int cat_id = 0;
|
|
public int main_cid = 0;
|
|
public string main_cat_name = "";
|
|
public int mall_id = 0;
|
|
public int cat1 = 0;
|
|
public int cat2 = 0;
|
|
public int cat3 = 0;
|
|
public int cat4 = 0;
|
|
public long from_id = 0;
|
|
public int from_shop_id = 0;
|
|
public int from_cat_id = 0;
|
|
public int from_site_id = 0;
|
|
public int item_weight = 1;
|
|
public int saleCount = 0;
|
|
public int num = 0;
|
|
public decimal price = -1;
|
|
public decimal before_price = -1;
|
|
public decimal discount = -1;
|
|
public decimal discountPrice = -1;
|
|
public decimal onlinePrice = -1;
|
|
public decimal market_price = 0;
|
|
public int shopAddPercent = 0;
|
|
public decimal shopAddPriceMin = 0;
|
|
public decimal shopAddPriceMax = 0;
|
|
public string image = "";
|
|
public string image_path = "";
|
|
public string image_from_url = "";
|
|
public string from_name = "";
|
|
public string name = "";
|
|
public string name_share = "";
|
|
public string content_pinduoduo = "";
|
|
public string hd_thumb_url_pinduoduo = "";
|
|
public string thumb_url_pinduoduo = "";
|
|
public int cost_template_id_pinduoduo = 0;
|
|
public string name_shot = "";
|
|
public List<KeyValueBase> Prop = new List<KeyValueBase>();
|
|
public List<PropBase> Props = new List<PropBase>();
|
|
public List<PackBase> Packs = new List<PackBase>();
|
|
public List<SkuMapBase> SkuMaps = new List<SkuMapBase>();
|
|
public List<string> Images = new List<string>();
|
|
public string sell_pt = "";
|
|
public string from_url = "";
|
|
public string from_shop_name = "";
|
|
public string item_size = "";
|
|
public string city = "";
|
|
public string state = "";
|
|
public string content = "";
|
|
public string from = "";
|
|
public string from_title = "";
|
|
public string message = "";
|
|
/// <summary>
|
|
/// 邮费
|
|
/// </summary>
|
|
public decimal express_price = 0;
|
|
public long nameMd5 = 0;
|
|
public long upShopId = 0;
|
|
public ProductCollectBase Clone()
|
|
{
|
|
string html = JsonHelper.SerializeObject(this);
|
|
ProductCollectBase tp = JsonHelper.DeserializeJsonToObject<ProductCollectBase>(html);
|
|
return tp;
|
|
}
|
|
}
|
|
|
|
public class PropBase
|
|
{
|
|
public long id;
|
|
public string name = "";
|
|
public string pinduoduo_name = "";
|
|
public string pinduoduo_id = "";
|
|
public int sort = 0;
|
|
public List<PropValueBase> Values = new List<PropValueBase>();
|
|
}
|
|
|
|
public class PropValueBase
|
|
{
|
|
public string value = "";
|
|
public string name = "";
|
|
public string id = "";
|
|
public string image = "";
|
|
public string image_path = "";
|
|
public string image_from_url = "";
|
|
//public string image_pinduoduo_url = "";
|
|
public int number = 0;
|
|
//public decimal pinduoduo_price = 0;
|
|
public string name_pinduoduo = "";
|
|
}
|
|
|
|
public class PackBase
|
|
{
|
|
public string name = "";
|
|
public string value_count = "";
|
|
public int sort = 0;
|
|
}
|
|
|
|
public class SkuMapBase
|
|
{
|
|
public long id = 0;
|
|
public string name = "";
|
|
public decimal price = 0;
|
|
public decimal before_price = 0;
|
|
public decimal no_group_price = 0;
|
|
public decimal new_price = 0;
|
|
public int number = 0;
|
|
public int sale_count = 0;
|
|
public decimal online_price = 0;
|
|
public string prop_image = "";
|
|
public string pinduoduo_image = "";
|
|
public string size = "";
|
|
public string sizename = "";
|
|
public string spec_pinduoduo = "";
|
|
}
|
|
|
|
public class ReceiveAddress
|
|
{
|
|
public string Provincial;
|
|
|
|
public string City;
|
|
|
|
public string Area;
|
|
}
|
|
}
|