public APIResult TestOfx() { var OpenOfx = BaiduMapUtil.GetBdToGd(113.76031219944932, 23.012808108215836); var thirddshopaddmodel = new ThirdShopAddOrderModel() { ShopId = 11, origin_id = DateTime.Now.Ticks + CommonUtil.CreateNoncestr(5),// //shop_no = "11047059",//测试 shop_no = "9896-126130", cargo_type = -1, cargo_price = 10, city_code = "0769", is_prepay = 0, origin_mark = "HCHH", origin_mark_no = DateTime.Now.Ticks + CommonUtil.CreateNoncestr(5), receiver_lng = 113.7538969583704, receiver_lat = 23.00648851131533, receiver_phone = "15812808736", receiver_address = "百安中心", receiver_name = "万", callback = thirdConfig.CallBackUrl, }; var result = DbExtention.ThirdAmountFinish(shopDb, thirdConfig, new BLL.Third.CThirdShopRechargeQueryModel() { ShopId = 11, category = 1 }).Result; var preresult = new ThirdServer(shopDb, thirdConfig).PreThirdAddOrder(thirddshopaddmodel); return(Success()); }
private APIResult CheckThird(ShopOrder shopOrder, int ShopId) { try { if (shopOrder.ShopPartId.HasValue || shopOrder.ShopOrderSelfHelpId.HasValue) { return(Success()); } var shopordertakeoutinfo = shopDb.ShopOrderTakeouts.FirstOrDefault(r => r.ShopOrderId == shopOrder.Id && !r.IsDel); if (shopordertakeoutinfo.TakeWay != TakeWay.送货上门) { return(Success()); } var shoptakeoutinfo = shopDb.ShopTakeOutInfo.FirstOrDefault(r => r.ShopId == ShopId && !r.IsDel); if (shoptakeoutinfo.TakeDistributionType == TakeDistributionType.商家配送) { return(Success()); } var thirdshop = shopDb.ThirdShop.FirstOrDefault(r => r.ShopId == ShopId); if (thirdshop == null || thirdshop.Status != Data.ThirdShop.ShopStatus.门店激活) { return(Error("配送门店状态不正常")); } var converResult = BaiduMapUtil.GetBdToGd(shopordertakeoutinfo.Longitude.Value, shopordertakeoutinfo.Latitude.Value); var thirddshopaddmodel = new ThirdShopAddOrderModel() { ShopId = shopOrder.ShopId, origin_id = shopOrder.OrderNumber, //DateTime.Now.Ticks + CommonUtil.CreateNoncestr(5),// //shop_no = "11047059",//测试 shop_no = thirdshop.OriginShopId, cargo_type = -1, cargo_price = shopOrder.Amount, city_code = "0769", is_prepay = 0, origin_mark = "HCHH", origin_mark_no = shopOrder.OrderNumber, receiver_lng = converResult.x, receiver_lat = converResult.y, receiver_phone = shopordertakeoutinfo.Phone, receiver_address = shopordertakeoutinfo.Address, receiver_name = shopordertakeoutinfo.Name, callback = thirdConfig.CallBackUrl, }; var result = DbExtention.ThirdAmountFinish(shopDb, thirdConfig, new BLL.Third.CThirdShopRechargeQueryModel() { ShopId = shopOrder.ShopId, category = 1 }).Result; var preresult = new ThirdServer(shopDb, thirdConfig).PreThirdAddOrder(thirddshopaddmodel); if (result.result.deliverBalance < preresult.result.fee) { return(Error("商家配送帐号余额不足")); } } catch (Exception ex) { throw new Exception($"出现错误:{ex.Message}{ex.StackTrace}"); } return(Success()); }