开源 企业版 高校版 私有云 模力方舟 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
Message.cs 6.81 KB
一键复制 编辑 原始数据 按行查看 历史
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Song.Entities;
using Song.ServiceInterfaces;
using Song.ViewData.Attri;
using WeiSha.Core;
using System.Data;
namespace Song.ViewData.Methods
{
/// <summary>
/// 课程学习中的咨询留言,可作为弹幕
/// </summary>
[HttpPut, HttpGet,HttpPost]
public class Message : ViewMethod, IViewAPI
{
/// <summary>
/// 添加留言
/// </summary>
/// <param name="acc">学员账号,如果账号为空则默认为当前登录账号</param>
/// <param name="msg">留言信息</param>
/// <param name="playtime">视频播放时间</param>
/// <param name="couid">课程id</param>
/// <param name="olid">章节id</param>
/// <returns></returns>
public Song.Entities.Message Add(string acc,string msg, int playtime, long couid, long olid)
{
Song.Entities.Accounts account = null;
if (!string.IsNullOrWhiteSpace(acc))
{
account = Business.Do<IAccounts>().AccountsSingle(acc, -1);
}
else
{
account = LoginAccount.Status.User();
}
if (account == null) throw new Exception("当前账号不存在");
Song.Entities.Message entity = new Entities.Message();
entity.Msg_Context = msg.Length > 200 ? msg.Substring(0, 200) : msg;
entity.Msg_PlayTime = playtime;
if (couid <= 0)
{
Song.Entities.Outline outline = Business.Do<IOutline>().OutlineSingle(olid);
if (outline != null) couid = outline.Cou_ID;
}
entity.Cou_ID = couid;
entity.Ol_ID = olid;
entity.Ac_ID = account.Ac_ID;
entity.Ac_AccName = account.Ac_AccName;
entity.Ac_Name = account.Ac_Name;
entity.Msg_Phone = string.IsNullOrWhiteSpace(account.Ac_MobiTel1) ? account.Ac_MobiTel2 : account.Ac_MobiTel1;
entity.Msg_QQ = account.Ac_Qq;
entity.Ac_Photo = account.Ac_Photo;
entity.Msg_IP = WeiSha.Core.Browser.IP;
Business.Do<IMessage>().Add(entity);
return entity;
}
/// <summary>
/// 获取章节的所有留言
/// </summary>
/// <param name="olid">章节id</param>
/// <param name="order">排序方式,desc或asc</param>
/// <returns></returns>
public Song.Entities.Message[] All(long olid, string order)
{
return Business.Do<IMessage>().GetAll(olid, order);
}
/// <summary>
/// 获取指定数量的留言
/// </summary>
/// <param name="olid">章节id</param>
/// <param name="order">排序方式,desc或asc</param>
/// <param name="count">取多少条</param>
/// <returns></returns>
[HttpPost]
public Song.Entities.Message[] Count(long olid, string order,int count)
{
return Business.Do<IMessage>().GetCount(-1, olid, order, count);
}
/// <summary>
/// 获取留言数量
/// </summary>
/// <param name="couid">课程id</param>
/// <param name="olid">章节id</param>
/// <returns></returns>
[HttpPost]
public int Count(long couid, long olid)
{
return Business.Do<IMessage>().GetOfCount(couid, olid);
}
/// <summary>
/// 分页获取留言信息
/// </summary>
/// <param name="couid">课程id</param>
/// <param name="olid">章节id</param>
/// <param name="search">检索</param>
/// <param name="size">当页多条记录</param>
/// <param name="index">第几页</param>
/// <returns></returns>
public ListResult Pager(int orgid,long couid, long olid, string search, int size, int index)
{
int count = 0;
Song.Entities.Message[] eas = null;
eas = Business.Do<IMessage>().GetPager(orgid, couid, olid, -1, search, null, null, size, index, out count);
ListResult result = new ListResult(eas);
result.Index = index;
result.Size = size;
result.Total = count;
return result;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="msid">留言id</param>
[Student, Admin, Teacher]
[HttpDelete]
public bool Delete(int msid)
{
try
{
int row=Business.Do<IMessage>().Delete(msid);
return row > 0;
}
catch (Exception exp)
{
throw exp;
}
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Admin, Teacher]
[HttpDelete]
public int DeleteBatch(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<IMessage>().Delete(idval);
i++;
}
catch (Exception ex)
{
throw ex;
}
}
return i;
}
/// <summary>
/// 更新留言内容
/// </summary>
/// <param name="msid">留言id</param>
/// <param name="msg">留言内容</param>
/// <returns></returns>
public bool Update(int msid,string msg)
{
Song.Entities.Message mm = Business.Do<IMessage>().GetSingle(msid);
if (mm == null) throw new Exception("Not found entity for Message!");
mm.Msg_Context = msg;
try
{
Business.Do<IMessage>().Save(mm);
return true;
}
catch (Exception exp)
{
throw exp;
}
}
/// <summary>
/// 修改留言对象
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[Admin, Teacher]
[HttpPost]
public bool Modify(Song.Entities.Message entity)
{
Song.Entities.Message old = Business.Do<IMessage>().GetSingle(entity.Msg_Id);
if (old == null) throw new Exception("Not found entity for Message!");
old.Copy<Song.Entities.Message>(entity);
Business.Do<IMessage>().Save(old);
return true;
}
}
}
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 によって変換されたページ (->オリジナル) /