Esempio n. 1
0
def confirm_task(request,tid):
	'''
	确认任务完成
	'''
	create_uid = request.REQUEST['uid']
	try:
		task = TaskModel.Task.objects.get(id = tid, status = 2, create_uid = create_uid)
	except TaskModel.Task.DoesNotExist:
		return Response.fail(errcode=-30001)
	task.status = 3
	task.save()
	return Response.success(ret = {'tid' : task.id})
Esempio n. 2
0
def finish_task(request,tid):
	'''
	完成任务
	'''
	reply_uid = request.REQUEST['uid']
	try:
		task = TaskModel.Task.objects.get(id = tid, status = 1, reply_uid = reply_uid)
	except TaskModel.Task.DoesNotExist:
		return Response.fail(errcode=-30001)
	task.status = 2
	task.save()
	return Response.success(ret = {'tid' : task.id})
Esempio n. 3
0
def list_task(request):
	'''
	任务列表
	'''
	tasks = TaskModel.Task.objects.all().order_by('-ctime')
	tasks = map(funcs.convert_task,tasks)
	return Response.success(ret = tasks)
Esempio n. 4
0
def create_task(request):
	'''
	发布任务
	'''
	create_uid, title, description = request.REQUEST['uid'], request.REQUEST['title'], request.REQUEST['description']
	task = TaskModel.Task(
		create_uid = create_uid,
		title = title,
		description = description,
	)
	task.save()
	return Response.success(ret = {'tid' : task.id})