예제 #1
0
        static void Main(string[] args)
        {
            //var ai = "b3adb7e5a168e167";
            //var sendingTime = DateTimeToUnixTimestamp(DateTime.Now);
            //Model.Body body = new Model.Body()
            //{
            //    cs1 = "15019400599",
            //    t = "cstm",
            //    tm = sendingTime,
            //    n = "trading",
            //    var = new Model.DataTrading()
            //    {
            //        //tradingId = "test001",
            //        tradingPair = "ETH/VHKD",
            //        //tradingWay_var = "委托买入"
            //    }
            //};
            //List<Body> list = new List<Body>();
            //list.Add(body);
            //var data = JsonConvert.SerializeObject(list);

            //string url = $"https://api.growingio.com/v3/{ai}/s2s/cstm?stm={sendingTime}";


            //var res = HttpCommon.PostWebRequest(url, data);


            string url = "http://193.112.104.103:9222/api/values";
            var    res = HttpCommon.Get(url);


            Console.Read();
        }
예제 #2
0
 public TracingUI()
 {
     InitializeComponent();
     SocketCommon.InitSocket();
     HttpCommon.InitHttp();
     DataContext = new MemoryViewModel();
 }
예제 #3
0
        /// <summary>
        /// 批量更新商品库存
        /// </summary>
        /// <param name="listItem"></param>
        /// <returns></returns>
        public EleResult BatchUpdateStock(string token, Dictionary <long, int> stockMap)
        {
            var        model   = new { stockMap = stockMap };
            SignParams sign    = GetSign(token, model, "eleme.product.item.batchUpdateStock");
            string     content = MakeNopEntity(sign, model);
            string     ret     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(ret));
        }
예제 #4
0
        /// <summary>
        /// 更新菜品
        /// eleme.product.item.updateItem
        ///
        /// </summary>
        public EleResult UpdateItem(string token, dynamic product)
        {
            var        model   = new { itemId = product.itemId, categoryId = product.categoryId, properties = product.properties };
            SignParams sign    = GetSign(token, model, "eleme.product.item.updateItem");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #5
0
        /// <summary>
        /// 查看商品详情
        /// </summary>
        /// <param name="_itemId"></param>
        /// <returns></returns>
        public EleResult GetItem(string token, long itemId)
        {
            var        model   = new { itemId = itemId };
            SignParams sign    = GetSign(token, model, "eleme.product.item.getItem");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #6
0
        /// <summary>
        /// 更新店信息
        /// </summary>
        /// <param name="_shopId"></param>
        /// <param name="pShopInfo"></param>
        /// <returns></returns>
        public EleResult UpdateShop(string token, long _shopId, object obj)
        {
            var        model   = new { shopId = _shopId, properties = obj };
            SignParams sign    = GetSign(token, model, "eleme.shop.updateShop");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #7
0
        /// <summary>
        /// 取商户信息
        /// </summary>
        /// <returns></returns>
        public EleResult GetUser(string token)
        {
            object     obj     = new object();
            SignParams sign    = GetSign(token, obj, "eleme.user.getUser");
            string     content = MakeNopEntity(sign, obj);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #8
0
        /// <summary>
        /// 获取订单
        /// </summary>
        /// <param name="businNo"></param>
        /// <param name="shopNo"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public EleResult GetAllOrders(string token, long shopId, int pageNo, int pageSize, string date)
        {
            var        model   = new { shopId = shopId, pageNo = pageNo, pageSize = pageSize, date = date };
            SignParams sign    = GetSign(token, model, "eleme.order.getAllOrders");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #9
0
        /// <summary>
        /// 批量下架商品
        /// </summary>
        /// <param name="token"></param>
        /// <param name="itemIds"></param>
        /// <returns></returns>
        public EleResult BatchDelistItems(string token, List <long> itemIds)
        {
            var model    = new { itemIds = itemIds };
            var sign     = GetSign(token, model, "eleme.product.item.batchDelistItems");
            var content  = MakeNopEntity(sign, model);
            var response = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(response));
        }
예제 #10
0
        /// <summary>
        /// 取消单_同意退单
        /// </summary>
        /// <param name="_orderId"></param>
        /// <returns></returns>
        public EleResult AgreeRefundLite(string token, string orderId)
        {
            var        model   = new { orderId = orderId };
            SignParams sign    = GetSign(token, model, "eleme.order.agreeRefundLite");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #11
0
        public Result List()
        {
            var model = new
            {
                timestamp    = ToolsCommon.GetTimestamp(),
                app_id       = _waimaiAppId,
                app_poi_code = _shopNo,
            };

            string url = GetUrl("https://waimaiopen.meituan.com/api/v1/food/list", model);
            string res = HttpCommon.Get(url);

            JObject json = JObject.Parse(res);

            if (json["error"] != null)
            {
                return(Tools.ResultErr(json["error"]["msg"].ToString()));
            }

            JArray data = JArray.Parse(json["data"].ToString());

            if (data == null)
            {
                return(Tools.ResultErr());
            }

            var list = new List <object>();

            foreach (var d in data)
            {
                JArray skus = JArray.Parse(d["skus"].ToString());
                foreach (var s in skus)
                {
                    if (d["app_food_code"] != null & s["sku_id"] != null)
                    {
                        if (d["app_food_code"].ToString() != "" && s["sku_id"].ToString() != "")
                        {
                            var prod = new
                            {
                                CateName = d["category_name"],
                                ProdCode = d["app_food_code"],
                                ProdNo   = s["sku_id"],
                                ProdName = d["name"],
                                Spec     = s["spec"],
                                Price    = s["price"],
                                Stock    = s["stock"].ToString() == "" ? "9999" : s["stock"],
                                State    = d["is_sold_out"]
                            };

                            list.Add(prod);
                        }
                    }
                }
            }

            return(Tools.ResultOk(list));
        }
예제 #12
0
        /// <summary>
        ///  查询评价信息
        /// </summary>
        /// <returns></returns>
        public EleResult GetORateResult(string token, long shopId, string startTime, string endTime, int offset, int pageSize)
        {
            var model   = new { shopId, startTime, endTime, offset, pageSize };
            var sign    = GetSign(token, model, "eleme.ugc.getORateResult");
            var content = MakeNopEntity(sign, model);
            var res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #13
0
        /// <summary>
        /// 分页获取店铺下的商品
        /// </summary>
        /// <param name="_shopId"></param>
        /// <returns></returns>
        public EleResult QueryItemByPage(string token, long shopId, long offset = 0, long limit = 300)
        {
            var        model   = new { queryPage = new { limit = limit, offset = offset, shopId = shopId } };
            SignParams sign    = GetSign(token, model, "eleme.product.item.queryItemByPage");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #14
0
        /// <summary>
        /// 统计评价信息数量
        /// </summary>
        /// <returns></returns>
        public EleResult CountORateResult(string token, object rateQuery)
        {
            var model   = new { rateQuery };
            var sign    = GetSign(token, model, "eleme.ugc.countORateResult");
            var content = MakeNopEntity(sign, model);
            var res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #15
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="_orderId"></param>
        /// <param name="_type"></param>
        /// <param name="_remark"></param>
        /// <returns></returns>
        public EleResult CancelOrderLite(string token, string orderId, JObject data)
        {
            var        model   = new { orderId = orderId, type = data["Code"], remark = data["Reason"] };
            SignParams sign    = GetSign(token, model, "eleme.order.cancelOrderLite");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #16
0
        /// <summary>
        /// 获取订单配状态
        /// </summary>
        /// <param name="_orderIds"></param>
        /// <returns></returns>
        public EleResult BatchGetDeliveryStates(string token, string[] orderIds)
        {
            var        model   = new { orderIds = orderIds };
            SignParams sign    = GetSign(token, model, "eleme.order.batchGetDeliveryStates");
            string     content = MakeNopEntity(sign, model);
            string     res     = HttpCommon.Post(EleConfig.API_URL, "application/json;charset=utf-8", null, content);

            return(JsonConvert.DeserializeObject <EleResult>(res));
        }
예제 #17
0
        public Result GetOrderDetail(string orderId)
        {
            var data = new
            {
                timestamp = ToolsCommon.GetTimestamp(),
                app_id    = _waimaiAppId,
                order_id  = orderId
            };

            return(Tools.ResultMt(HttpCommon.Get(this.GetUrl("https://waimaiopen.meituan.com/api/v1/order/getOrderDetail", data))));
        }
예제 #18
0
        public void ExecutionCode(object source, System.Timers.ElapsedEventArgs e)
        {
            string      url   = host + "/cp/loadDrawHistory.do?siteCode=HELSSC1&noOfD=4";
            DrawHistory data1 = null;

            try
            {
                string result = HttpCommon.HttpGet(url);
                data1 = JsonConvert.DeserializeObject <DrawHistory>(result);
            }
            catch (Exception)
            {
                data1 = null;
            }
            if (data1 != null)
            {
                List <Message> Messagelist = JsonConvert.DeserializeObject <List <Message> >(data1.Message);
                DataTable      dt          = caifenfen.GetLast();
                int            last_n      = 0;
                if (dt.Rows.Count > 0)
                {
                    last_n = Convert.ToInt32(dt.Rows[0]["n"]);
                }

                foreach (Message m in Messagelist)
                {
                    int n = Convert.ToInt32(m.n);
                    if (n <= last_n)
                    {
                        continue;
                    }
                    string[] d = m.r.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string   r = m.r;

                    Array.Sort(d);
                    string[] a  = d.Distinct().ToArray();
                    string   sn = string.Join("", a);

                    int wan  = Convert.ToInt32(d[0]);
                    int qian = Convert.ToInt32(d[1]);
                    int bai  = Convert.ToInt32(d[2]);
                    int shi  = Convert.ToInt32(d[3]);
                    int ge   = Convert.ToInt32(d[4]);
                    try
                    {
                        caifenfen.Insert(n, r, wan, qian, bai, shi, ge, sn);
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
        }
예제 #19
0
        public ActionResult SaveForm(string keyValue, WfConditionEntity entity)
        {
            string flowcode = "bosafety";

            if (!string.IsNullOrEmpty(entity.SQLCONTENT))
            {
                entity.SQLCONTENT = HttpCommon.Decrypt(entity.SQLCONTENT.ToUpper(), flowcode, flowcode);
                entity.SQLCONTENT = HttpUtility.UrlDecode(entity.SQLCONTENT);
            }
            wfconditionbll.SaveForm(keyValue, entity);
            return(Success("操作成功。"));
        }
예제 #20
0
        public IEnumerable <dynamic> GetMtFoods(Mt_AccountDTO account, string shopNo)
        {
            var model = new JObject()
            {
                { "timestamp", ToolsCommon.GetTimestamp() },
                { "app_id", account.WaimaiAppId },
                { "app_poi_code", shopNo }
            };

            var url = GetUrl(account.WaimaiAppSecret, "https://waimaiopen.meituan.com/api/v1/food/list", model);
            var res = HttpCommon.Get(url);

            var json = JObject.Parse(res);

            if (json["error"] != null)
            {
                return(new List <dynamic>());
            }

            var data = JArray.Parse(json["data"].ToString());

            var list = new List <dynamic>();

            foreach (var d in data)
            {
                var skus = JArray.Parse(d["skus"].ToString());
                foreach (var s in skus)
                {
                    if (d["app_food_code"] != null & s["sku_id"] != null)
                    {
                        if (d["app_food_code"].ToString() != "" && s["sku_id"].ToString() != "")
                        {
                            var prod = new
                            {
                                CateName = d["category_name"],
                                ProdCode = d["app_food_code"],
                                ProdNo   = s["sku_id"],
                                ProdName = d["name"],
                                Spec     = s["spec"],
                                Price    = s["price"],
                                Stock    = s["stock"].ToString() == "" ? "9999" : s["stock"],
                                State    = d["is_sold_out"]
                            };

                            list.Add(prod);
                        }
                    }
                }
            }

            return(list);
        }
예제 #21
0
        public Result Cancel(JObject data)
        {
            string msgErr = "";
            string msgSuc = "";

            string[] codes = data["Codes"].ToString().Trim(',').Split(',');

            for (int i = 0; i < codes.Length; i++)
            {
                try
                {
                    var model = new
                    {
                        vendorShopId = _shopNo,
                        couponCode   = codes[i].ToString(),
                        eId          = data["OperNo"],
                        eName        = data["OperName"],
                    };

                    string url = GetUrl("https://open-api.dianping.com/tuangou/coupon/cancel", model);

                    var res = HttpCommon.Post(url, model);

                    JObject json = JObject.Parse(res);
                    if (json["code"].ToString() == "200")
                    {
                        msgSuc += "成功" + "@";
                    }
                    else
                    {
                        msgSuc += "成功" + json["msg"] + "@";
                    }
                }
                catch (Exception e)
                {
                    msgErr = e.Message;
                    break;
                }
            }

            if (msgErr != "")
            {
                return(Tools.ResultErr(msgErr));
            }
            else
            {
                return(new Result()
                {
                    State = "OK", Msg = msgSuc
                });
            }
        }
예제 #22
0
        public Result Confirm(string orderID)
        {
            var model = new
            {
                timestamp = ToolsCommon.GetTimestamp(),
                app_id    = _waimaiAppId,
                order_id  = orderID,
            };

            string url = GetUrl("https://waimaiopen.meituan.com/api/v1/order/confirm", model);

            return(Tools.ResultMt(HttpCommon.Get(url)));
        }
예제 #23
0
        public Result GetOrderIdByDaySeq(DateTime datetime, int daySeq)
        {
            var data = new
            {
                timestamp    = ToolsCommon.GetTimestamp(),
                app_id       = this._waimaiAppId,
                app_poi_code = this._shopNo,
                date_time    = datetime.ToString("yyyyMMdd"),
                day_seq      = daySeq
            };

            return(Tools.ResultMt(HttpCommon.Get(this.GetUrl("https://waimaiopen.meituan.com/api/v1/order/getOrderIdByDaySeq", (object)data))));
        }
예제 #24
0
        public Result RefundReject(string orderID, JObject data)
        {
            var model = new
            {
                timestamp = ToolsCommon.GetTimestamp(),
                app_id    = _waimaiAppId,
                order_id  = orderID,
                reason    = data["Reason"]
            };

            string url = GetUrl("https://waimaiopen.meituan.com/api/v1/order/refund/reject", model);

            return(Tools.ResultMt(HttpCommon.Get(url)));
        }
예제 #25
0
        /// <summary>
        /// »ñÈ¡ÅäËͶ©µ¥×´Ì¬
        /// </summary>
        /// <param name="orderID"></param>
        /// <returns></returns>
        public Result GetLogisticsStatus(string orderID)
        {
            var model = new
            {
                timestamp       = ToolsCommon.GetTimestamp(),
                app_id          = _waimaiAppId,
                order_id        = orderID,
                is_mt_logistics = 1
            };

            string url = GetUrl("https://waimaiopen.meituan.com/api/v1/order/logistics/status", model);

            return(Tools.ResultMt(HttpCommon.Get(url)));
        }
예제 #26
0
        /// <summary>
        /// 刷新饿了么访问令牌
        /// </summary>
        /// <returns></returns>
        public string RefreshToken(string token)
        {
            //1.拼接key && Secret
            string merger = EleConfig.APP_KEY + ":" + EleConfig.APP_SECRET;
            //2.Base64编码
            string strBase64 = ToolsCommon.ToBase64(merger);
            //构建header
            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers.Add("Authorization", "Basic " + strBase64);

            string content = "grant_type=refresh_token&refresh_token=" + token;
            string res     = HttpCommon.Post(EleConfig.TOKEN_URL, "application/json;charset=utf-8", headers, content);

            return(res);
        }
예제 #27
0
        /// <summary>
        /// 获取饿了么访问令牌
        /// </summary>
        /// <returns></returns>
        public string GetToken(string code)
        {
            //1.拼接key && Secret
            string merger = EleConfig.APP_KEY + ":" + EleConfig.APP_SECRET;
            //2.Base64编码
            string strBase64 = ToolsCommon.ToBase64(merger);
            //构建header
            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers.Add("Authorization", "Basic " + strBase64);

            string content = "grant_type=authorization_code&code=" + code + "&redirect_uri=" + EleConfig.REDIRECT_URL + "&client_id=" + EleConfig.APP_KEY;
            string res     = HttpCommon.Post(EleConfig.TOKEN_URL, "application/json;charset=utf-8", headers, content);

            return(res);
        }
예제 #28
0
        public void MtUpdateStock(Mt_AccountDTO account, string shopNo, IEnumerable <StockModel> data)
        {
            var num1 = data.Count();
            var size = 50;
            var num2 = size;
            var num3 = (num1 + num2 - 1) / size;
            var msg  = "";

            for (var index = 0; index < num3; ++index)
            {
                var source       = data.Skip(index * size).Take(size);
                var foodDataList = new List <FoodData>();
                foreach (var grouping in source.GroupBy(a => a["ProdCode"]))
                {
                    var code     = grouping;
                    var foodData = new FoodData()
                    {
                        app_food_code = code.Key.ToString()
                    };
                    var tokens  = source.Where(a => a["ProdCode"] == code.Key);
                    var skuList = new List <Sku>();
                    foreach (var jtoken in tokens)
                    {
                        skuList.Add(new Sku()
                        {
                            sku_id = jtoken["ProdNo"]?.ToString(),
                            stock  = jtoken["Stock"]?.ToString()
                        });
                    }
                    foodData.skus = skuList;
                    foodDataList.Add(foodData);
                }
                var model = new JObject()
                {
                    { "timestamp", ToolsCommon.GetTimestamp().ToString() },
                    { "app_id", account.WaimaiAppId },
                    { "app_poi_code", shopNo },
                    { "food_data", JsonConvert.SerializeObject(foodDataList) }
                };

                var url = GetUrl(account.WaimaiAppSecret, "https://waimaiopen.meituan.com/api/v1/food/sku/stock", model);
                model.Remove("timestamp");
                model.Remove("app_id");

                var response = HttpCommon.PostJObject(url, model);
            }
        }
예제 #29
0
        public Result Consume(JObject data)
        {
            string msg = "";

            string[] codes = data["Codes"].ToString().Trim(',').Split(',');

            for (int i = 0; i < codes.Length; i++)
            {
                try
                {
                    var model = new
                    {
                        vendorShopId  = _shopNo,
                        couponCode    = codes[i].ToString(),
                        count         = 1,
                        eId           = data["OperNo"],
                        eName         = data["OperName"],
                        vendorOrderId = data["OrderID"]
                    };

                    string url = GetUrl("https://open-api.dianping.com/tuangou/coupon/consume", model);

                    var res = HttpCommon.Post(url, model);

                    JObject json = JObject.Parse(res);
                    if (json["code"].ToString() != "200")
                    {
                        msg += json["msg"];
                        break;
                    }
                }
                catch (Exception e)
                {
                    msg = e.Message;
                    break;
                }
            }

            if (msg != "")
            {
                return(Tools.ResultErr(msg));
            }
            else
            {
                return(Tools.ResultOk());
            }
        }
예제 #30
0
        public async Task <IEnumerable <StockModel> > MtFoods(string waimaiAppId, string waimaiAppSecret, string shopNo)
        {
            var model = new JObject()
            {
                { "timestamp", ToolsCommon.GetTimestamp() },
                { "app_id", waimaiAppId },
                { "app_poi_code", shopNo }
            };

            var url = GetUrl(waimaiAppSecret, "https://waimaiopen.meituan.com/api/v1/food/list", model);
            var res = HttpCommon.Get(url);

            var json = JObject.Parse(res);

            if (json["error"] != null)
            {
                return(new List <StockModel>());
            }

            var data = JArray.Parse(json["data"].ToString());

            var list = new List <StockModel>();

            foreach (var d in data)
            {
                var skus = JArray.Parse(d["skus"].ToString());
                foreach (var s in skus)
                {
                    if (d["app_food_code"] != null & s["sku_id"] != null)
                    {
                        if (d["app_food_code"].ToString() != "" && s["sku_id"].ToString() != "")
                        {
                            var prod = new StockModel()
                            {
                                ProdCode = d["app_food_code"].ToString(),
                                ProdNo   = s["sku_id"].ToString(),
                            };

                            list.Add(prod);
                        }
                    }
                }
            }

            return(list);
        }