• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

微信小程序的短视频管理系统

武飞扬头像
曾几何时…
帮助1

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端框架:VUE
数据库:MySQL5.7
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

3.1小程序端

3.2发布者

3.3管理员

 四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

基于微信小程序的短视频管理系统利用网络沟通、计算机信息存储管理,有着与传统的方式所无法替代的优点。比如计算检索速度特别快、可靠性特别高、存储容量特别大、保密性特别好、可保存时间特别长、成本特别低等。在工作效率上,能够得到极大地提高,延伸至服务水平也会有好的收获,有了网络,基于微信小程序的短视频管理系统的各方面的管理更加科学和系统,更加规范和简便。


二、系统功能

基于微信小程序的短视频管理系统主要包括三大功能模块,即用户功能模块和管理员功能模块、发布者功能模块。

(1)管理员模块:系统中的核心用户是管理员,管理员登录后,通过管理员来管理后台系统。主要功能有:首页、个人中心、用户管理、发布者管理、视频信息管理、频道分类管理、举报信息管理、系统管理。 

(2)发布者:首页、个人中心、视频信息管理。

(3)前台用户:首页、视频信息、我的。



三、系统项目截图

3.1小程序端

用户注册页面,输入用户的个人信息点击注册即可。

学新通

注册完成后会返回到登录页面,用户输入自己注册的账号密码即可登录成功

 学新通

登录成功后我们可以看到有相关的视频还有视频信息,我的信息等。

视频信息推荐是按照点击次数进行推荐的,点击数越大越拍前。

 学新通

选择自己想要视频点击进入观看

 学新通

视频信息推荐底下还有公告信息,用户可以查看系统发布的公告信息。 

 学新通

在视频信息中我们可以搜索自己想要的视频信息并且查看观看视频

学新通

观看视频后还可以对视频进行评价。

 学新通

在我的中用户可以查看自己的收藏管理,也可以修改自己的信息等。

 学新通

3.2发布者

 管理员和发布者可以在后台管理中登录后对前台的一些信息进行发布。

发布者进行发布,管理员进行审核是否通过。

学新通

发布者登录以后可以修改自己的密码和信息等。

学新通

发布者添加完成相关的视频信息内容后,提交后由管理员审核,审核通过显示在页面上。

学新通

3.3管理员

管理员登录后可以看到有首页、个人中心、用户管理、发布者管理、视频信息管理、频道分类管理、举报信息管理、系统管理。 

学新通

在发布者管理中管理员可以查看修改删除发布者信息。 

学新通

发布者发布视频后后显示在管理员页面审核中,由管理员进行审核,并且显示在页面中。 

学新通

对于一些举报内容管理可以查看并且进行回复。 

学新通


 四、核心代码

4.1登录相关

  1.  
     
  2.  
    package com.controller;
  3.  
     
  4.  
     
  5.  
    import java.util.Arrays;
  6.  
    import java.util.Calendar;
  7.  
    import java.util.Date;
  8.  
    import java.util.Map;
  9.  
     
  10.  
    import javax.servlet.http.HttpServletRequest;
  11.  
     
  12.  
    import org.springframework.beans.factory.annotation.Autowired;
  13.  
    import org.springframework.stereotype.Controller;
  14.  
    import org.springframework.web.bind.annotation.GetMapping;
  15.  
    import org.springframework.web.bind.annotation.PathVariable;
  16.  
    import org.springframework.web.bind.annotation.PostMapping;
  17.  
    import org.springframework.web.bind.annotation.RequestBody;
  18.  
    import org.springframework.web.bind.annotation.RequestMapping;
  19.  
    import org.springframework.web.bind.annotation.RequestParam;
  20.  
    import org.springframework.web.bind.annotation.ResponseBody;
  21.  
    import org.springframework.web.bind.annotation.RestController;
  22.  
     
  23.  
    import com.annotation.IgnoreAuth;
  24.  
    import com.baomidou.mybatisplus.mapper.EntityWrapper;
  25.  
    import com.entity.TokenEntity;
  26.  
    import com.entity.UserEntity;
  27.  
    import com.service.TokenService;
  28.  
    import com.service.UserService;
  29.  
    import com.utils.CommonUtil;
  30.  
    import com.utils.MD5Util;
  31.  
    import com.utils.MPUtil;
  32.  
    import com.utils.PageUtils;
  33.  
    import com.utils.R;
  34.  
    import com.utils.ValidatorUtils;
  35.  
     
  36.  
    /**
  37.  
    * 登录相关
  38.  
    */
  39.  
    @RequestMapping("users")
  40.  
    @RestController
  41.  
    public class UserController{
  42.  
     
  43.  
    @Autowired
  44.  
    private UserService userService;
  45.  
     
  46.  
    @Autowired
  47.  
    private TokenService tokenService;
  48.  
     
  49.  
    /**
  50.  
    * 登录
  51.  
    */
  52.  
    @IgnoreAuth
  53.  
    @PostMapping(value = "/login")
  54.  
    public R login(String username, String password, String captcha, HttpServletRequest request) {
  55.  
    UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
  56.  
    if(user==null || !user.getPassword().equals(password)) {
  57.  
    return R.error("账号或密码不正确");
  58.  
    }
  59.  
    String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
  60.  
    return R.ok().put("token", token);
  61.  
    }
  62.  
     
  63.  
    /**
  64.  
    * 注册
  65.  
    */
  66.  
    @IgnoreAuth
  67.  
    @PostMapping(value = "/register")
  68.  
    public R register(@RequestBody UserEntity user){
  69.  
    // ValidatorUtils.validateEntity(user);
  70.  
    if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
  71.  
    return R.error("用户已存在");
  72.  
    }
  73.  
    userService.insert(user);
  74.  
    return R.ok();
  75.  
    }
  76.  
     
  77.  
    /**
  78.  
    * 退出
  79.  
    */
  80.  
    @GetMapping(value = "logout")
  81.  
    public R logout(HttpServletRequest request) {
  82.  
    request.getSession().invalidate();
  83.  
    return R.ok("退出成功");
  84.  
    }
  85.  
     
  86.  
    /**
  87.  
    * 密码重置
  88.  
    */
  89.  
    @IgnoreAuth
  90.  
    @RequestMapping(value = "/resetPass")
  91.  
    public R resetPass(String username, HttpServletRequest request){
  92.  
    UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
  93.  
    if(user==null) {
  94.  
    return R.error("账号不存在");
  95.  
    }
  96.  
    user.setPassword("123456");
  97.  
    userService.update(user,null);
  98.  
    return R.ok("密码已重置为:123456");
  99.  
    }
  100.  
     
  101.  
    /**
  102.  
    * 列表
  103.  
    */
  104.  
    @RequestMapping("/page")
  105.  
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
  106.  
    EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
  107.  
    PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
  108.  
    return R.ok().put("data", page);
  109.  
    }
  110.  
     
  111.  
    /**
  112.  
    * 列表
  113.  
    */
  114.  
    @RequestMapping("/list")
  115.  
    public R list( UserEntity user){
  116.  
    EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
  117.  
    ew.allEq(MPUtil.allEQMapPre( user, "user"));
  118.  
    return R.ok().put("data", userService.selectListView(ew));
  119.  
    }
  120.  
     
  121.  
    /**
  122.  
    * 信息
  123.  
    */
  124.  
    @RequestMapping("/info/{id}")
  125.  
    public R info(@PathVariable("id") String id){
  126.  
    UserEntity user = userService.selectById(id);
  127.  
    return R.ok().put("data", user);
  128.  
    }
  129.  
     
  130.  
    /**
  131.  
    * 获取用户的session用户信息
  132.  
    */
  133.  
    @RequestMapping("/session")
  134.  
    public R getCurrUser(HttpServletRequest request){
  135.  
    Long id = (Long)request.getSession().getAttribute("userId");
  136.  
    UserEntity user = userService.selectById(id);
  137.  
    return R.ok().put("data", user);
  138.  
    }
  139.  
     
  140.  
    /**
  141.  
    * 保存
  142.  
    */
  143.  
    @PostMapping("/save")
  144.  
    public R save(@RequestBody UserEntity user){
  145.  
    // ValidatorUtils.validateEntity(user);
  146.  
    if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
  147.  
    return R.error("用户已存在");
  148.  
    }
  149.  
    userService.insert(user);
  150.  
    return R.ok();
  151.  
    }
  152.  
     
  153.  
    /**
  154.  
    * 修改
  155.  
    */
  156.  
    @RequestMapping("/update")
  157.  
    public R update(@RequestBody UserEntity user){
  158.  
    // ValidatorUtils.validateEntity(user);
  159.  
    userService.updateById(user);//全部更新
  160.  
    return R.ok();
  161.  
    }
  162.  
     
  163.  
    /**
  164.  
    * 删除
  165.  
    */
  166.  
    @RequestMapping("/delete")
  167.  
    public R delete(@RequestBody Long[] ids){
  168.  
    userService.deleteBatchIds(Arrays.asList(ids));
  169.  
    return R.ok();
  170.  
    }
  171.  
    }
学新通

4.2文件上传

  1.  
    package com.controller;
  2.  
     
  3.  
    import java.io.File;
  4.  
    import java.io.FileNotFoundException;
  5.  
    import java.io.IOException;
  6.  
    import java.util.Arrays;
  7.  
    import java.util.Date;
  8.  
    import java.util.HashMap;
  9.  
    import java.util.List;
  10.  
    import java.util.Map;
  11.  
    import java.util.Random;
  12.  
    import java.util.UUID;
  13.  
     
  14.  
    import org.apache.commons.io.FileUtils;
  15.  
    import org.apache.commons.lang3.StringUtils;
  16.  
    import org.springframework.beans.factory.annotation.Autowired;
  17.  
    import org.springframework.http.HttpHeaders;
  18.  
    import org.springframework.http.HttpStatus;
  19.  
    import org.springframework.http.MediaType;
  20.  
    import org.springframework.http.ResponseEntity;
  21.  
    import org.springframework.util.ResourceUtils;
  22.  
    import org.springframework.web.bind.annotation.PathVariable;
  23.  
    import org.springframework.web.bind.annotation.RequestBody;
  24.  
    import org.springframework.web.bind.annotation.RequestMapping;
  25.  
    import org.springframework.web.bind.annotation.RequestParam;
  26.  
    import org.springframework.web.bind.annotation.RestController;
  27.  
    import org.springframework.web.multipart.MultipartFile;
  28.  
     
  29.  
    import com.annotation.IgnoreAuth;
  30.  
    import com.baomidou.mybatisplus.mapper.EntityWrapper;
  31.  
    import com.entity.ConfigEntity;
  32.  
    import com.entity.EIException;
  33.  
    import com.service.ConfigService;
  34.  
    import com.utils.R;
  35.  
     
  36.  
    /**
  37.  
    * 上传文件映射表
  38.  
    */
  39.  
    @RestController
  40.  
    @RequestMapping("file")
  41.  
    @SuppressWarnings({"unchecked","rawtypes"})
  42.  
    public class FileController{
  43.  
    @Autowired
  44.  
    private ConfigService configService;
  45.  
    /**
  46.  
    * 上传文件
  47.  
    */
  48.  
    @RequestMapping("/upload")
  49.  
    public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
  50.  
    if (file.isEmpty()) {
  51.  
    throw new EIException("上传文件不能为空");
  52.  
    }
  53.  
    String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") 1);
  54.  
    File path = new File(ResourceUtils.getURL("classpath:static").getPath());
  55.  
    if(!path.exists()) {
  56.  
    path = new File("");
  57.  
    }
  58.  
    File upload = new File(path.getAbsolutePath(),"/upload/");
  59.  
    if(!upload.exists()) {
  60.  
    upload.mkdirs();
  61.  
    }
  62.  
    String fileName = new Date().getTime() "." fileExt;
  63.  
    File dest = new File(upload.getAbsolutePath() "/" fileName);
  64.  
    file.transferTo(dest);
  65.  
    FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload" "/" fileName));
  66.  
    if(StringUtils.isNotBlank(type) && type.equals("1")) {
  67.  
    ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
  68.  
    if(configEntity==null) {
  69.  
    configEntity = new ConfigEntity();
  70.  
    configEntity.setName("faceFile");
  71.  
    configEntity.setValue(fileName);
  72.  
    } else {
  73.  
    configEntity.setValue(fileName);
  74.  
    }
  75.  
    configService.insertOrUpdate(configEntity);
  76.  
    }
  77.  
    return R.ok().put("file", fileName);
  78.  
    }
  79.  
     
  80.  
    /**
  81.  
    * 下载文件
  82.  
    */
  83.  
    @IgnoreAuth
  84.  
    @RequestMapping("/download")
  85.  
    public ResponseEntity<byte[]> download(@RequestParam String fileName) {
  86.  
    try {
  87.  
    File path = new File(ResourceUtils.getURL("classpath:static").getPath());
  88.  
    if(!path.exists()) {
  89.  
    path = new File("");
  90.  
    }
  91.  
    File upload = new File(path.getAbsolutePath(),"/upload/");
  92.  
    if(!upload.exists()) {
  93.  
    upload.mkdirs();
  94.  
    }
  95.  
    File file = new File(upload.getAbsolutePath() "/" fileName);
  96.  
    if(file.exists()){
  97.  
    /*if(!fileService.canRead(file, SessionManager.getSessionUser())){
  98.  
    getResponse().sendError(403);
  99.  
    }*/
  100.  
    HttpHeaders headers = new HttpHeaders();
  101.  
    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
  102.  
    headers.setContentDispositionFormData("attachment", fileName);
  103.  
    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
  104.  
    }
  105.  
    } catch (IOException e) {
  106.  
    e.printStackTrace();
  107.  
    }
  108.  
    return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
  109.  
    }
  110.  
     
  111.  
    }
学新通

4.3封装

  1.  
    package com.utils;
  2.  
     
  3.  
    import java.util.HashMap;
  4.  
    import java.util.Map;
  5.  
     
  6.  
    /**
  7.  
    * 返回数据
  8.  
    */
  9.  
    public class R extends HashMap<String, Object> {
  10.  
    private static final long serialVersionUID = 1L;
  11.  
     
  12.  
    public R() {
  13.  
    put("code", 0);
  14.  
    }
  15.  
     
  16.  
    public static R error() {
  17.  
    return error(500, "未知异常,请联系管理员");
  18.  
    }
  19.  
     
  20.  
    public static R error(String msg) {
  21.  
    return error(500, msg);
  22.  
    }
  23.  
     
  24.  
    public static R error(int code, String msg) {
  25.  
    R r = new R();
  26.  
    r.put("code", code);
  27.  
    r.put("msg", msg);
  28.  
    return r;
  29.  
    }
  30.  
     
  31.  
    public static R ok(String msg) {
  32.  
    R r = new R();
  33.  
    r.put("msg", msg);
  34.  
    return r;
  35.  
    }
  36.  
     
  37.  
    public static R ok(Map<String, Object> map) {
  38.  
    R r = new R();
  39.  
    r.putAll(map);
  40.  
    return r;
  41.  
    }
  42.  
     
  43.  
    public static R ok() {
  44.  
    return new R();
  45.  
    }
  46.  
     
  47.  
    public R put(String key, Object value) {
  48.  
    super.put(key, value);
  49.  
    return this;
  50.  
    }
  51.  
    }
学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgakbjg
系列文章
更多 icon
同类精品
更多 icon
继续加载