Exemple #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)
Exemple #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)
Exemple #3
0
def user_wxa_login():
    """小程序,登录"""
    code = utils.form_get('code', type=str)
    nickname = utils.form_get('nickname', type=str)
    img_url = utils.form_get('img_url', type=str)

    if code is None:
        raise ext.ParamError(u'invalid code')

    return user_mgr.wxa_login(code, nickname, img_url)
Exemple #4
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)
Exemple #5
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)
Exemple #6
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)
Exemple #7
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)
Exemple #8
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()