public IActionResult FoodList(string zpShopId) { if (string.IsNullOrEmpty(zpShopId)) { return(Content("商家的id不存在")); } //此处获取的是正品的shopId var shopInfo = _meiTConfigService.GetMeiTConfig(zpShopId); if (shopInfo == null) { return(Content("商家的id不能和美团商户匹配")); } var shopId = shopInfo.ShopId; var appId = shopInfo.AppKey; var appSecret = shopInfo.AppSecret; var result = MeiTProduct.ProductList(_httpClientFactory, shopId, appId, appSecret); try { DealShopProduct(result, shopId); return(Content("数据更新成功")); } catch { return(Content("更新数据失败了联系it处理")); } }
public IActionResult BatchUpdateProduct() { var shopList = _meiTConfigService.AllMetTShop(); try { foreach (var meiTConfig in shopList) { var rsult = MeiTProduct.ProductList(_httpClientFactory, meiTConfig.ShopId); DealShopProduct(rsult, meiTConfig.ShopId); } return(Content("更新成功")); } catch (Exception e) { return(Content("更新数据失败了:" + e.Message)); } }