Esempio n. 1
0
def add_read():
    """已读"""
    user_id = user_mgr.get_cur_user_id(1)
    task_id = utils.form_get('task_id', type=str, must=1)
    pwd = utils.form_get('pwd', type=str, must=1)

    return task_mgr.read(user_id, task_id, pwd)
Esempio n. 2
0
def del_reply():
    """删除接龙"""
    user_id = user_mgr.get_cur_user_id(1)
    reply_id = utils.form_get('reply_id', type=int, must=1)
    task_id = utils.form_get('task_id', type=int, must=1)
    pwd = utils.form_get('pwd', type=str, must=1)
    return task_mgr.del_reply(user_id, task_id, pwd, reply_id)
Esempio n. 3
0
def get_task_list():
    """获取任务列表"""
    user_id = user_mgr.get_cur_user_id(1)

    data = [
        task_mgr.get_sin_task_dict(task)
        for task in task_mgr.get_my_attend_task(user_id)
    ]
    return dict(data=data)
Esempio n. 4
0
def add_reply():
    """回复"""
    user_id = user_mgr.get_cur_user_id(1)
    task_id = utils.form_get('task_id', type=str, must=1)
    pwd = utils.form_get('pwd', type=str, must=1)
    c_type = utils.form_get('c_type', type=int, must=1)
    content = utils.form_get('content', type=str, must=1)
    img_uri = utils.form_get('img_uri', type=str, must=1)
    audio_uri = utils.form_get('audio_uri', type=str, must=1)
    with reply_lock.dist_lock(user_id):
        time.sleep(1)
        return task_mgr.reply(user_id, c_type, content, img_uri, audio_uri,
                              task_id, pwd)
Esempio n. 5
0
def add_task():
    """发任务"""
    user_id = user_mgr.get_cur_user_id(1)
    title = utils.form_get('title', type=str, must=1)
    c_type = utils.form_get('c_type', type=int, must=1)
    content = utils.form_get('content', type=str, must=1)
    img_uri = utils.form_get('img_uri', type=str, must=1)
    audio_uri = utils.form_get('audio_uri', type=str, must=1)
    ddl = utils.form_get('ddl', type=int, must=1)
    type_ = utils.form_get('type', type=int, must=1)
    if type_ not in Task.ALL_TYPE:
        raise ext.ParamError(u'invalid type')
    return task_mgr.add_task(user_id, type_, title, c_type, content, img_uri,
                             audio_uri, ddl)
Esempio n. 6
0
def get_task():
    """获取任务"""
    user_id = user_mgr.get_cur_user_id(1)
    task_id = utils.args_get('task_id', type=str, must=1)
    pwd = utils.args_get('pwd', type=str, must=1)
    return task_mgr.get_task(task_id, user_id, pwd)
Esempio n. 7
0
def del_task():
    """删除任务"""
    user_id = user_mgr.get_cur_user_id(1)
    task_id = utils.form_get('task_id', type=int, must=1)
    pwd = utils.form_get('pwd', type=str, must=1)
    return task_mgr.del_task(user_id, task_id, pwd)
Esempio n. 8
0
def get_my_task_index():
    """获取我的列表"""
    user_id = user_mgr.get_cur_user_id(1)

    return task_mgr.get_my_task_index(user_id)
Esempio n. 9
0
def add_attend():
    """获取任务"""
    user_id = user_mgr.get_cur_user_id(1)
    to_id = utils.form_get('to_id', type=str, must=1)

    return attend_mgr.add_attend(user_id, to_id)
Esempio n. 10
0
def add_form_id():
    """提交form_id"""
    form_id = utils.form_get("form_id", '', type=str)
    user_id = user_mgr.get_cur_user_id(1)
    form_id_mgr.add_form_id(user_id, form_id)
    return dict()