internal int Insrebateapplylog(Member_channel_rebateApplylog m) { string sql = @"INSERT INTO [Member_channel_rebateApplylog] ( [applytime] ,[applytype] ,[applydetail] ,[applymoney] ,[channelid] ,[operstatus],comid) VALUES ( @applytime ,@applytype ,@applydetail ,@applymoney ,@channelid ,@operstatus,@comid)"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@applytime", m.applytime); cmd.AddParam("@applytype", m.applytype); cmd.AddParam("@applydetail", m.applydetail); cmd.AddParam("@applymoney", m.applymoney); cmd.AddParam("@channelid", m.channelid); cmd.AddParam("@operstatus", m.operstatus); cmd.AddParam("@comid", m.comid); return(cmd.ExecuteNonQuery()); }
public int Insrebateapplylog(Member_channel_rebateApplylog applylog) { using (var helper = new SqlHelper()) { int r = new InternalMember_channel_rebateApplylog(helper).Insrebateapplylog(applylog); return(r); } }
public static string Channelapplyrebate(int channelid, string applytype, string applydetail, decimal applymoney, int comid) { Member_Channel m = new MemberChannelData().GetChannelDetail(channelid); if (m != null) { decimal rebatemoney = m.Rebatemoney; if (rebatemoney < applymoney) { return(JsonConvert.SerializeObject(new { type = 1, msg = "提现金额不可大于账户余额" })); } Member_channel_rebateApplylog applylog = new Member_channel_rebateApplylog { id = 0, applytime = DateTime.Now, applytype = applytype, applydetail = applydetail, applymoney = applymoney, channelid = channelid, operstatus = 0, comid = comid }; int r = new Member_channel_rebateApplylogData().Insrebateapplylog(applylog); if (r > 0) { ////账户提现,返佣表和 渠道表变动 //获得渠道人的返佣余额 decimal channelrebatemoney = new Member_channel_rebatelogData().Getrebatemoney(channelid); //返佣记录 Member_channel_rebatelog rebatelog = new Member_channel_rebatelog { id = 0, channelid = channelid, orderid = 0, payment = 2, payment_type = "返佣提现", proid = "0", proname = applytype + "-" + applydetail, subdatetime = DateTime.Now, ordermoney = 0, rebatemoney = -applymoney, over_money = decimal.Round(channelrebatemoney - applymoney, 2), comid = comid }; //增加返佣记录 同时增加渠道人的返佣金额 new Member_channel_rebatelogData().Editrebatelog(rebatelog); new Member_channel_rebatelogData().Editchannelrebate(rebatelog.channelid, rebatelog.over_money); return(JsonConvert.SerializeObject(new { type = 100, msg = "成功" })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "意外错误" })); } } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "意外错误" })); } }