Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
e1c1ef13
Commit
e1c1ef13
authored
Oct 12, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的学习
parent
a90a5f27
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
562 additions
and
3 deletions
+562
-3
RB_Goods_WK_DownLoad.cs
Mall.Model/Entity/Product/RB_Goods_WK_DownLoad.cs
+84
-0
RB_Goods_WK_Course_Extend.cs
Mall.Model/Extend/Product/RB_Goods_WK_Course_Extend.cs
+16
-0
RB_Goods_WK_DownLoad_Extend.cs
Mall.Model/Extend/Product/RB_Goods_WK_DownLoad_Extend.cs
+25
-0
EducationModule.cs
Mall.Module.Education/EducationModule.cs
+144
-1
OrderModule_Part.cs
Mall.Module.Product/OrderModule_Part.cs
+2
-2
RB_Goods_WK_CourseRepository.cs
Mall.Repository/Product/RB_Goods_WK_CourseRepository.cs
+79
-0
RB_Goods_WK_DownLoadRepository.cs
Mall.Repository/Product/RB_Goods_WK_DownLoadRepository.cs
+49
-0
AppletEducationController.cs
...WebApi/Controllers/Education/AppletEducationController.cs
+163
-0
No files found.
Mall.Model/Entity/Product/RB_Goods_WK_DownLoad.cs
0 → 100644
View file @
e1c1ef13
using
VT.FW.DB
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Common.Enum.Goods
;
namespace
Mall.Model.Entity.Product
{
/// <summary>
/// 课程下载表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_WK_DownLoad
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 课程id
/// </summary>
public
int
GoodsId
{
get
;
set
;
}
/// <summary>
/// 章节id
/// </summary>
public
int
CourseId
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
UserId
{
get
;
set
;
}
/// <summary>
/// 文件下载地址
/// </summary>
public
string
FilePath
{
get
;
set
;
}
/// <summary>
/// 附件类型 枚举
/// </summary>
public
GoodsCourseTypeEnum
?
FileType
{
get
;
set
;
}
/// <summary>
/// 文件大小
/// </summary>
public
decimal
Size
{
get
;
set
;
}
/// <summary>
/// 单位
/// </summary>
public
string
Unit
{
get
;
set
;
}
/// <summary>
/// 文件状态 1下载中 2下载成功 3下载失败
/// </summary>
public
int
FileState
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// UpdateDate
/// </summary>
public
DateTime
?
UpdateDate
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_WK_Course_Extend.cs
View file @
e1c1ef13
...
...
@@ -21,6 +21,22 @@ namespace Mall.Model.Extend.Product
/// 是否已阅读 1是 2否
/// </summary>
public
int
IsRead
{
get
;
set
;
}
/// <summary>
/// 缓存状态
/// </summary>
public
int
FileState
{
get
;
set
;
}
/// <summary>
/// 大小
/// </summary>
public
decimal
Size
{
get
;
set
;
}
/// <summary>
/// 单位
/// </summary>
public
string
Unit
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
UserId
{
get
;
set
;
}
}
/// <summary>
...
...
Mall.Model/Extend/Product/RB_Goods_WK_DownLoad_Extend.cs
0 → 100644
View file @
e1c1ef13
using
VT.FW.DB
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
namespace
Mall.Model.Extend.Product
{
/// <summary>
/// 课程下载扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_WK_DownLoad_Extend
:
RB_Goods_WK_DownLoad
{
/// <summary>
/// 商品ids
/// </summary>
public
string
GoodsIds
{
get
;
set
;
}
/// <summary>
/// 课程章节ids
/// </summary>
public
string
CourseIds
{
get
;
set
;
}
}
}
Mall.Module.Education/EducationModule.cs
View file @
e1c1ef13
using
Mall.Common.Models
;
using
Mall.Common.API
;
using
Mall.Common.Models
;
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.Education
;
using
Mall.Model.Entity.Product
;
...
...
@@ -122,6 +123,10 @@ namespace Mall.Module.Education
/// 网课学习时间
/// </summary>
private
readonly
RB_Goods_WK_StudyTimeRepository
goods_WK_StudyTimeRepository
=
new
RB_Goods_WK_StudyTimeRepository
();
/// <summary>
/// 课程下载
/// </summary>
private
readonly
RB_Goods_WK_DownLoadRepository
goods_WK_DownLoadRepository
=
new
RB_Goods_WK_DownLoadRepository
();
...
...
@@ -1519,6 +1524,144 @@ namespace Mall.Module.Education
SurplusNum
=
x
.
WatchNum
});
}
/// <summary>
/// 获取未缓存小程序课程章节列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="goodsId"></param>
/// <param name="courseName"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
List
<
RB_Goods_WK_Course_Extend
>
GetMyCourseNoCachePageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
int
goodsId
,
string
courseName
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
var
list
=
goods_WK_CourseRepository
.
GetMyCourseNoCachePageList
(
pageIndex
,
pageSize
,
out
count
,
new
RB_Goods_WK_Course_Extend
()
{
GoodsId
=
goodsId
,
Name
=
courseName
,
UserId
=
userId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
return
list
;
}
/// <summary>
/// 获取已缓存小程序章节列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="goodsId"></param>
/// <param name="courseName"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
List
<
RB_Goods_WK_Course_Extend
>
GetMyCourseCachedPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
int
goodsId
,
string
courseName
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
var
list
=
goods_WK_CourseRepository
.
GetMyCourseCachedPageList
(
pageIndex
,
pageSize
,
out
count
,
new
RB_Goods_WK_Course_Extend
()
{
GoodsId
=
goodsId
,
Name
=
courseName
,
UserId
=
userId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
return
list
;
}
/// <summary>
/// 设置缓存
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
ApiResult
SetMyCourseCache
(
RB_Goods_WK_DownLoad_Extend
demodel
)
{
//验证一下 是否已有记录
var
dmodel
=
goods_WK_DownLoadRepository
.
GetList
(
new
RB_Goods_WK_DownLoad_Extend
()
{
UserId
=
demodel
.
UserId
,
CourseId
=
demodel
.
CourseId
}).
FirstOrDefault
();
if
(
dmodel
==
null
)
{
//插入
bool
flag
=
goods_WK_DownLoadRepository
.
Insert
(
new
RB_Goods_WK_DownLoad
()
{
Id
=
0
,
UserId
=
demodel
.
UserId
,
CourseId
=
demodel
.
CourseId
,
CreateDate
=
DateTime
.
Now
,
FilePath
=
demodel
.
FilePath
,
FileState
=
1
,
FileType
=
demodel
.
FileType
,
GoodsId
=
demodel
.
GoodsId
,
Size
=
demodel
.
Size
,
Unit
=
demodel
.
Unit
,
UpdateDate
=
DateTime
.
Now
})
>
0
;
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
else
{
if
(
dmodel
.
FileState
==
3
)
{
//更新 失败的直接重新更新
dmodel
.
FilePath
=
demodel
.
FilePath
;
dmodel
.
FileState
=
1
;
dmodel
.
FileType
=
demodel
.
FileType
;
dmodel
.
Size
=
demodel
.
Size
;
dmodel
.
Unit
=
demodel
.
Unit
;
dmodel
.
UpdateDate
=
DateTime
.
Now
;
bool
flag
=
goods_WK_DownLoadRepository
.
Update
(
dmodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
else
{
return
ApiResult
.
Failed
(
"已存在下载,请删除后再试"
);
}
}
}
/// <summary>
/// 设置缓存状态
/// </summary>
/// <param name="courseId"></param>
/// <param name="userId"></param>
/// <param name="fileState"></param>
/// <returns></returns>
public
bool
SetMyCourseCacheState
(
int
courseId
,
int
userId
,
int
fileState
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_WK_DownLoad
.
FileState
),
fileState
},
{
nameof
(
RB_Goods_WK_DownLoad
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_WK_DownLoad
.
CourseId
),
FiledValue
=
courseId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_WK_DownLoad
.
UserId
),
FiledValue
=
userId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
goods_WK_DownLoadRepository
.
Update
(
keyValues
,
wheres
);
}
/// <summary>
/// 删除缓存
/// </summary>
/// <param name="courseIds"></param>
/// <param name="userId"></param>
/// <returns></returns>
public
bool
DelMyCourseCache
(
string
courseIds
,
int
userId
)
{
var
list
=
goods_WK_DownLoadRepository
.
GetList
(
new
RB_Goods_WK_DownLoad_Extend
()
{
CourseIds
=
courseIds
,
UserId
=
userId
});
foreach
(
var
item
in
list
)
{
goods_WK_DownLoadRepository
.
Delete
(
item
);
}
return
true
;
}
#
endregion
#
region
教师管理
...
...
Mall.Module.Product/OrderModule_Part.cs
View file @
e1c1ef13
...
...
@@ -97,7 +97,7 @@ namespace Mall.Module.Product
if
(
demodel
.
DetailList
.
Any
())
{
string
GoodsIds
=
string
.
Join
(
","
,
demodel
.
DetailList
.
Select
(
x
=>
x
.
GoodsId
));
var
gList
=
goodsRepository
.
Get
List
(
new
RB_Goods_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}
);
var
gList
=
goodsRepository
.
Get
SingleList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
},
true
);
var
clist
=
goods_CategoryRepository
.
GetList
(
new
RB_Goods_Category_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
mpriceList
=
goods_MemberPriceRepository
.
GetList
(
new
RB_Goods_MemberPrice_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
...
...
@@ -853,7 +853,7 @@ namespace Mall.Module.Product
integralModel
=
integral_SettingsRepository
.
GetIntegralSettingsList
(
new
Model
.
Entity
.
MarketingCenter
.
RB_Integral_Settings
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
}
GoodsIds
=
string
.
Join
(
","
,
demodel
.
DetailList
.
Select
(
x
=>
x
.
GoodsId
));
var
gList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}
);
var
gList
=
goodsRepository
.
GetList
ForCommission
(
new
RB_Goods_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
},
2
);
var
clist
=
goods_CategoryRepository
.
GetList
(
new
RB_Goods_Category_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
mpriceList
=
goods_MemberPriceRepository
.
GetList
(
new
RB_Goods_MemberPrice_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
...
...
Mall.Repository/Product/RB_Goods_WK_CourseRepository.cs
View file @
e1c1ef13
...
...
@@ -77,6 +77,85 @@ WHERE {where} ORDER BY gc.Sort asc ";
string
sql
=
$@"
SELECT gc.* FROM RB_Goods_WK_Course gc
WHERE
{
where
}
ORDER BY gc.Sort asc "
;
return
GetPage
<
RB_Goods_WK_Course_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 未缓存列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_WK_Course_Extend
>
GetMyCourseNoCachePageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_WK_Course_Extend
dmodel
)
{
string
where
=
$" 1=1 and gc.
{
nameof
(
RB_Goods_WK_Course
.
Status
)}
=0 and gc.IsCache =1 and d.Id is null"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsIds
))
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_Category
.
GoodsId
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
string
sql
=
$@"
SELECT gc.* FROM RB_Goods_WK_Course gc
left join rb_goods_wk_download d on gc.Id=d.CourseId and d.FileState <> 3 and d.UserId=
{
dmodel
.
UserId
}
WHERE
{
where
}
ORDER BY gc.Sort asc "
;
return
GetPage
<
RB_Goods_WK_Course_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 已缓存列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_WK_Course_Extend
>
GetMyCourseCachedPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_WK_Course_Extend
dmodel
)
{
string
where
=
$" 1=1 and gc.
{
nameof
(
RB_Goods_WK_Course
.
Status
)}
=0 and gc.IsCache =1 and d.UserId=
{
dmodel
.
UserId
}
"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_Course
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsIds
))
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_Category
.
GoodsId
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
string
sql
=
$@"
SELECT gc.Id,gc.Sort,gc.SortName,gc.Name,gc.GoodsId,d.FileState,d.FileType as Type,d.FilePath,d.Size,d.Unit FROM RB_Goods_WK_Course gc
inner join rb_goods_wk_download d on gc.Id=d.CourseId
WHERE
{
where
}
ORDER BY gc.Sort asc "
;
return
GetPage
<
RB_Goods_WK_Course_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
...
...
Mall.Repository/Product/RB_Goods_WK_DownLoadRepository.cs
0 → 100644
View file @
e1c1ef13
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
using
Mall.Model.Extend.Product
;
using
System.Linq
;
namespace
Mall.Repository.Product
{
/// <summary>
/// 课程下载仓储层
/// </summary>
public
class
RB_Goods_WK_DownLoadRepository
:
BaseRepository
<
RB_Goods_WK_DownLoad
>
{
/// <summary>
/// 列表
/// </summary>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Goods_WK_DownLoad_Extend
>
GetList
(
RB_Goods_WK_DownLoad_Extend
dmodel
)
{
string
where
=
$" 1=1"
;
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
if
(
dmodel
.
CourseId
>
0
)
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
CourseId
)}
=
{
dmodel
.
CourseId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsIds
))
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
GoodsId
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CourseIds
))
{
where
+=
$@" and gc.
{
nameof
(
RB_Goods_WK_DownLoad
.
CourseId
)}
in(
{
dmodel
.
CourseIds
}
)"
;
}
string
sql
=
$@"
SELECT gc.* FROM RB_Goods_WK_DownLoad gc
WHERE
{
where
}
ORDER BY gc.Id desc "
;
return
Get
<
RB_Goods_WK_DownLoad_Extend
>(
sql
).
ToList
();
}
}
}
Mall.WebApi/Controllers/Education/AppletEducationController.cs
View file @
e1c1ef13
...
...
@@ -540,6 +540,169 @@ namespace Mall.WebApi.Controllers.Education
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取课程未缓存的章节列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMyCourseNoCachePageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
GoodsId
=
prams
.
GetInt
(
"GoodsId"
,
0
);
string
CourseName
=
prams
.
GetStringValue
(
"CourseName"
);
if
(
GoodsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
if
(
userInfo
!=
null
&&
userInfo
.
UserId
>
0
)
{
var
list
=
educationModule
.
GetMyCourseNoCachePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
GoodsId
,
CourseName
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
Sort
,
x
.
SortName
,
x
.
Name
,
x
.
Type
,
TypeName
=
x
.
Type
.
GetEnumName
(),
x
.
FilePath
});
}
else
{
pagelist
.
count
=
0
;
pagelist
.
pageData
=
new
List
<
RB_Goods_WK_Course_Extend
>();
}
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取课程已缓存的章节列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMyCourseCachedPageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
GoodsId
=
prams
.
GetInt
(
"GoodsId"
,
0
);
string
CourseName
=
prams
.
GetStringValue
(
"CourseName"
);
if
(
GoodsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
if
(
userInfo
!=
null
&&
userInfo
.
UserId
>
0
)
{
var
list
=
educationModule
.
GetMyCourseCachedPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
GoodsId
,
CourseName
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
Sort
,
x
.
SortName
,
x
.
Name
,
x
.
Type
,
TypeName
=
x
.
Type
.
GetEnumName
(),
x
.
FilePath
,
x
.
FileState
,
x
.
Size
,
x
.
Unit
});
}
else
{
pagelist
.
count
=
0
;
pagelist
.
pageData
=
new
List
<
RB_Goods_WK_Course_Extend
>();
}
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 设置缓存
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetMyCourseCache
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Goods_WK_DownLoad_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_WK_DownLoad_Extend
>(
req
.
msg
.
ToString
());
if
(
demodel
.
CourseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递课程id"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
FilePath
))
{
return
ApiResult
.
ParamIsNull
(
"请传递本地存储路径"
);
}
if
(
demodel
.
FileType
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递文件类型"
);
}
demodel
.
UserId
=
userInfo
.
UserId
;
return
educationModule
.
SetMyCourseCache
(
demodel
);
}
/// <summary>
/// 设置缓存课程状态
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetMyCourseCacheState
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
CourseId
=
parms
.
GetInt
(
"CourseId"
);
int
FileState
=
parms
.
GetInt
(
"FileState"
);
if
(
CourseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
educationModule
.
SetMyCourseCacheState
(
CourseId
,
userInfo
.
UserId
,
FileState
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除缓存
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelMyCourseCache
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
string
CourseIds
=
parms
.
GetStringValue
(
"CourseIds"
);
if
(
string
.
IsNullOrEmpty
(
CourseIds
))
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
educationModule
.
DelMyCourseCache
(
CourseIds
,
userInfo
.
UserId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
资讯留言
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment