Пример #1
0
def auth_token_for_oc(request,access_token,openid,uuid,mktid,version,client_type,macaddr,idfa,ios_ver):
    """论证无账号用户
    """
    print "debug_guochen access_token, openid", access_token, openid
    fg = False
    pid = ''
    msg = ''
    subarea = request.REQUEST.get("subarea", "1") or '1'
    #没有openid时,检查后控制自动分配id的开头是否开启,如果已经关闭,返回提示
    if not openid:
       if game_config.system_config.get('account_assign_switch'):
           fg = True
           pid = get_uuid()
           #验证成功,安装用户
           request.rk_user = UserBase._install(pid,'oc',uuid,mktid,version,client_type,macaddr,idfa,ios_ver, subarea=subarea)
           access_token = get_upwd()
           request.rk_user.account.update_info(pid, access_token)
       else:
           msg = get_msg('login','cannot_register')
           return fg,pid,msg
    if not check_openid(openid):
        msg = get_msg('login','cannot_register')
        return fg,pid,msg
    #有openid时,检查access_token是否正确
    account = AccountMapping.get(openid)
    if not account: 
        if game_config.system_config.get('account_assign_switch'):
            fg = True
            pid = openid
            #验证成功,安装用户
            request.rk_user = UserBase._install(pid,'oc',uuid,mktid,version,client_type,macaddr,idfa,ios_ver, subarea=subarea)
            # debug 模式下,将传入的access_token 作为新用户taken
            if settings.DEBUG is True:
                access_token = access_token or get_upwd()
            else:
                access_token = get_upwd()
            request.rk_user.account.update_info(pid, access_token)
            account = request.rk_user.account
            print "debug_guochen_new_token pid, access_token, openid", pid, access_token, openid
        else:
            msg = get_msg('login','cannot_register')
            return fg,pid,msg

    elif account.access_token == access_token:
        fg = True
        pid = openid
        #验证成功,安装用户
        request.rk_user = UserBase._install(pid, 'oc', subarea=subarea)
    else:
        print "debug_guochen_erro_token pid, access_token, openid", pid, access_token, openid
        msg = get_msg('login','session_overdue')
    return fg,pid,msg
Пример #2
0
def auth_token_for_oc(request, access_token, openid, uuid, mktid, version,
                      client_type, macaddr, idfa, ios_ver):
    """论证无账号用户
    """
    print "debug_guochen access_token, openid", access_token, openid
    fg = False
    pid = ''
    msg = ''
    subarea = request.REQUEST.get("subarea", "1") or '1'
    #没有openid时,检查后控制自动分配id的开头是否开启,如果已经关闭,返回提示
    if not openid:
        if game_config.system_config.get('account_assign_switch'):
            fg = True
            pid = get_uuid()
            #验证成功,安装用户
            request.rk_user = UserBase._install(pid,
                                                'oc',
                                                uuid,
                                                mktid,
                                                version,
                                                client_type,
                                                macaddr,
                                                idfa,
                                                ios_ver,
                                                subarea=subarea)
            access_token = get_upwd()
            request.rk_user.account.update_info(pid, access_token)
        else:
            msg = get_msg('login', 'cannot_register')
            return fg, pid, msg
    if not check_openid(openid):
        msg = get_msg('login', 'cannot_register')
        return fg, pid, msg
    #有openid时,检查access_token是否正确
    account = AccountMapping.get(openid)
    if not account:
        if game_config.system_config.get('account_assign_switch'):
            fg = True
            pid = openid
            #验证成功,安装用户
            request.rk_user = UserBase._install(pid,
                                                'oc',
                                                uuid,
                                                mktid,
                                                version,
                                                client_type,
                                                macaddr,
                                                idfa,
                                                ios_ver,
                                                subarea=subarea)
            # debug 模式下,将传入的access_token 作为新用户taken
            if settings.DEBUG is True:
                access_token = access_token or get_upwd()
            else:
                access_token = get_upwd()
            request.rk_user.account.update_info(pid, access_token)
            account = request.rk_user.account
            print "debug_guochen_new_token pid, access_token, openid", pid, access_token, openid
        else:
            msg = get_msg('login', 'cannot_register')
            return fg, pid, msg

    elif account.access_token == access_token:
        fg = True
        pid = openid
        #验证成功,安装用户
        request.rk_user = UserBase._install(pid, 'oc', subarea=subarea)
    else:
        print "debug_guochen_erro_token pid, access_token, openid", pid, access_token, openid
        msg = get_msg('login', 'session_overdue')
    return fg, pid, msg
Пример #3
0
def info(request):
    """获取一些不重要的系统信息,和配置版本号

    获取当前游戏版本号、一些是否可以通过平台登入的开关、
    一些常用配置和各语言包的最后更新时间,前端可以比较这些
    时间判断是否需要发请求更新本地的一些配置
    
    """
    
    params = request.REQUEST
    subarea = params.get("subarea", "1") or '1'
    game_config.set_subarea(subarea)
    # config_update_time = get_config_version(subarea, 'config')
    # if not config_update_time:
    #     up_value = int(time.time())
    # else:
    #     up_value = int(config_update_time)
    update_time_records = setConfigUpdateTime(subarea)

    data = {
        'openid': get_uuid(),
        'version':game_config.system_config['version'],
        'app_url':game_config.system_config['app_url'],
        'server_now':int(time.time()),

        #False for now -- 2014/10/22 Xu Changsen
        'qq_account':game_config.system_config.get('qq_account',False),
        'sina_account':game_config.system_config.get('sina_account',False),

        'fb_account':game_config.system_config.get('fb_account',False),
        'oc_account':game_config.system_config.get('account_assign_switch',False),
        #added 2014/10/22 Xu Changsen
        'qihoo360_account':game_config.system_config.get('qihoo360_account',False),
        'baidu91_account':game_config.system_config.get('baidu91_account',False),


        'christmas':game_config.system_config.get('christmas',False),
        'open_invite':game_config.invite_config.get('open_invite',False),
        'skin_type': game_config.system_config.get('skin_type', ''),#皮肤的样子

        "up_value": update_time_records["config"],
        
        "cup_value": update_time_records["card_config"],
        "mup_value": update_time_records["monster_config"],
        "sup_value": update_time_records["system_config"],
        # "cityup_value": update_time_records["city_config"],
        "equp_value": update_time_records["equip_config"],
        "skill_params_value": update_time_records["skill_params_config"],
        "materialup_value": update_time_records["material_config"],

        'card_desc_version': str(update_time_records["card_desc_config"]),
        'skill_desc_version': str(update_time_records["skill_desc_config"]),
        'equip_desc_version': str(update_time_records["equip_desc_config"]),
        # 'dungeon_desc_version': str(update_time_records["dungeon_desc_config"]),
        'mat_item_desc_version': str(update_time_records["material_desc_config"]),
        "props_desc_config": str(update_time_records["props_desc_config"]),

        'language_version': str(update_time_records["language_config"]),


        'share_image_version':game_config.system_config.get('share_image_version', '100'),
    }
    res_version = params.get('ver', '')
    if res_version:
        res_url, res_ver = get_res_url(res_version, game_config)
        data["res_url"] = res_url
        data["res_ver"] = res_ver
        # 安卓的fb登录标识
        if 'fb_account' in game_config.android_config:
            data['fb_account'] = game_config.android_config['fb_account']
    return HttpResponse(
                json.dumps(data, indent=1),
                content_type='application/x-javascript',
            )