controllers

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(u *beego.Controller) (*models.User, error)

输入当前的beego控制器 根据session返回session中openid对应的用户指针,或者错误

Types

type AcceptorCheckFinishCodeResponse

type AcceptorCheckFinishCodeResponse struct {
	Proves []string `json:"proves"`
	models.Task
}

type CreateTaskReturnCode

type CreateTaskReturnCode struct {
	HttpResponseCode
	TaskId int `json:"taskId"`
}

创建任务API所需要的返回值

type HttpResponseCode

type HttpResponseCode struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

因为微信只要收到服务器回复,无论http状态码都会直接调用success回调函数,所以需要在返回值里面加上返回信息以帮助前端确认完成状态。 同时增加容错

type PublisherCheckTaskFinishResponse

type PublisherCheckTaskFinishResponse struct {
	models.User
	Proves []string
}

发布者查询任务完成信息所需要的返回类型 返回对象时一个数组,单个对象包括用户和其上传的图片数组

type TaskController

type TaskController struct {
	beego.Controller
}

func (*TaskController) AcceptTask

func (t *TaskController) AcceptTask()

注:暂时不检查是否达到最大值,只是进行处理 @Title 接受任务 @Description user accept the task @Param session header string true "user's session ,get from login" @Param taskId path integer true "任务id" @Success 200 {object} controllers.HttpResponseCode @Failure 403 {object} controllers.HttpResponseCode @router /task/accept/:taskId [post]

func (*TaskController) AcceptorCheckFinishTask

func (t *TaskController) AcceptorCheckFinishTask()

@Title 接受者查询自己已完成任务的信息 @Description 接受者完成任务的信息以及证明只有发布者和接受者自身才能看见 @Param session header string true "user's session ,get from login" @Param taskId path integer true "任务id" @Success 200 {object} controllers.HttpResponseCode @Failure 403 {object} controllers.HttpResponseCode @router /settleup/:taskId [get]

func (*TaskController) Delete

func (t *TaskController) Delete()

@Title 删除任务 @Description 考虑到已经发布的任务可能存在因为其他不可抗逆因素而需要取消的情况,任务允许删除。条件是该任务未被接受或者被接受时间不超过十分钟 @Param session header string true "user's session ,get from login" @Param taskId path integer true "The taskId you want to delete" @Success 200 {object} controllers.HttpResponseCode @Failure 403 taskId is empty @router /:taskId [delete]

func (*TaskController) ExecutorSettleupTask

func (t *TaskController) ExecutorSettleupTask()

@Title 任务接受者结算任务 @Param session header string true "user's session ,get from login" @Param taskId path integer true "任务id" @Param graph body binary true "图片,使用myfile:xxx传输" @Success 200 {object} controllers.HttpResponseCode @Failure 403 {object} controllers.HttpResponseCode @router /settleup/:taskId [post]

func (*TaskController) Get

func (t *TaskController) Get()

@Title 查询指定id的任务 @Description get task by taskId @Param taskId path integer true "the key" @Success 200 {object} models.Task @Failure 403 :taskId is empty @router /:taskId [get]

func (*TaskController) GetAllTask

func (t *TaskController) GetAllTask()

拿到所有任务,按照页面进行分解。(目前仅能够返回所有的任务,没有做页面,没有做筛选) @Title 查询已发布任务列表 @Description get task by taskId @Param session header string true "user's session ,get from login" @Param page query integer true "page value,default is 1" @Param myrelease query boolean false "check release task" @Param myacceptance query boolean false "check accept task" @Param keyword query string false "search by labels" @Success 200 {[object]} models.Task @Failure 403 :taskId is empty @router / [get]

func (*TaskController) Post

func (t *TaskController) Post()

@Title 发布任务 @Description 用户发送发布任务的请求 @Param session header string true "user's session ,get from login" @Param body body models.Task true "body for task content" @Success 200 {object} controllers.CreateTaskReturnCode @Failure 403 body is empty @router / [post]

func (*TaskController) PublisherCheckTaskFinish

func (t *TaskController) PublisherCheckTaskFinish()

@Title 发布者查询任务完成信息 @Description 任务接受者将任务完成信息上传到服务器上,发布者查看所有接受者的信息以及其上传的任务完成信息 @Param session header string true "user's session ,get from login" @Param taskId path integer true "任务id" @Success 200 {[object]} controllers.Task @Failure 403 {object} controllers.HttpResponseCode @router /confirm/:taskId [get]

func (*TaskController) PublisherFinishTask

func (t *TaskController) PublisherFinishTask()

@Title 发布者结算任务 @Param session header string true "user's session ,get from login" @Param taskId path integer true "任务id" @Success 200 {object} controllers.HttpResponseCode @Failure 403 {object} controllers.HttpResponseCode @router /confirm/:taskId [post]

func (*TaskController) Put

func (t *TaskController) Put()

@Title 修改任务信息 @Description 发布者任务被接取前可以随时修改任务信息,但是在任务被接受后则不能有任何改动 @Param session header string true "user's session ,get from login" @Param taskId path integer true "The taskId you want to update" @Param body body models.Task true "body for task content" @Success 200 {object} controllers.HttpResponseCode @Failure 403 :taskId is not int @router /:taskId [put]

type UserController

type UserController struct {
	beego.Controller
}

Operations about Users

func (*UserController) DownloadImage

func (u *UserController) DownloadImage()

测试用函数之图片下载 @Title login @Description Use session to get user's id @Param code query string true "wx.Login response code" @Success 200 {string} login success @Failure 403 user not exist @router /download [get]

func (*UserController) Get

func (u *UserController) Get()

@Title 查询用户信息 @Description get user by openid(in session) @Param session header string true "user's session ,get from login" @Success 200 {object} models.User @Failure 403 :uid is empty @router / [get]

func (*UserController) Login

func (u *UserController) Login()

@Title Login @Description Logs user into the system @Param code query string true "the code from wx.login()" @Success 200 {string} login success @Failure 403 user not exist @router /login [get]

func (*UserController) Put

func (u *UserController) Put()

@Title 修改用户个人信息 @Description update the user @Param session header string true "user's session ,get from login" @Param body body models.User true "body for user content" @Success 200 {object} controllers.HttpResponseCode @Failure 403 :uid is not int @router /:uid [put]

func (*UserController) Query

func (u *UserController) Query()

测试用函数之登陆验证 @Title login @Description Use session to get user's id @Param code query string true "wx.Login response code" @Success 200 {string} login success @Failure 403 user not exist @router /query [get]

func (*UserController) QueryImage

func (u *UserController) QueryImage()

测试用函数之图片上传 @Title login @Description Use session to get user's id @Param code query string true "wx.Login response code" @Success 200 {string} login success @Failure 403 user not exist @router /queryImage [post]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL