Giter VIP home page Giter VIP logo

biye2's Introduction

成电毕业生项目后端代码仓库

作者:18级星辰后端廖武耀

README.MD分为三部分,接口文档与代码部署与后台管理


接口文档

以下接口皆为json格式

获取问题

URL: /users/getproblem

HTTP METHOD:POST

Request:

{    
    "openid":"qwerrt"
}

Return:

{
    "examid":12,//这次考试的id
    "data":[
        {
            "id":6,//题目id
            "question":"示例题目",//题目
            "options":"选项一,选项二,选项三,选项四",//用逗号分隔的选项
            "answer":"选项一",//答案
            "type":"基础知识",//类型
            "show_time":0,//展示次数
            "pass_time":0//正确次数
        },
        {
            //后面还有九个
        },
    ]
}

获取用户信息

URL:/users/getuserinfo

HTTP METHOD:POST

Request:

{
    "openid":"qwerrt"
}

Return:

{
    "try":1
    //已考试次数
    //这个值可以为-1,0,1,2
    //如果是-1则表示openid为空
}

提交问卷

URL:/users/submit

HTTP METHOD:POST

Request:

{
    "openid":"qwerrt",
    "examid":12,
    "correct":[1,3,5,7]//这个是从0-9
}

Return:

{
    "try":1
    //已考试次数
    //这个值可以为-1,0,1,2,3
    //如果是-1则表示openid为空或者有误
    //如果是3则表示用户已经考了两次,刚才提交那次并没有存入数据库
}

生成证书

URL:/users/getusercla

HTTP METHOD:POST

Request:

{
    "openid":"ssss",
    "iconurl":"aaaa",//头像的url
    "nickname":"啊啊啊"//微信昵称
}

Return:

{
    "imageurl":"http://biye.stuhome.com/users/getimage?imageid=777"
    //错误返回"imageurl":"error"
}

代码部署

访问目录

建议是将public文件夹设置为访问目录,然后给予访问上级目录的权限,并将runtime文件设为777权限。

当然也可以不那么做,那么所有接口前面都要加public,比如public/users/getuserinfo

URL重写

假设上面将访问目录设为public,默认的接口URL其实是index.php/users/getuserinfo

这个index.php是可以隐藏的,而且也比较简单

thinkphp的开发文档中,针对Apache和Nginx的重写方法,已经写得非常详细了,我这里也不复述了。

如果这两者都没做,那么URL就是public/index.php/users/getuserinfo

数据库

数据库的用户名、密码等,在config/database.php下修改。

目录下提供了一个uestcbiye2019.sql,用来生成数据库结构。

导入后,后台的默认用户名是star,密码是7777777


后台管理

访问/admin/即可

默认用户名star,密码7777777

biye2's People

Contributors

77torpedo77 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.