Ejemplo n.º 1
0
        public new string PostRequest()
        {
            if (ReqJson == null)
            {
                if (!this.InitRequestJson())
                {
                    //return null;
                }
            }

            return(AccessWebServerClass.PostData(getUrl(), this.Req_PostData ?? "", Encoding.UTF8));
        }
Ejemplo n.º 2
0
        //public abstract bool InitRequestJson();

        public string PostRequest()
        {
            if (ReqJson == null)
            {
                if (!InitRequestJson())
                {
                    //return null;
                }
            }
            string url = string.Format("{0}", ReqUrl);

            return(AccessWebServerClass.PostData(url, this.Req_PostData, Encoding.UTF8));
        }
Ejemplo n.º 3
0
        void SaveToServer(Dictionary <string, AssetInfoConfig> assets)
        {
            string strReq = "<config  type='AssetUnits'>{0}</config>";

            string[] list     = assets.Select(a => string.Format("{0}", GlobalClass.writeXmlItems(a.Value.getStringDic(), a.Key, a.Value.value))).ToArray();
            string   urlModel = "http://www.wolfinv.com/pk10/app/UpdateUser.asp?";

            string reqAsset = string.Format(strReq, string.Join("", list));
            string encode   = HttpUtility.UrlEncode(reqAsset, Encoding.UTF8);
            string url      = urlModel;
            string strPost  = string.Format("UserId={0}&AssetConfig={1}&dir=1", Program.UserId, encode);
            string succ     = AccessWebServerClass.PostData(url, strPost, Encoding.UTF8);

            if (succ == "succ")
            {
                MessageBox.Show(succ);
            }
        }
Ejemplo n.º 4
0
        public static Dictionary <string, JdGoodSummayInfoItemClass> QueryWeb(string keyWord, int defaultReturnCnt = 10)
        {
            //AccessWebServerClass awc = new AccessWebServerClass();
            Dictionary <string, JdGoodSummayInfoItemClass> ret = new Dictionary <string, JdGoodSummayInfoItemClass>();

            try
            {
                string url = "https://union.jd.com/api/goods/search";

                string strJson = JdUnion_GlbObject.getJsonText("jd.union.search.model");
                if (string.IsNullOrEmpty(strJson))
                {
                    return(ret);
                }
                string strPostData = strJson.Replace("{0}", keyWord);
                string retJson     = AccessWebServerClass.PostData(url, strPostData, Encoding.UTF8);
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                searchReturnData     returnResult         = javaScriptSerializer.Deserialize <searchReturnData>(retJson);
                if (returnResult.code != 200)
                {
                    return(ret);
                }
                List <string> noMatchedList = new List <string>();
                for (int i = 0; i < returnResult.data.unionGoods.Count; i++)
                {
                    string id = returnResult.data.unionGoods[i][0].skuId;
                    JdGoodSummayInfoItemClass ji = new JdGoodSummayInfoItemClass();
                    if (AllcommissionGoods == null)
                    {
                        AllcommissionGoods = new Dictionary <string, JdGoodSummayInfoItemClass>();
                    }
                    if (AllcommissionGoods.ContainsKey(id))
                    {
                        ji = AllcommissionGoods[id];
                        ret.Add(id, ji);
                    }
                    else
                    {
                        if (noMatchedList.Count < defaultReturnCnt)
                        {
                            noMatchedList.Add(id);
                        }
                    }
                }
                List <JdGoodSummayInfoItemClass> res = null;
                if (LoadPromotionGoodsinfo != null)
                {
                    res = LoadPromotionGoodsinfo(noMatchedList);
                }
                else
                {
                    res = getInfoBySukIds(noMatchedList);
                }
                res.ForEach(a =>
                {
                    if (!ret.ContainsKey(a.skuId))
                    {
                        ret.Add(a.skuId, a);
                    }
                });
                return(ret);
            }
            catch (Exception ce)
            {
            }
            return(ret);
        }