Example #1
0
 public void UploadDishPicture()
 {
     //6b20261afba57226d98b22ae1d93b528jpeg
     var    content   = System.IO.File.ReadAllBytes("i:\\a.jpg");
     var    resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
     string hash      = resturant.UploadDishPicture(1, Token, "test", content);
 }
        public void MapAllDishes()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var dishes  = GetDishes();

            DishMapParameter parameter = new DishMapParameter();

            parameter.Token      = Startup.StoreInfos[1];
            parameter.ErpStoreID = 1;
            int dishindex    = 1;
            int subdishIndex = 1;

            foreach (var dish in dishes)
            {
                var map = new DishMapParameter.DishMapItem()
                {
                    DishId    = dish.DishId,
                    ErpDishId = (dishindex++).ToString()
                };
                parameter.DishMapItems.Add(map);
            }


            meituan.DishMap(parameter);
        }
        public object SetOpentime()
        {
            //SslStream stream = new SslStream();
            var meituan   = ResturantFactory.CreateResturant(platform);
            var opentimes = new List <DayOpenTime>();

            for (int i = 0; i < 7; i++)
            {
                if (i != 5)
                {
                    opentimes.Add(new DayOpenTime()
                    {
                        Times = new List <string>(new string[] { "09:00-12:00", "14:00-19:00" })
                    });
                }
                else
                {
                    opentimes.Add(new DayOpenTime()
                    {
                        Times = null
                    });
                }
            }
            meituan.SetStoreOpenTimes(1, Startup.StoreInfos[1], opentimes);
            Response.ContentType = "application/json";
            return("ok");
        }
        public IActionResult StoreMap()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var url     = meituan.StoreMap(46, 46, "测试门店1");

            return(this.Redirect(url));
        }
        public string UploadDish()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var dish    = new DishInfo()
            {
                BoxNumber    = 1,
                BoxPrice     = 0.1,
                CategoryName = "冷菜",
                DishName     = "测试菜品1",
                ErpDishId    = "100",
                Picture      = "B98DC1B75A27D699176CB5A6CFFC26D0",
                Price        = 10,
                Sequence     = 1,
                Unit         = "份"
            };

            //dish.SubDishes.Add(new SubDishInfo()
            //{
            //    ErpSubDishId = "Sub100",
            //    Price = 10,
            //    Spec = "小份",
            //    Stock = 1
            //});
            meituan.UploadDish(1, Startup.StoreInfos[1], new List <DishInfo>(new DishInfo[] { dish }));
            return("ok");
        }
        public List <DishInfo> GetDishes()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var list    = meituan.GetDishList(1, Startup.StoreInfos[1]);

            Response.ContentType = "application/json";
            return(list);
        }
        public object GetStoreInfo()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var info    = meituan.GetStoreInfo(1, Startup.StoreInfos[1]);

            Response.ContentType = "application/json";
            return(info);
        }
        public object SetStatus(StoreStatus status)
        {
            var meituan = ResturantFactory.CreateResturant(platform);

            meituan.SetStoreStatus(1, Startup.StoreInfos[1], status);
            Response.ContentType = "application/json";
            return("ok");
        }
        public object ShowCallbackUrlSetting()
        {
            var meituan = ResturantFactory.CreateResturant(platform);
            var list    = meituan.ShowCallbackUrlSetting("http://test.xiaohengjiaozi.com");

            Response.ContentType = "application/json";
            return(list);
        }
        public string UploadPic()
        {
            //B98DC1B75A27D699176CB5A6CFFC26D0  对应  i:\\a.jpg
            var content = System.IO.File.ReadAllBytes("i:\\a.jpg");
            var meituan = ResturantFactory.CreateResturant(ResturantPlatformType.Baidu);

            return(meituan.UploadDishPicture(1, Startup.StoreInfos[1], "test.jpg", content));
        }
        public void GetDishList()
        {
            var    resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Meituan);
            var    result    = resturant.GetDishList(erpStoreId, Token);
            string text      = Newtonsoft.Json.JsonConvert.SerializeObject(result);

            System.IO.File.WriteAllText("i:\\dish.txt", text);
        }
Example #12
0
        public void UpdateToken()
        {
            /*
             * 2018/2/24 14:00:14 发现过期token,{"ShopTokenId":6,"ShopId":898,"CurrentToken":"e34ecfe86567bc6e0ed7bb007368ff3f","RefreshToken":"6feadf112824492d0eb64368561ea106","ExpireTime":"2018-02-16T18:30:48.267","PlatformName":"Ele"},准备更新
             * 2018/2/24 14:00:14 发现过期token,{"ShopTokenId":8,"ShopId":897,"CurrentToken":"590dcf731fafb8009bc45181e6a153a0","RefreshToken":"ff559ae01a8b8df241f8abfbc4bcde15","ExpireTime":"2018-02-17T15:40:28.023","PlatformName":"Ele"},准备更新
             */
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);

            var result = resturant.UpdateToken(0, null, "267514cb84c44df1d012dd7f62860118");
        }
Example #13
0
        public void SetStoreOpenTimes()
        {
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
            List <DayOpenTime> dayOpenTimes = new List <DayOpenTime>();

            dayOpenTimes.Add(new DayOpenTime()
            {
                Times = new List <string>(new string[] { "08:00-12:00", "13:00-20:00" })
            });
            resturant.SetStoreOpenTimes(ErpStoreId, Token, dayOpenTimes);
        }
Example #14
0
        public void UpdateDishCategory()
        {
            var resturant       = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
            var updateParameter = new UpdateDishCategoryParameter();

            updateParameter.ErpStoreId           = ErpStoreId;
            updateParameter.CategoryName         = "东北菜";
            updateParameter.OriginalCategoryName = "东北菜";
            updateParameter.Sequence             = 1;
            updateParameter.Token = Token;

            resturant.UpdateDishCategory(updateParameter);
        }
Example #15
0
        public void UploadDish()
        {
            var             resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
            List <DishInfo> dishes    = new List <DishInfo>();
            var             dish      = new DishInfo();

            dish.BoxNumber = 1;
            dish.BoxPrice  = 0.5;
            dish.Attributes.Add(new DishAttribute()
            {
                Name   = "辣度",
                Values = new List <string>(new string[] { "微辣", "中辣", "超辣" }),
            });
            dish.CategoryName = "东北菜";
            dish.DishName     = "东北乱炖";
            dish.ErpDishId    = "Donbeiluandun";
            dish.Picture      = "6b20261afba57226d98b22ae1d93b528jpeg";
            dish.Price        = 28.5;
            dish.Unit         = "份";
            dish.Sequence     = 1;
            dishes.Add(dish);

            dish           = new DishInfo();
            dish.BoxNumber = 1;
            dish.BoxPrice  = 0.5;
            dish.Attributes.Add(new DishAttribute()
            {
                Name   = "辣度",
                Values = new List <string>(new string[] { "微辣", "中辣", "超辣" }),
            });
            dish.CategoryName = "东北菜";
            dish.DishName     = "芹菜粉";
            dish.ErpDishId    = "Qincaifen";
            dish.Picture      = "6b20261afba57226d98b22ae1d93b528jpeg";
            dish.Price        = 16;
            dish.Unit         = "份";
            dish.Sequence     = 0;
            dishes.Add(dish);

            dish.AvailableTimes.Add(new DayOpenTime()
            {
                Times = new List <string>(new string[] { "08:00-12:00", "13:00-19:00" })
            });

            resturant.UploadDish(ErpStoreId, Token, dishes);
        }
Example #16
0
        public void OnReceiveNewOrder(ResturantPlatformType platformType, OrderInfo orderInfo)
        {
            using (Way.Lib.CLog log = new Way.Lib.CLog("新订单"))
            {
                log.LogJson(orderInfo);
            }

            var resturant = ResturantFactory.CreateResturant(platformType);

            //取消订单
            //resturant.CancelOrder(new CancelOrderParameter() {
            //    OrderID = orderInfo.ThirdOrderId,
            //    Reason = CancelOrderReason.Busy,
            //    Token = StoreInfos[orderInfo.ErpStoreID.Value]
            //});


            //确认订单

            ConfirmOrderParameter parameter = new ConfirmOrderParameter();

            parameter.OrderID = orderInfo.ThirdOrderId;
            parameter.Token   = "f8b8211858f6307d24b97e67aa3915e3e5aa78d0dbc7765618fb8485901db153";
            resturant.ConfirmOrder(parameter);

            return;

            //发起配送
            resturant.Delivering(new DeliverParameter()
            {
                CourierName  = "刘培松",
                CourierPhone = "13261952754",
                OrderID      = orderInfo.ThirdOrderId,
                Token        = StoreInfos[orderInfo.ErpStoreID.Value],
            });

            resturant.Delivered(new DeliveredParameter()
            {
                OrderID = orderInfo.ThirdOrderId,
                Token   = StoreInfos[orderInfo.ErpStoreID.Value],
            });
        }
Example #17
0
        public void DishMap()
        {
            int index     = 1;
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
            var dishes    = resturant.GetDishList(1, Token);
            DishMapParameter parameter = new DishMapParameter();

            parameter.ErpStoreID = ErpStoreId;
            parameter.Token      = Token;
            foreach (var dish in dishes)
            {
                parameter.DishMapItems.Add(new DishMapParameter.DishMapItem()
                {
                    DishId    = dish.DishId,
                    ErpDishId = (index++).ToString(),
                });
            }

            resturant.DishMap(parameter);
        }
        public void UploadDish()
        {
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Meituan);
            var dish      = new DishInfo()
            {
                BoxNumber    = 1,
                BoxPrice     = 0.1,
                CategoryName = "冷菜",
                DishName     = "测试菜品1",
                ErpDishId    = "100",
                Picture      = "B98DC1B75A27D699176CB5A6CFFC26D0",
                Price        = 10,
                Sequence     = 1,
                Unit         = "份"
            };

            dish.Skus.Add(new DishSkuInfo()
            {
                Price = 10,
                Spec  = "大份",
                Stock = 100
            });
            dish.Skus.Add(new DishSkuInfo()
            {
                Price = 6,
                Spec  = "小份",
                Stock = 88
            });
            dish.Attributes.Add(new DishAttribute()
            {
                Name   = "辣度",
                Values = new List <string>(new string[] { "微辣", "中辣", "超辣" })
            });

            dish.AvailableTimes.Add(new DayOpenTime()
            {
                Times = new List <string>(new string[] { "08:00-12:00", "13:00-19:00" })
            });
            resturant.UploadDish(erpStoreId, Token, new List <DishInfo>(new DishInfo[] { dish }));
        }
        public string CreateCat()
        {
            string name    = "test";
            var    meituan = ResturantFactory.CreateResturant(platform);

            meituan.CreateDishCategory(new CreateDishCategoryParameter()
            {
                CategoryName = name,
                ErpStoreId   = 1,
                Sequence     = 1,
                Token        = Startup.StoreInfos[1]
            });
            meituan.UpdateDishCategory(new UpdateDishCategoryParameter()
            {
                CategoryName         = name + "2",
                OriginalCategoryName = name,
                ErpStoreId           = 1,
                Sequence             = 1,
                Token = Startup.StoreInfos[1]
            });
            meituan.DeleteDishCategory(1, Startup.StoreInfos[1], name + "2");
            return("ok");
        }
Example #20
0
        public void ArgeeOrderRefund()
        {
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);

            resturant.ArgeeOrderRefund(Token, "3014502384389684272");
        }
Example #21
0
        public void DisargeeOrderRefund()
        {
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);

            resturant.DisargeeOrderRefund(Token, "3014504119514528816", "就是不同意");
        }
Example #22
0
 public void GetStoreInfo()
 {
     var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
     var info      = resturant.GetStoreInfo(ErpStoreId, Token);
 }
Example #23
0
        public void SetStoreStatus()
        {
            var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);

            resturant.SetStoreStatus(ErpStoreId, Token, StoreStatus.Opened);
        }
Example #24
0
 public void StoreMapTest()
 {
     var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
     var url       = resturant.StoreMap(0, 1, "");
 }
Example #25
0
 public void GetDishCategoryList()
 {
     var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Ele);
     var result    = resturant.GetDishCategoryList(ErpStoreId, Token);
 }
 public void QueryOrderServiceMoney()
 {
     var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Meituan);
     var QueryOrderServiceMoney = resturant.GetType().InvokeMember("GetOrderServiceAmount", System.Reflection.BindingFlags.InvokeMethod, null, resturant, new object[] { Token, "8361402627" });
 }
 public void GetDish()
 {
     var resturant = ResturantFactory.CreateResturant(ResturantPlatformType.Meituan);
     var dishes    = resturant.GetDishList(erpStoreId, Token);
     var result    = resturant.GetType().InvokeMember("GetDish", System.Reflection.BindingFlags.InvokeMethod, null, resturant, new object[] { erpStoreId, Token, dishes[0].ErpDishId });
 }