开源 企业版 高校版 私有云 模力方舟 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
Point.cs 9.96 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
using Newtonsoft.Json.Linq;
using Song.Entities;
using Song.ServiceInterfaces;
using Song.ViewData.Attri;
using System;
using WeiSha.Core;
namespace Song.ViewData.Methods
{
/// <summary>
/// 学员积分管理
/// </summary>
[HttpPut, HttpGet]
public class Point : ViewMethod, IViewAPI
{
#region 设置项
/// <summary>
/// 设置积分相关项
/// </summary>
/// <param name="letter"></param>
/// <returns></returns>
public bool ParamSetup(Letter letter)
{
try
{
//初次注册,送积分
Business.Do<ISystemPara>().Save("RegFirst", letter["RegFirst"].String);
//登录积分,每天最多多少分
Business.Do<ISystemPara>().Save("LoginPoint", letter["LoginPoint"].String);
Business.Do<ISystemPara>().Save("LoginPointMax", letter["LoginPointMax"].String);
//分享积分,每天最多多少分
Business.Do<ISystemPara>().Save("SharePoint", letter["SharePoint"].String);
Business.Do<ISystemPara>().Save("SharePointMax", letter["SharePointMax"].String);
//注册积分,每天最多多少分
Business.Do<ISystemPara>().Save("RegPoint", letter["RegPoint"].String);
Business.Do<ISystemPara>().Save("RegPointMax", letter["RegPointMax"].String);
//积分与卡券的兑换
Business.Do<ISystemPara>().Save("PointConvert", letter["PointConvert"].String);
//刷新参数
Business.Do<ISystemPara>().Refresh();
return true;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 积分相关设置项
/// </summary>
/// <returns>
/// RegFirst:初次注册,送积分
/// LoginPoint:登录积分
/// LoginPointMax:每天最多多少分
/// SharePoint:分享得积分
/// SharePointMax:每天最多多少分
/// RegPoint:注册积分
/// RegPointMax:每天最多多少分
/// PointConvert:积分兑换卡券的比率
/// </returns>
public JObject Param()
{
JObject dic = new JObject();
//初次注册,送积分
dic.Add("RegFirst", Business.Do<ISystemPara>()["RegFirst"].String);
//登录积分,每天最多多少分
dic.Add("LoginPoint", Business.Do<ISystemPara>()["LoginPoint"].String);
dic.Add("LoginPointMax", Business.Do<ISystemPara>()["LoginPointMax"].String);
//分享积分,每天最多多少分
dic.Add("SharePoint", Business.Do<ISystemPara>()["SharePoint"].String);
dic.Add("SharePointMax", Business.Do<ISystemPara>()["SharePointMax"].String);
//注册积分,每天最多多少分
dic.Add("RegPoint", Business.Do<ISystemPara>()["RegPoint"].String);
dic.Add("RegPointMax", Business.Do<ISystemPara>()["RegPointMax"].String);
//积分与卡券的兑换
dic.Add("PointConvert", Business.Do<ISystemPara>()["PointConvert"].String);
return dic;
}
#endregion 设置项
/// <summary>
/// 积分兑换卡券
/// </summary>
/// <param name="coupon">要兑换的卡券数量</param>
/// <returns></returns>
[Student]
public CouponAccount Exchange(int coupon)
{
Song.Entities.Accounts acc = this.User;
try
{
CouponAccount ca = Business.Do<IAccounts>().CouponExchange(acc, coupon);
//刷新登录状态的学员信息
LoginAccount.Status.Fresh(acc);
return ca;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 分页获取学员的积分详情
/// </summary>
/// <param name="acid">学员id</param>
/// <param name="start">查询区间的起始时间</param>
/// <param name="end">查询区间的结尾时间</param>
/// <param name="type">类型,支出为1,转入2</param>
/// <param name="search">按内容检索</param>
/// <param name="size"></param>
/// <param name="index"></param>
/// <returns></returns>
[Student]
public ListResult PagerForAccount(int acid, DateTime? start, DateTime? end, int type, string search, int size, int index)
{
if (acid <= 0)
{
Song.Entities.Accounts acc = this.User;
if (acc != null)
acid = acc.Ac_ID;
}
int count = 0;
Song.Entities.PointAccount[] details = Business.Do<IAccounts>()
.PointPager(-1, acid, type, search, start, end, size, index, out count);
ListResult result = new ListResult(details);
result.Index = index;
result.Size = size;
result.Total = count;
return result;
}
/// <summary>
/// 获取积分流水项的详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Song.Entities.PointAccount ForID(int id)
{
return Business.Do<IAccounts>().PointSingle(id);
}
/// <summary>
/// 删除单条信息
/// </summary>
/// <param name="id">流水的id</param>
/// <returns></returns>
[Student]
[HttpDelete]
[HttpGet(Ignore = true)]
public bool DeleteSingle(int id)
{
try
{
Business.Do<IAccounts>().PointDelete(id);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
#region 管理员对积分的增减
/// <summary>
/// 由管理给学员增加积分
/// </summary>
/// <param name="acid">学员id</param>
/// <param name="point">要操作的积分数</param>
/// <param name="remark">备注</param>
/// <returns></returns>
[Admin]
[HttpPost]
public bool Raise(int acid, int point, string remark)
{
return _admin_operate(acid, 2, point, remark);
}
/// <summary>
/// 由管理员减去学员积分
/// </summary>
/// <param name="acid">学员id</param>
/// <param name="point">要操作的积分数</param>
/// <param name="remark">备注</param>
/// <returns></returns>
[Admin]
[HttpPost]
public bool Subtract(int acid, int point, string remark)
{
return _admin_operate(acid, 1, point, remark);
}
/// <summary>
/// 管理员操作增减积分
/// </summary>
/// <param name="acid">学员id</param>
/// <param name="type">增加积分为1,减去为1</param>
/// <param name="point">要操作的积分数</param>
/// <param name="remark"></param>
/// <returns></returns>
private bool _admin_operate(int acid, int type, int point, string remark)
{
if (point <= 0) throw new Exception("point必须大于零");
Song.Entities.Accounts st = Business.Do<IAccounts>().AccountsSingle(acid);
if (st == null) throw new Exception("学员账号不存在");
Song.Entities.EmpAccount emp = this.Admin;
//
Song.Entities.PointAccount pa = new PointAccount();
pa.Pa_Value = point;
if (type == 2)
pa.Pa_TotalAmount = st.Ac_Point + point;
if (type == 1)
pa.Pa_TotalAmount = st.Ac_Point - point;
pa.Pa_Remark = remark;
pa.Ac_ID = st.Ac_ID;
pa.Pa_Source = "管理员操作";
//充值方式,管理员充值
pa.Pa_From = 1;
string mobi = !string.IsNullOrWhiteSpace(emp.Acc_MobileTel) && emp.Acc_AccName != emp.Acc_MobileTel ? emp.Acc_MobileTel : "";
try
{
//如果是充值
if (type == 2)
{
pa.Pa_Info = string.Format("管理员{0}({1},{2})向您充值{3}个积分", emp.Acc_Name, emp.Acc_AccName, mobi, point);
Business.Do<IAccounts>().PointAdd(pa);
}
//如果是转出
if (type == 1)
{
pa.Pa_Info = string.Format("管理员{0}({1},{2})扣除您{3}个积分", emp.Acc_Name, emp.Acc_AccName, mobi, point);
Business.Do<IAccounts>().PointPay(pa);
}
st.Ac_Point = pa.Pa_Total;
//刷新登录状态的学员信息
LoginAccount.Status.Fresh(st);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion 管理员对积分的增减
#region 积分赚取
/// <summary>
/// 学员登录时赚取积分
/// </summary>
/// <param name="source">来源,例如:电脑网页、手机网页、微信小程序、</param>
/// <param name="info">登录信息,这里指登录方式,例如:账号密码登录、微信登录、QQ登录</param>
/// <param name="remark">备注:一些说明</param>
/// <returns></returns>
[HttpPost]
public int AddForLogin(string source, string info, string remark)
{
Song.Entities.Accounts st = this.User;
if (st == null) return 1;
Business.Do<IAccounts>().PointAdd4Login(st.Ac_ID, source, info, remark);
//刷新登录状态的学员信息
LoginAccount.Status.Fresh(st);
return 1;
}
#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 によって変換されたページ (->オリジナル) /