开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 319

TWT20161022/视频学习+在线考试+题库+直播

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (4)
标签 (8)
master
dev
beta
optimize
2.3
2.1.1.21041
2.0.8627
2.0.8499
2.0.8460
2.0.8384
2.0.8355
2.0Beta
master
分支 (4)
标签 (8)
master
dev
beta
optimize
2.3
2.1.1.21041
2.0.8627
2.0.8499
2.0.8460
2.0.8384
2.0.8355
2.0Beta
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (4)
标签 (8)
master
dev
beta
optimize
2.3
2.1.1.21041
2.0.8627
2.0.8499
2.0.8460
2.0.8384
2.0.8355
2.0Beta
Money.cs 15.47 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WeiSha.Core;
using Song.Entities;
using Song.ServiceInterfaces;
using Song.ViewData.Attri;
using Newtonsoft.Json.Linq;
namespace Song.ViewData.Methods
{
/// <summary>
/// 资金流水
/// </summary>
[HttpPut, HttpGet]
public class Money : ViewMethod, IViewAPI
{
#region 增删改查
/// <summary>
/// 根据ID查询资金流水
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Song.Entities.MoneyAccount ForID(int id)
{
return Business.Do<IAccounts>().MoneySingle(id);
}
/// <summary>
/// 增加或减去资金
/// </summary>
/// <param name="acid">学员id</param>
/// <param name="money"></param>
/// <param name="type"></param>
/// <param name="remark"></param>
/// <returns>当前学员的余额</returns>
[HttpPost]
[Admin]
public decimal AddOrSubtract(int acid,double money,int type,string remark)
{
Song.Entities.Accounts st = Business.Do<IAccounts>().AccountsSingle(acid);
if (st == null) throw new Exception("当前信息不存在!");
//操作对象
Song.Entities.MoneyAccount ma = new MoneyAccount();
ma.Ma_Money = (decimal)money;
ma.Ma_Total = st.Ac_Money; //当前资金总数
ma.Ma_Remark = remark;
ma.Ac_ID = acid;
ma.Ma_Source = "系统管理员操作";
//充值方式,管理员充值
ma.Ma_From = 1;
ma.Ma_IsSuccess = true; //充值结果为"成功"
//操作者
Song.Entities.EmpAccount emp = LoginAdmin.Status.User(this.Letter);
try
{
string mobi = !string.IsNullOrWhiteSpace(emp.Acc_MobileTel) && emp.Acc_AccName != emp.Acc_MobileTel ? emp.Acc_MobileTel : "";
//如果是充值
if (type == 2)
{
ma.Ma_Info = string.Format("系统管理员{0}({1}{2})向您充值{3}元", emp.Acc_Name, emp.Acc_AccName, mobi, money);
Business.Do<IAccounts>().MoneyIncome(ma);
}
//如果是转出
if (type == 1)
{
ma.Ma_Info = string.Format("系统管理员{0}({1}{2})扣除您{3}元", emp.Acc_Name, emp.Acc_AccName, mobi, money);
Business.Do<IAccounts>().MoneyPay(ma);
}
st.Ac_Money = ma.Ma_Total;
//刷新登录状态的学员信息
LoginAccount.Status.Fresh(st);
}
catch (Exception ex)
{
throw ex;
}
return ma.Ma_Total;
}
/// <summary>
/// 删除资金流水
/// </summary>
/// <param name="id">可以是多个,用逗号分隔</param>
/// <returns></returns>
[Admin]
[HttpDelete,HttpGet(Ignore =true)]
public int Delete(string id)
{
int i = 0;
if (string.IsNullOrWhiteSpace(id)) return i;
string[] arr = id.Split(',');
foreach (string s in arr)
{
int idval = 0;
int.TryParse(s, out idval);
if (idval == 0) continue;
try
{
Business.Do<IAccounts>().MoneyDelete(idval);
i++;
}
catch (Exception ex)
{
throw ex;
}
}
return i;
}
/// <summary>
/// 学员账户删除资金流水
/// </summary>
/// <param name="id">可以是多个,用逗号分隔</param>
/// <returns></returns>
[Student]
[HttpDelete]
public bool DeleteForAccount(int id)
{
try
{
Business.Do<IAccounts>().MoneyDelete(id);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 确认订单。
/// 充值成功时系统默认会确认订单。偶尔网络原因导致扣款成功,但钱数没有增加时,用这个方法
/// </summary>
/// <param name="serial">流水号</param>
/// <returns></returns>
[HttpPost]
[SuperAdmin]
public bool ConfirmSerial(string serial)
{
try
{
Business.Do<IAccounts>().MoneyConfirm(serial);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 分页获取
/// </summary>
/// <param name="orgid">机构id</param>
/// <param name="type">类型,1支出,2充值</param>
/// <param name="from">来源,1管理员操作,3在线支付,4购买课程</param>
/// <param name="account">学员账号</param>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <param name="serial">流水号</param>
/// <param name="moneymin">查询金额区间,起始金额</param>
/// <param name="moneymax">查询金额区间,最大金额</param>
/// <param name="state">状态,-1为所有,1为成功,2为失败</param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <returns></returns>
public ListResult Pager(int orgid, int type, int from, string account, DateTime? start, DateTime? end, string serial, int moneymin, int moneymax, int state, int size, int index)
{
Song.Entities.Organization org = Business.Do<IOrganization>().OrganCurrent();
int count = 0;
Song.Entities.MoneyAccount[] eas = null;
eas = Business.Do<IAccounts>().MoneyPager(orgid, type, from, account, (DateTime?)start, (DateTime?)end, moneymin, moneymax, serial, state, size, index, out count);
ListResult result = new ListResult(eas);
result.Index = index;
result.Size = size;
result.Total = count;
return result;
}
/// <summary>
/// 分页获取
/// </summary>
/// <param name="acid">学员账号id</param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="type">类型,1支出,2充值</param>
/// <param name="from">来源,1管理员操作,3在线支付,4购买课程</param>
/// <param name="search"></param>
/// <param name="moneymin">查询金额区间,起始金额</param>
/// <param name="moneymax">查询金额区间,最大金额</param>
/// <param name="serial">流水号</param>
/// <param name="state">状态,-1为所有,1为成功,2为失败</param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <returns></returns>
public ListResult PagerForAccount(int acid, int type, int from, DateTime? start, DateTime? end, string search,
int moneymin, int moneymax, string serial, int state, int size, int index)
{
if (acid <= 0)
{
Song.Entities.Accounts acc = this.User;
if (acc != null)
acid = acc.Ac_ID;
}
Song.Entities.Organization org = Business.Do<IOrganization>().OrganCurrent();
int count = 0;
Song.Entities.MoneyAccount[] eas = null;
eas = Business.Do<IAccounts>().MoneyPager(-1, acid, type, from, start, end, search, moneymin, moneymax, serial, state, size, index, out count);
ListResult result = new ListResult(eas);
result.Index = index;
result.Size = size;
result.Total = count;
return result;
}
#endregion
#region 导出
/// <summary>
/// 生成excel
/// </summary>
/// <param name="type">类型,1支出,2充值</param>
/// <param name="from">来源,1管理员操作,3在线支付,4购买课程<</param>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public JObject ExcelOutput(string path,int orgid, int type, int from, DateTime? start, DateTime? end)
{
DateTime dts = start == null ? DateTime.MinValue : (DateTime)start;
DateTime dte = end == null ? DateTime.MaxValue : (DateTime)end;
//导出文件的位置
string rootpath = WeiSha.Core.Upload.Get["Temp"].Physics + path + "\\";
if (orgid > 0) rootpath += orgid.ToString() + "\\";
if (!System.IO.Directory.Exists(rootpath))
System.IO.Directory.CreateDirectory(rootpath);
DateTime date = DateTime.Now;
string filename = string.Format("{0} to {1}.({2}).xls", dts.ToString("yyyy-MM-dd"), dte.ToString("yyyy-MM-dd"), date.ToString("yyyy-MM-dd hh-mm-ss"));
string filePath = rootpath + filename;
filePath = Business.Do<IAccounts>().MoneyRecords4Excel(filePath, orgid, null, type, from, start, end);
JObject jo = new JObject();
jo.Add("file", filename);
jo.Add("url", WeiSha.Core.Upload.Get["Temp"].Virtual + path + "/" + filename);
jo.Add("date", date);
return jo;
}
/// <summary>
/// 生成excel
/// </summary>
/// <param name="type">类型,1支出,2充值</param>
/// <param name="from">来源,1管理员操作,3在线支付,4购买课程<</param>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public JObject ExcelAccountOutput(string path,int orgid,int acid, int type, int from, DateTime? start, DateTime? end)
{
DateTime dts = start == null ? DateTime.MinValue : (DateTime)start;
DateTime dte = end == null ? DateTime.MaxValue : (DateTime)end;
//导出文件的位置
string rootpath = WeiSha.Core.Upload.Get["Temp"].Physics + path + "\\";
if (orgid > 0) rootpath += orgid.ToString() + "\\";
if (!System.IO.Directory.Exists(rootpath))
System.IO.Directory.CreateDirectory(rootpath);
DateTime date = DateTime.Now;
string filename = string.Empty;
if(start!=null || end !=null)
filename=string.Format("{0} to {1}.({2}).xls", dts.ToString("yyyy-MM-dd"), dte.ToString("yyyy-MM-dd"), date.ToString("yyyy-MM-dd hh-mm-ss"));
else
filename = string.Format("{0}.xls", date.ToString("yyyy-MM-dd hh-mm-ss"));
string filePath = rootpath + filename;
//定义这个数组只是为了临时编译通过
int[] acidarr = new int[] { acid };
filePath = Business.Do<IAccounts>().MoneyRecords4Excel(filePath, orgid, acidarr, type, from, start, end);
JObject jo = new JObject();
jo.Add("file", filename);
jo.Add("url", WeiSha.Core.Upload.Get["Temp"].Virtual + path + "/" + filename);
jo.Add("date", date);
return jo;
}
/// <summary>
/// 删除Excel文件
/// </summary>
/// <param name="path">upload/temp下的子级路径</param>
/// <param name="orgid"></param>
/// <param name="filename">文件名,带后缀名,不带路径</param>
/// <returns></returns>
public bool ExcelDelete(string path,int orgid,string filename)
{
string rootpath = WeiSha.Core.Upload.Get["Temp"].Physics + path + "\\";
if (orgid > 0) rootpath += orgid.ToString() + "\\";
if (!System.IO.Directory.Exists(rootpath))
System.IO.Directory.CreateDirectory(rootpath);
string filePath = rootpath + filename;
if (System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
return true;
}
return false;
}
/// <summary>
/// 已经生成的Excel文件
/// </summary>
/// <param name="path">upload/temp下的子级路径</param>
/// <param name="orgid"></param>
/// <returns>file:文件名,url:下载地址,date:创建时间</returns>
public JArray ExcelFiles(string path, int orgid)
{
string rootpath = WeiSha.Core.Upload.Get["Temp"].Physics + path + "\\";
if (orgid > 0) rootpath += orgid.ToString() + "\\";
if (!System.IO.Directory.Exists(rootpath))
System.IO.Directory.CreateDirectory(rootpath);
JArray jarr = new JArray();
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(rootpath);
foreach (System.IO.FileInfo f in dir.GetFiles("*.xls"))
{
JObject jo = new JObject();
jo.Add("file", f.Name);
jo.Add("url", WeiSha.Core.Upload.Get["Temp"].Virtual + path + "/" + f.Name);
jo.Add("date", f.CreationTime);
jo.Add("size", f.Length);
jarr.Add(jo);
}
return jarr;
}
#endregion
#region 统计
/// <summary>
/// 计算资金总额
/// </summary>
/// <param name="orgid">机构id</param>
/// <param name="acid">学员账号id</param>
/// <param name="type">1支出,2收入(包括充值、分润等)</param>
/// <param name="from">类型,来源,1为管理员操作,2为充值码充值;3这在线支付;4购买课程,5分润</param>
/// <param name="start">按时间区间统计,此为开始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public decimal Summary(int orgid, int acid, int type, int from, DateTime? start, DateTime? end)
{
decimal sum = Business.Do<IAccounts>().MoneySum(orgid, acid, type, from, start, end);
return sum;
}
/// <summary>
/// 按日期统计资金
/// </summary>
/// <param name="unit">时间间隔,y:按年统计,m:按月,w:按周,d:按日</param>
/// <param name="orgid">机构id</param>
/// <param name="acid">账号id</param>
/// <param name="type">1支出,2收入(包括充值、分润等)</param>
/// <param name="from">类型,来源,1为管理员操作,2为充值码充值;3这在线支付;4购买课程,5分润</param>
/// <param name="start">时间区间的起始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public JObject Statistics(string unit,int orgid, int acid, int type, int from, DateTime? start, DateTime? end)
{
Dictionary<string, double> dic = Business.Do<IAccounts>().MoneyStatistics(unit, orgid, acid, type, from, start, end);
JObject jo = new JObject();
foreach (KeyValuePair<string, double> item in dic)
{
jo.Add(item.Key, item.Value);
}
return jo;
}
#endregion
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

前后端分离,C#、Vue。web端采用ElementUI,手机端采用VantUI,管理后台采用WebdeskUI。直播、视频学习、试题练习、测试、考试、学习证明、成绩打印,实现"学、练、考"一体。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/wtt2016/LearningSystem.git
git@gitee.com:wtt2016/LearningSystem.git
wtt2016
LearningSystem
视频学习+在线考试+题库+直播
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /