public ActionResult updateMiniAppSaveMoneySetState(int appId, int saveMoneySetId, int State) { XcxAppAccountRelation app = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString()); if (app == null) { return(Json(new { isok = false, msg = "系统繁忙null!" }, JsonRequestBehavior.AllowGet)); } if (dzaccount == null) { return(Json(new { isok = false, msg = "系统繁忙auth_null!" }, JsonRequestBehavior.AllowGet)); } SaveMoneySet saveMoneySet = SaveMoneySetBLL.SingleModel.GetModel(saveMoneySetId); if (saveMoneySet == null) { return(Json(new { isok = false, msg = "系统繁忙saveMoney_null!" }, JsonRequestBehavior.AllowGet)); } saveMoneySet.State = State; if (!SaveMoneySetBLL.SingleModel.Update(saveMoneySet, "State")) { return(Json(new { isok = false, msg = "状态更新失败!" })); } return(Json(new { isok = true, msg = "状态更新成功!" })); }
public ActionResult AddMiniAppSaveMoneySet(int appId, SaveMoneySet model) { XcxAppAccountRelation app = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString()); if (app == null) { return(Json(new { isok = false, msg = "系统繁忙null!" }, JsonRequestBehavior.AllowGet)); } XcxTemplate _tempLate = XcxTemplateBLL.SingleModel.GetModel(app.TId); if (_tempLate == null) { return(Json(new { isok = false, msg = "系统繁忙tempLate_null!" })); } if (_tempLate.Type == (int)TmpType.小程序专业模板) { FunctionList functionList = new FunctionList(); int industr = app.VersionId; functionList = FunctionListBLL.SingleModel.GetModel($"TemplateType={_tempLate.Type} and VersionId={industr}"); if (functionList == null) { return(Json(new { isok = false, msg = "此功能未开启" })); } OperationMgr operationMgr = new OperationMgr(); if (!string.IsNullOrEmpty(functionList.OperationMgr)) { operationMgr = JsonConvert.DeserializeObject <OperationMgr>(functionList.OperationMgr); } if (operationMgr.SaveMoney == 1)//表示关闭了储值使用功能 { return(Json(new { isok = false, msg = "请升级更高版本才能使用此功能!" })); } } if (dzaccount == null) { return(Json(new { isok = false, msg = "系统繁忙auth_null!" }, JsonRequestBehavior.AllowGet)); } if (model.JoinMoney <= 0 || model.JoinMoney > 9999999) { return(Json(new { isok = false, msg = "充值金额请设定0.01 ~ 99999.99!" }, JsonRequestBehavior.AllowGet)); } if (model.GiveMoney < 0 || model.GiveMoney > 9999999) { return(Json(new { isok = false, msg = "赠送金额请设定0.00 ~ 99999.99!" }, JsonRequestBehavior.AllowGet)); } //int resultInt = 0;// List <SaveMoneySet> List = SaveMoneySetBLL.SingleModel.getListByAppId(app.AppId); if (model.Id == 0)//添加 { if (List.Count >= 20) { return(Json(new { isok = false, msg = "目前最多能添加20个储值项目" })); } if (List.Any(m => m.JoinMoney == model.JoinMoney && m.GiveMoney == model.GiveMoney)) { return(Json(new { isok = false, msg = "已存在相同储值项目 , 请重新添加" })); } model.AppId = app.AppId; model.SetName = $"充{model.JoinMoneyStr}送{model.GiveMoneyStr}"; model.AmountMoney = model.JoinMoney + model.GiveMoney; model.CreateDate = DateTime.Now; model.State = 1; object result = SaveMoneySetBLL.SingleModel.Add(model); if (int.Parse(result.ToString()) > 0) { return(Json(new { isok = true, msg = "添加成功!", newid = result }, JsonRequestBehavior.AllowGet)); } } return(Json(new { isok = false, msg = "系统错误!" })); }