Exemplo n.º 1
0
def library_check_auth(content, renew=False):
    """检查有无授权,进行查询或续借"""
    user_library_info = get_user_library_info(openid)
    if user_library_info:
        # 解密密码
        cipher = AESCipher(app.config["PASSWORD_SECRET_KEY"])
        librarypwd = cipher.decrypt(user_library_info["librarypwd"])
        library.borrowing_record.delay(openid, user_library_info["libraryid"], librarypwd, renew=renew)
        return wechat.response_text(content)
    else:
        url = app.config["HOST_URL"] + "/auth-library/" + openid
        content = app.config["AUTH_LIBRARY_TEXT"] % url
        return wechat.response_text(content)
Exemplo n.º 2
0
def exam_grade():
    """查询期末成绩"""
    user_student_info = get_user_student_info(openid)
    if user_student_info:
        # 解密密码
        cipher = AESCipher(app.config["PASSWORD_SECRET_KEY"])
        studentpwd = cipher.decrypt(user_student_info["studentpwd"])
        score.get_info.delay(openid, user_student_info["studentid"], studentpwd)
        return wechat.response_text("查询中……")
    else:
        url = app.config["HOST_URL"] + "/auth-score/" + openid
        content = app.config["AUTH_JW_TEXT"] % url
        return wechat.response_text(content)
def exam_grade():
    """查询期末成绩"""
    user_student_info = get_user_student_info(openid)
    if user_student_info:
        # 解密密码
        cipher = AESCipher(app.config['PASSWORD_SECRET_KEY'])
        studentpwd = cipher.decrypt(user_student_info['studentpwd'])
        score.get_info.delay(openid, user_student_info['studentid'], studentpwd)
        return wechat.response_text('查询中……')
    else:
        url = app.config['HOST_URL'] + '/auth-score/' + openid
        content = app.config['AUTH_JW_TEXT'] % url
        return wechat.response_text(content)
Exemplo n.º 4
0
def exam_grade():
    """查询期末成绩"""
    user_student_info = get_user_student_info(openid)
    if user_student_info:
        # 解密密码
        cipher = AESCipher(app.config['PASSWORD_SECRET_KEY'])
        studentpwd = cipher.decrypt(user_student_info['studentpwd'])
        score.get_info.delay(openid, user_student_info['studentid'],
                             studentpwd)
        return wechat.response_text('查询中……')
    else:
        url = app.config['HOST_URL'] + '/auth-score/' + openid
        content = app.config['AUTH_JW_TEXT'] % url
        return wechat.response_text(content)
Exemplo n.º 5
0
def library_check_auth(content, renew=False):
    """检查有无授权,进行查询或续借"""
    user_library_info = get_user_library_info(openid)
    if user_library_info:
        # 解密密码
        cipher = AESCipher(app.config['PASSWORD_SECRET_KEY'])
        librarypwd = cipher.decrypt(user_library_info['librarypwd'])
        library.borrowing_record.delay(openid,
                                       user_library_info['libraryid'],
                                       librarypwd,
                                       renew=renew)
        return wechat.response_text(content)
    else:
        url = app.config['HOST_URL'] + '/auth-library/' + openid
        content = app.config['AUTH_LIBRARY_TEXT'] % url
        return wechat.response_text(content)
def daily_sign():
    """每日签到"""
    data = sign.daily_sign(openid)
    if data:
        return wechat.response_news(data)
    else:
        content = app.config['NOT_SIGN_TIME_TEXT']
        return wechat.response_text(content)
Exemplo n.º 7
0
def daily_sign():
    """每日签到"""
    data = sign.daily_sign(openid)
    if data:
        return wechat.response_news(data)
    else:
        content = app.config['NOT_SIGN_TIME_TEXT']
        return wechat.response_text(content)
Exemplo n.º 8
0
def express_shipment_tracking():
    """快递物流查询"""
    if message.type == "text":
        timeout = int(message.time) - int(get_user_last_interact_time(openid))
        # 超过一段时间,退出模式
        if timeout > 15 * 60:
            set_user_state(openid, "default")
            content = app.config["COMMAND_NOT_FOUND_TEXT"] + u"\n\n回复 “快递” 进入查询快递模式" + app.config["HELP_TEXT"]
            return wechat.response_text(content)
        else:
            # 放入队列任务执行,异步回复
            express.get_tracking_info.delay(openid, message.content)
            # 立即返回
            return "success"
    else:
        if message.ScanCodeInfo[0]["ScanType"] == "barcode":
            # 读取条形码扫描的单号
            num = message.ScanCodeInfo[0]["ScanResult"].split(",", 1)[1]
            # 异步查询
            express.get_tracking_info.delay(openid, num)
            return "success"
        else:
            return wechat.response_text("识别错误,请扫描快递条形码")
Exemplo n.º 9
0
def express_shipment_tracking():
    """快递物流查询"""
    if message.type == 'text':
        timeout = int(message.time) - int(get_user_last_interact_time(openid))
        # 超过一段时间,退出模式
        if timeout > 15 * 60:
            set_user_state(openid, 'default')
            content = app.config['COMMAND_NOT_FOUND_TEXT'] + \
                u'\n\n回复 “快递” 进入查询快递模式' + app.config['HELP_TEXT']
            return wechat.response_text(content)
        else:
            # 放入队列任务执行,异步回复
            express.get_tracking_info.delay(openid, message.content)
            # 立即返回
            return 'success'
    else:
        if message.ScanCodeInfo[0]['ScanType'] == 'barcode':
            # 读取条形码扫描的单号
            num = message.ScanCodeInfo[0]['ScanResult'].split(",", 1)[1]
            # 异步查询
            express.get_tracking_info.delay(openid, num)
            return 'success'
        else:
            return wechat.response_text('识别错误,请扫描快递条形码')
Exemplo n.º 10
0
def express_shipment_tracking():
    """快递物流查询"""
    if message.type == 'text':
        timeout = int(message.time) - int(get_user_last_interact_time(openid))
        # 超过一段时间,退出模式
        if timeout > 15 * 60:
            set_user_state(openid, 'default')
            content = app.config['COMMAND_NOT_FOUND_TEXT'] + \
                u'\n\n回复 “快递” 进入查询快递模式' + app.config['HELP_TEXT']
            return wechat.response_text(content)
        else:
            # 放入队列任务执行,异步回复
            express.get_tracking_info.delay(openid, message.content)
            # 立即返回
            return 'success'
    else:
        if message.ScanCodeInfo[0]['ScanType'] == 'barcode':
            # 读取条形码扫描的单号
            num = message.ScanCodeInfo[0]['ScanResult'].split(",", 1)[1]
            # 异步查询
            express.get_tracking_info.delay(openid, num)
            return 'success'
        else:
            return wechat.response_text('识别错误,请扫描快递条形码')
Exemplo n.º 11
0
def contact_us():
    """合作信息"""
    content = app.config['CONTACT_US_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 12
0
def enter_chat_state():
    """进入聊天模式"""
    set_user_state(openid, 'chat')
    return wechat.response_text(app.config['ENTER_CHAT_STATE_TEXT'])
Exemplo n.º 13
0
def postcard():
    """明信片查询"""
    content = app.config['POSTCARD_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 14
0
def update_menu_setting():
    """更新自定义菜单"""
    try:
        wechat.create_menu(app.config['MENU_SETTING'])
    except Exception, e:
        return wechat.response_text(e)
Exemplo n.º 15
0
def enter_express_state():
    """进入快递查询模式"""
    set_user_state(openid, 'express')
    return wechat.response_text(app.config['ENTER_EXPRESS_STATE_TEXT'])
Exemplo n.º 16
0
def enter_express_state():
    """进入快递查询模式"""
    set_user_state(openid, 'express')
    return wechat.response_text(app.config['ENTER_EXPRESS_STATE_TEXT'])
Exemplo n.º 17
0
def enter_chat_state():
    """进入聊天模式"""
    set_user_state(openid, 'chat')
    return wechat.response_text(app.config['ENTER_CHAT_STATE_TEXT'])
Exemplo n.º 18
0
def weather_radar():
    """气象雷达动态图"""
    content = app.config['WEATHER_RADAR_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 19
0
def leave_a_message():
    """留言提示"""
    content = app.config['LEAVE_A_MESSAGE_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 20
0
def contact_us():
    """合作信息"""
    content = app.config['CONTACT_US_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 21
0
def bbs_url():
    """论坛网址"""
    content = app.config['BBS_URL_TXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 22
0
def html5_games():
    """HTML5游戏"""
    content = app.config['HTML5_GAMES_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 23
0
def postcard():
    """明信片查询"""
    content = app.config['POSTCARD_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 24
0
def cet_score():
    """回复四六级查询网址"""
    content = app.config['CET_SCORE_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 25
0
def weather_radar():
    """气象雷达动态图"""
    content = app.config['WEATHER_RADAR_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 26
0
def search_books():
    """图书馆找书"""
    content = app.config['LIBRARY_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 27
0
def command_not_found():
    """非关键词回复"""
    content = app.config['COMMAND_NOT_FOUND_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 28
0
def update_menu_setting():
    """更新自定义菜单"""
    try:
        wechat.create_menu(app.config['MENU_SETTING'])
    except Exception, e:
        return wechat.response_text(e)
Exemplo n.º 29
0
def command_not_found():
    """非关键词回复"""
    content = app.config['COMMAND_NOT_FOUND_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 30
0
def cancel_command():
    """取消状态"""
    content = app.config['CANCEL_COMMAND_TEXT'] + app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 31
0
def all_command():
    """回复全部指令"""
    content = app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 32
0
def subscribe():
    """回复订阅事件"""
    content = app.config['WELCOME_TEXT'] + app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 33
0
def auth_url():
    """教务系统、图书馆绑定的 URL"""
    jw_url = app.config['HOST_URL'] + '/auth-score/' + openid
    library_url = app.config['HOST_URL'] + '/auth-library/' + openid
    content = app.config['AUTH_TEXT'] % (jw_url, library_url)
    return wechat.response_text(content)
Exemplo n.º 34
0
def phone_number():
    """回复电话号码"""
    content = app.config['PHONE_NUMBER_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 35
0
def developing():
    """维护公告"""
    return wechat.response_text('该功能维护中')
Exemplo n.º 36
0

def get_weather_news():
    """获取天气预报"""
    weather.get.delay(openid)
    return "success"


def update_menu_setting():
    """更新自定义菜单"""
    try:
        wechat.create_menu(app.config["MENU_SETTING"])
    except Exception, e:
        return wechat.response_text(e)
    else:
        return wechat.response_text("Done!")


def developing():
    """维护公告"""
    return wechat.response_text("该功能维护中")


def enter_express_state():
    """进入快递查询模式"""
    set_user_state(openid, "express")
    return wechat.response_text(app.config["ENTER_EXPRESS_STATE_TEXT"])


def cancel_command():
    """取消状态"""
Exemplo n.º 37
0
def cancel_command():
    """取消状态"""
    content = app.config['CANCEL_COMMAND_TEXT'] + app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 38
0
def subscribe():
    """回复订阅事件"""
    content = app.config['WELCOME_TEXT'] + app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 39
0
def cet_score():
    """回复四六级查询网址"""
    content = app.config['CET_SCORE_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 40
0
def search_books():
    """图书馆找书"""
    content = app.config['LIBRARY_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 41
0
def html5_games():
    """HTML5游戏"""
    content = app.config['HTML5_GAMES_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 42
0
def auth_url():
    """教务系统、图书馆绑定的 URL"""
    jw_url = app.config['HOST_URL'] + '/auth-score/' + openid
    library_url = app.config['HOST_URL'] + '/auth-library/' + openid
    content = app.config['AUTH_TEXT'] % (jw_url, library_url)
    return wechat.response_text(content)
Exemplo n.º 43
0
def bbs_url():
    """论坛网址"""
    content = app.config['BBS_URL_TXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 44
0
def auth_url():
    """教务系统、图书馆绑定的 URL"""
    jw_url = app.config["HOST_URL"] + "/auth-score/" + openid
    library_url = app.config["HOST_URL"] + "/auth-library/" + openid
    content = app.config["AUTH_TEXT"] % (jw_url, library_url)
    return wechat.response_text(content)
Exemplo n.º 45
0
def leave_a_message():
    """留言提示"""
    content = app.config['LEAVE_A_MESSAGE_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 46
0

def get_weather_news():
    """获取天气预报"""
    weather.get.delay(openid)
    return 'success'


def update_menu_setting():
    """更新自定义菜单"""
    try:
        wechat.create_menu(app.config['MENU_SETTING'])
    except Exception, e:
        return wechat.response_text(e)
    else:
        return wechat.response_text('Done!')


def developing():
    """维护公告"""
    return wechat.response_text('该功能维护中')


def enter_express_state():
    """进入快递查询模式"""
    set_user_state(openid, 'express')
    return wechat.response_text(app.config['ENTER_EXPRESS_STATE_TEXT'])


def cancel_command():
    """取消状态"""
Exemplo n.º 47
0
def all_command():
    """回复全部指令"""
    content = app.config['COMMAND_TEXT']
    return wechat.response_text(content)
Exemplo n.º 48
0
def developing():
    """维护公告"""
    return wechat.response_text('该功能维护中')
Exemplo n.º 49
0
def phone_number():
    """回复电话号码"""
    content = app.config['PHONE_NUMBER_TEXT'] + app.config['HELP_TEXT']
    return wechat.response_text(content)
Exemplo n.º 50
0

def get_weather_news():
    """获取天气预报"""
    weather.get.delay(openid)
    return 'success'


def update_menu_setting():
    """更新自定义菜单"""
    try:
        wechat.create_menu(app.config['MENU_SETTING'])
    except Exception, e:
        return wechat.response_text(e)
    else:
        return wechat.response_text('Done!')


def developing():
    """维护公告"""
    return wechat.response_text('该功能维护中')


def enter_express_state():
    """进入快递查询模式"""
    set_user_state(openid, 'express')
    return wechat.response_text(app.config['ENTER_EXPRESS_STATE_TEXT'])


def cancel_command():
    """取消状态"""