public async Task DeleteMenuConditional(string appId, string menuConditionalId) { await _wechatAppConfigManager.RegisterWechatApp(appId); try { var result = CommonApi.DeleteMenuConditional(appId, menuConditionalId); } catch (UserFriendlyException e) { throw e; } }
public ActionResult DeleteCustomMenu(string menuId) { try { if (string.IsNullOrEmpty(_wxAccount.AppId) || string.IsNullOrEmpty(_wxAccount.Secret)) { return(Json(new { error = true, message = "AppId或AppSecret为空" }, JsonRequestBehavior.AllowGet)); } var token = AccessTokenContainer.TryGetAccessToken(_wxAccount.AppId, _wxAccount.Secret); var result = string.IsNullOrEmpty(menuId) ? CommonApi.DeleteMenu(token) : CommonApi.DeleteMenuConditional(token, menuId); var json = new { error = result.errmsg != "ok", message = result.errmsg }; return(Json(json, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { var json = new { error = true, message = ex.Message }; return(Json(json, JsonRequestBehavior.AllowGet)); } }