193 lines
6.3 KiB
C#
193 lines
6.3 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web.Http;
|
|
using MyCode.Project.Domain.Message.Response.User;
|
|
using MyCode.Project.Infrastructure.Constant;
|
|
using MyCode.Project.WebApi.Controllers;
|
|
using MyCode.Project.Domain.Config;
|
|
using MyCode.Project.Services;
|
|
using MyCode.Project.Infrastructure.Common;
|
|
using MyCode.Project.Domain.Message.Request.User;
|
|
using MyCode.Project.Infrastructure.Enumeration;
|
|
using MyCode.Project.Domain.Message.Act.User;
|
|
using MyCode.Project.Domain.Message.Response.Goods;
|
|
using MyCode.Project.Domain.Model;
|
|
using MyCode.Project.Infrastructure.Extensions;
|
|
using MyCode.Project.Domain.Message.Response.Common;
|
|
using MyCode.Project.Domain.Message.Response.MaterialWarehouse;
|
|
using MyCode.Project.Domain.Message.Request.MaterialWarehouse;
|
|
using MyCode.Project.Domain.Message.Common;
|
|
using MyCode.Project.Infrastructure.Cache;
|
|
using MyCode.Project.Infrastructure.Trees;
|
|
using MyCode.Project.Domain.Message.Response.Course;
|
|
using MyCode.Project.Domain.Message.Request.Course;
|
|
|
|
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 课程培训 相关
|
|
/// </summary>
|
|
public class CourseTopicsController : BaseWechatController
|
|
{
|
|
private ICourseTopicsService _courseTopicsService;
|
|
private IShopActionLogService _shopActionLogService;
|
|
private IMyCodeCacheService _myCodeCacheService;
|
|
|
|
|
|
public CourseTopicsController(ICourseTopicsService courseTopicsService
|
|
, IShopActionLogService shopActionLogService
|
|
, IMyCodeCacheService myCodeCacheService)
|
|
{
|
|
_courseTopicsService = courseTopicsService;
|
|
_shopActionLogService = shopActionLogService;
|
|
_myCodeCacheService = myCodeCacheService;
|
|
}
|
|
|
|
#region GetPageList(获取分页列表)
|
|
/// <summary>
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public PageResult<CoursePageList> GetPageList(PagedSearch<CoursePageQuery> request)
|
|
{
|
|
var condition = request.Condition;
|
|
var result = _courseTopicsService.GetPageList(request);
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region SetCollect(设置/取消课程收藏)
|
|
/// <summary>
|
|
/// 设置/取消课程收藏,并返回收藏状态 1=已首次 0=未收藏
|
|
/// </summary>
|
|
/// <param name="act"></param>
|
|
[HttpPost]
|
|
public int SetCollect(IdAct act)
|
|
{
|
|
return _courseTopicsService.SetCollect(act.Id, this.CurrentLogin);
|
|
}
|
|
#endregion
|
|
|
|
#region GetShareCode(获取课程的小程序码)
|
|
/// <summary>
|
|
/// 获取课程的小程序码
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public string GetShareCode(string id,string key)
|
|
{
|
|
if (key == "062811FF-F365-4213-809D-82B1274327EA")
|
|
return _courseTopicsService.GetShareCode(id);
|
|
else
|
|
return "";
|
|
}
|
|
#endregion
|
|
|
|
#region Haslearned(顶部店员名称下的已学习课程数)
|
|
/// <summary>
|
|
/// 顶部店员名称下的已学习课程数
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public int Haslearned()
|
|
{
|
|
return _courseTopicsService.Haslearned(this.CurrentLogin);
|
|
}
|
|
#endregion
|
|
|
|
#region GetCollectLearnedPageList(获取已学习或者已收藏课程分页列表)
|
|
/// <summary>
|
|
/// 获取已学习或者已收藏课程分页列表
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public PageResult<CoursePageList> GetCollectLearnedPageList(PagedSearch<CoursePageQuery2> request)
|
|
{
|
|
var result = _courseTopicsService.GetCollectLearnedPageList(request,this.CurrentLogin.UserId);
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region GetDetail(根据ID获取课程详情)
|
|
/// <summary>
|
|
/// 根据ID获取课程详情
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public CourseDetail GetDetail(string id)
|
|
{
|
|
var result = _courseTopicsService.GetDetail(id, this.CurrentLogin);
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region GetCourseTopicsList(获取主题列表)
|
|
/// <summary>
|
|
/// 获取主题列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<TreeNode<CourseTopicsTree>> GetCourseTopicsList()
|
|
{
|
|
return _courseTopicsService.GetTreeList();
|
|
}
|
|
#endregion
|
|
|
|
#region GetCourseListById(根据分类ID获取课程列表)
|
|
/// <summary>
|
|
/// 根据分类ID获取课程列表
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<CoursePageList> GetCourseListById(Guid id)
|
|
{
|
|
var result = _courseTopicsService.GetCourseListById(id);
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region GetShareCodeAnyUrl(获取课程的任意地址小程序码)
|
|
/// <summary>
|
|
/// 获取课程的任意地址小程序码
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public string GetShareCodeAnyUrl(string wxminurl, string key)
|
|
{
|
|
if (key == "062811FF-F365-4213-809D-82B1274327EA")
|
|
return _courseTopicsService.GetShareCodeAnyUrl(wxminurl);
|
|
else
|
|
return "";
|
|
}
|
|
#endregion
|
|
|
|
#region GetCourseItemList(根据课程系列ID获取课程列表)
|
|
/// <summary>
|
|
/// 根据课程系列ID获取课程列表
|
|
/// </summary>
|
|
/// <param name="query"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public PageResult<CourseItemResp> GetCourseItemList(PagedSearch<CourseItemReq> query)
|
|
{
|
|
return _courseTopicsService.GetCourseItemList(query);
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
}
|
|
|