目录
目录README.md

README

湖南工商大学优秀作品展示系统

  • Ruby版本

    2.3.7

  • 数据库创建

    RAILS_ENV=production rake db:create

  • 数据库初始化

    RAILS_ENV=production rake db:migrate RAILS_ENV=production rake db:seed

  • 代码分支

    master

  • 线上地址 线上访问地址:http://testgs.educoder.net/works_preview 线上管理员地址:http://testgs.educoder.net/admin/sub-page

  • 如何上线

    前端代码在public下的dist 和 dist2,前端打好包后,替换文件即可 在跳板机上执行脚本: ssh_ymsz 代码在/home/pdl/webhaoran下,在该目录下git pull后 重启nigix /home/pdl/nginx/sbin/nginx -s reload


接口文档

用户登录接口

请求URL
  • localhost:3000/users/login
请求方式
  • POST
参数
参数名 必选 类型 说明
username string 用户名
password string 密码
返回示例
{
    "code": 0,
    "msg": "登录成功",
    "user": {
        "id": 1,
        "name": "admin",
        "login": "admin"
    }
}

用户登出接口

请求URL
  • localhost:3000/users/logout
请求方式
  • GET

作品列表接口

请求URL
  • localhost:3000/works
请求方式
  • GET
参数
参数名 必选 类型 说明
q[name_cont] string 作品名称模糊搜索字符串
q[major_eq] string 专业,:computer_science: 计算机科学与技术, soft_engineer: 软件工程, electronic_infomation_engineer: 电子信息工程, information_management: 信息管理与信息系统, engineer_management: 工程管理, internet_of_thing: 物联网工程, intelligent_science: 智能科学与技术, artificial_intelligence: 7 人工智能
q[client_type_eq] string 端类型
q[category_eq] string 类别,该值为枚举类型:social: 社交类, manager: 管理类, tool: 工具类, study: 学习类, other: 其他
q[student_names_array_eq] string 学生姓名
q[student_names_or_name_cont] string 学生姓名或者作品名称
page integer 页码
per_page integer 每页数量
返回示例
{
    "code": 0,
    "works": [
        {
            "id": 1,
            "name": "测试作品",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [
                "张三",
                "李四",
                "王五",
                "找刘",
                "陈七"
            ]
        },
        {
            "id": 2,
            "name": "测试接口",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [],
            "attachment_url": "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.pptx"
        }
    ],
    "top_count": 0,
    "total_count": 2,
    "page": 1,
    "per_page": 4
}

创建作品

请求URL
  • localhost:3000/works
请求方式
  • POST
参数
参数名 必选 类型 说明
work[name] string 作品名称
work[enroll_year] integer 入学年份
work[major] string 专业,该值为枚举类型:computer_science: 计算机科学与技术, soft_engineer: 软件工程, electronic_infomation_engineer: 电子信息工程, information_management: 信息管理与信息系统, engineer_management: 工程管理, internet_of_thing: 物联网工程, intelligent_science: 智能科学与技术, artificial_intelligence: 7 人工智能
work[category] string 类别,该值为枚举类型:social: 社交类, manager: 管理类, tool: 工具类, study: 学习类, other: 其他
work[client_type] string 端类型,该值为枚举类型: mobile:移动端 web: web端
work[attachment] file 文件
work[attcover] file 封面图片
work[student_names[]] array 学生姓名
返回示例
{
    "code": 0,
    "works": [
        {
            "id": 1,
            "name": "测试作品",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [
                "张三",
                "李四",
                "王五",
                "找刘",
                "陈七"
            ]
        },
        {
            "id": 2,
            "name": "测试接口",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [],
            "attachment_attcover_url": "封面url",
            "attachment_attcover_name": "封面图片大小",            
            "attachment_file_name": "文件名",
            "attachment_url": "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.pptx"
        }
    ],
    "total_count": 2,
    "page": 1,
    "per_page": 4
}

删除作品

请求URL
  • localhost:3000/works/:work_id
请求方式
  • DELETE

更新作品

请求URL
  • localhost:3000/works/:work_id
请求方式
  • PUT
参数
参数名 必选 类型 说明
work[name] string 作品名称
work[enroll_year] integer 入学年份
work[major] string 专业,该值为枚举类型:computer_science: 计算机科学与技术, soft_engineer: 软件工程, electronic_infomation_engineer: 电子信息工程, information_management: 信息管理与信息系统, engineer_management: 工程管理, internet_of_thing: 物联网工程, intelligent_science: 智能科学与技术, artificial_intelligence: 7 人工智能
work[category] string 类别,该值为枚举类型:social: 社交类, manager: 管理类, tool: 工具类, study: 学习类, other: 其他
work[client_type] string 端类型,该值为枚举类型: mobile:移动端 web: web端
work[attachment] file 文件
work[student_names[]] array 学生姓名
返回示例
{
    "code": 0,
    "works": [
        {
            "id": 1,
            "name": "测试作品",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [
                "张三",
                "李四",
                "王五",
                "找刘",
                "陈七"
            ]
        },
        {
            "id": 2,
            "name": "测试接口",
            "major": "computer_science",
            "enroll_year": 2020,
            "client_type": "mobile",
            "category": "social",
            "student_names": [],
            "attachment_url": "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.pptx"
        }
    ],
    "total_count": 2,
    "page": 1,
    "per_page": 4
}

置顶

请求URL
  • localhost:3000/works/:work_id/lift_to_top
请求方式
  • GET

取消置顶

请求URL
  • localhost:3000/works/:work_id/cancel_top
请求方式
  • GET

上架

请求URL
  • localhost:3000/works/:work_id/put_on
请求方式
  • GET

下架

请求URL
  • localhost:3000/works/:work_id/put_off
请求方式
  • GET

作品ppt预览

请求URL
  • http://47.111.130.18:49999/works/2/preview
请求方式
  • GET
关于

湖南工商大学作品展示

8.5 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号