/// <summary> /// 手动添加花币 /// </summary> /// <param name="addModel"></param> /// <returns></returns> public bool AddTipIncome(SysTipIncomeDetailEntity addModel) { var result = false; using (var db = GetSqlSugarDB(DbConnType.QPAnchorRecordDB)) { try { db.Ado.BeginTran(); //新增数据 result = db.Insertable(addModel).ExecuteCommand() > 0; //修改主播代理平台的花币余额 db.Updateable <SysAnchorInfoEntity>().SetColumns(it => new SysAnchorInfoEntity { agentGold = it.agentGold + addModel.AnchorIncome }) .Where(it => it.aid == addModel.AnchorID).ExecuteCommand(); db.Ado.CommitTran(); } catch (Exception ex) { db.Ado.RollbackTran(); new LogLogic().Write(Level.Error, "手动添加花币", ex.Message, ex.StackTrace); } return(result); } }
public ActionResult Form(AddTipDetailModel model) { var anchorModel = new SysUserAnchorLogic().CheckAnchorName(model.anchorName); if (anchorModel == null) { return(Error("主播不存在!")); } var agentModel = new SysAnchorRebateLogic().GetRebateByAccount(anchorModel.id); var addModel = new SysTipIncomeDetailEntity { ShopID = 0, AnchorID = anchorModel.id, AnchorIncome = model.money, StartDate = DateTime.Now, UserID = agentModel == null ? null : agentModel.parentID, TipType = Entity.Enum.TipTypeEnum.其他, IncomeType = Entity.Enum.IncomeTypeEnum.手动添加, CreateTime = DateTime.Now }; var result = sysTipIncomeDetailLogic.AddTipIncome(addModel); return(result ? Success() : Error()); }