Exemplo n.º 1
0
def handleHttp(dict_param: dict):
    """更改密码"""
    objRsp = cResp()

    strOldPwd = dict_param.get("oldPwd", "")
    Newpwd = dict_param.get("newPwd", "")
    Newpwd2 = dict_param.get("newPwd2", "")
    strAccountId = dict_param.get("accountId", "")
    if not all([strOldPwd, Newpwd, Newpwd2]):
        raise exceptionLogic(errorLogic.client_param_invalid)
    if precompile.Password.search(Newpwd) is None:
        raise exceptionLogic(errorLogic.player_pwd_length_out_of_range)
    objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
    ).getPlayerDataByLock(strAccountId)
    strPwd = PwdEncrypt().create_md5(strOldPwd)
    strNewpwd = PwdEncrypt().create_md5(Newpwd)

    if strPwd != objPlayerData.strPassword:
        raise exceptionLogic(errorLogic.login_only_old_pwd_not_valid)

    if objPlayerData.strPassword == strNewpwd:
        raise exceptionLogic(errorLogic.login_pwd_same_old)
    if Newpwd != Newpwd2:
        raise exceptionLogic(errorLogic.player_pwd_pwd2_not_same)
    else:
        objPlayerData.strPassword = strNewpwd
        yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
            objPlayerData, objLock)

    return classJsonDump.dumps(objRsp)
Exemplo n.º 2
0
def handleHttp(dict_param: dict):
    """更改交易密码"""

    OldTradePwd = dict_param.get("oldTradePwd", "")
    NewTradepwd = dict_param.get("newTradePwd", "")
    NewTradepwd2 = dict_param.get("newTradePwd2", "")
    strAccountId = dict_param.get("accountId", "")
    if not all([OldTradePwd, NewTradepwd, NewTradepwd2]):
        raise exceptionLogic(errorLogic.client_param_invalid)
    if precompile.TradePassword.search(NewTradepwd) is None:
        raise exceptionLogic(errorLogic.player_TradePwd_length_out_of_range)
    if NewTradepwd != NewTradepwd2:
        raise exceptionLogic(errorLogic.player_pwd_pwd2_not_same)
    strTradePwd = PwdEncrypt().create_md5(NewTradepwd)
    strOldTradePwd = PwdEncrypt().create_md5(OldTradePwd)

    objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
    ).getPlayerDataByLock(strAccountId)

    if objPlayerData.strTradePassword == strTradePwd:
        raise exceptionLogic(errorLogic.login_pwd_same_old)

    if objPlayerData.strTradePassword != strOldTradePwd:
        raise exceptionLogic(errorLogic.login_only_old_pwd_not_valid)

    if objPlayerData.strTradePassword == strTradePwd:
        raise exceptionLogic(errorLogic.login_pwd_same_old)
    else:
        objPlayerData.strTradePassword = strTradePwd
        yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
            objPlayerData, objLock)
Exemplo n.º 3
0
def handleHttp(dict_param: dict):
    """设置交易密码"""
    objRsp = cResp()

    TradePwd = dict_param.get("tradePwd", "")
    TradePwd2 = dict_param.get("tradePwd2", "")
    strAccountId = dict_param.get("accountId", "")

    if not all([TradePwd, TradePwd2]):
        raise exceptionLogic(errorLogic.client_param_invalid)
    if TradePwd != TradePwd2:
        raise exceptionLogic(errorLogic.player_pwd_pwd2_not_same)
    if precompile.TradePassword.search(TradePwd) is None:
        raise exceptionLogic(errorLogic.player_TradePwd_length_out_of_range)
    objPlayerData, objLock = yield from classDataBaseMgr.getInstance().getPlayerDataByLock(strAccountId)
    strTradePwd = PwdEncrypt().create_md5(TradePwd)
    objPlayerData.strTradePassword = strTradePwd
    yield from classDataBaseMgr.getInstance().setPlayerDataByLock(objPlayerData, objLock)

    objRsp.data = cData()
    if objPlayerData.strTradePassword:
        objRsp.data.tradePwd = 1
    else:
        objRsp.data.tradePwd = 0

    return classJsonDump.dumps(objRsp)
Exemplo n.º 4
0
def handleHttp(dict_param: dict):
    """设置新密码"""

    strEmail = dict_param.get("email", "")
    strPhone = dict_param.get("phoneNum", "")
    strNewPwd = dict_param.get("newPwd", "")
    strNewPwd2 = dict_param.get("newPwd2", "")
    if not all([strNewPwd, strNewPwd2]):
        raise exceptionLogic(errorLogic.client_param_invalid)
    # 验证密码的格式是否正确
    if precompile.Password.search(strNewPwd) is None:
        raise exceptionLogic(errorLogic.player_pwd_length_out_of_range)
    if strNewPwd != strNewPwd2:
        raise exceptionLogic(errorLogic.player_pwd_pwd2_not_same)
    if strPhone and strEmail:
        raise exceptionLogic(errorLogic.client_param_invalid)
    if strEmail == "" and strPhone == "":
        raise exceptionLogic(errorLogic.client_param_invalid)
    if strPhone:
        strAccountId = yield from classDataBaseMgr.getInstance(
        ).getPhoneAccountMapping(strPhone)
        if not strAccountId:
            raise exceptionLogic(errorLogic.player_data_not_found)

        objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
        ).getPlayerDataByLock(strAccountId)
        if objPlayerData is None:
            raise exceptionLogic(errorLogic.player_data_not_found)
        else:
            strPwd = PwdEncrypt().create_md5(strNewPwd)
            objPlayerData.strPassword = strPwd
            yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
                objPlayerData, objLock)

    if strEmail:
        strAccountId = yield from classDataBaseMgr.getInstance(
        ).getEmailAccountMapping(strEmail)

        objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
        ).getPlayerDataByLock(strAccountId)
        if objPlayerData is None:
            raise exceptionLogic(errorLogic.player_data_not_found)
        else:
            strPwd = PwdEncrypt().create_md5(strNewPwd)
            objPlayerData.strPassword = strPwd
            yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
                objPlayerData, objLock)
Exemplo n.º 5
0
def handleHttp(dict_param: dict):
    """提款"""
    objRsp = cResp()

    strAccountId = dict_param.get("accountId", "")
    strCardNum = str(dict_param.get("cardNum", ""))
    TradePwd = dict_param.get("tradePwd", "")
    money = dict_param.get("money", "")
    if not all([strCardNum, money]):
        raise exceptionLogic(errorLogic.client_param_invalid)
    if cpv.checkIsString(money):
        raise exceptionLogic(errorLogic.client_param_invalid)
    fMoney = float(money)
    if not cpv.checkIsFloat(fMoney):
        raise exceptionLogic(errorLogic.client_param_invalid)
    iCoin = int(fMoney * 100)
    if not cpv.checkIsInt(iCoin):
        raise exceptionLogic(errorLogic.client_param_invalid)

    strTradePwd = PwdEncrypt().create_md5(TradePwd)

    objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
    ).getPlayerDataByLock(strAccountId)
    if not objPlayerData.strTradePassword:
        raise exceptionLogic(errorLogic.trade_pwde_not_bind)
    if strTradePwd != objPlayerData.strTradePassword:
        raise exceptionLogic(errorLogic.trade_pwde_not_valid)

    # 获取可提现额度
    drawinglimit = round(
        (objPlayerData.iCoin - objPlayerData.iNotDrawingCoin) / 100, 2)

    Coin = round(iCoin / 100)
    if not cpv.checkIsInt(Coin):
        raise exceptionLogic(errorLogic.player_drawing_coin_not_int)
    if Coin > drawinglimit:
        raise exceptionLogic(errorLogic.player_drawing_not_enough)
    if objPlayerData.iCoin < iCoin:
        raise exceptionLogic(errorLogic.player_coin_not_enough)
    else:
        balance = objPlayerData.iCoin - iCoin
        # redis 事务操作以及余额的处理
        objPlayerData.iCoin -= iCoin
        yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
            objPlayerData, objLock)

        yield from addPlayerBill(strAccountId, iCoin, balance,
                                 CoinOp.coinOpDraw, 2, "中心钱包", strCardNum)

    newdrawinglimit = drawinglimit - Coin
    objRsp.data = cData()
    objRsp.data.iCoin = "%.2f" % round(objPlayerData.iCoin / 100, 2)
    objRsp.data.newDrawingLimit = newdrawinglimit

    return classJsonDump.dumps(objRsp)
Exemplo n.º 6
0
def handleHttp(request: dict):
    userId = request.get('userId', '')
    password = request.get('password', '')
    transPwd = request.get('transPwd', '')
    phone = request.get('phone', '')
    email = request.get('email', '')
    lockTime = request.get('lockTime', '')
    lockReason = request.get('lockReason', '')
    status = request.get('status', '')
    level = request.get('level', '')
    realName = request.get('realName', '')

    if not userId:
        logging.debug(errorLogic.client_param_invalid)
        raise exceptionLogic(errorLogic.client_param_invalid)
    try:
        objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
        ).getPlayerDataByLock(userId)
        if objPlayerData is None:
            logging.debug(errorLogic.player_data_not_found)
            raise exceptionLogic(errorLogic.player_data_not_found)
        fileName = __name__
        nameList = fileName.split('.')
        methodName = nameList.pop()
        # 日志
        dictActionBill = {
            'billType': 'adminActionBill',
            'accountId': request.get('accountId', ''),
            'action': "修改用户信息",
            'actionTime': getNow(),
            'actionMethod': methodName,
            'actionIp': request.get('srcIp', ''),
        }

        if password:
            # 修改密码
            pwd_md5 = PwdEncrypt().create_md5(password)
            objPlayerData.strPassword = pwd_md5
            dictActionBill['actionDetail'] = "修改用户:{} 的登录密码".format(userId)
        elif phone:
            objPlayerData.strPhone = phone
            dictActionBill['actionDetail'] = "修改用户:{} 的电话号码为:{}".format(
                userId, phone)
        elif email:
            objPlayerData.strEmail = email
            dictActionBill['actionDetail'] = "修改用户:{} 的邮箱为:{}".format(
                userId, email)
        elif level:
            objPlayerData.iLevel = level
            dictActionBill['actionDetail'] = "修改用户:{} 的等级为:{}".format(
                userId, level)
        elif transPwd:
            #修改交易密码
            if precompile.TradePassword.search(transPwd) is None:
                raise exceptionLogic(
                    errorLogic.player_TradePwd_length_out_of_range)
            strTradePwd = PwdEncrypt().create_md5(transPwd)
            objPlayerData.strTradePassword = strTradePwd
            dictActionBill['actionDetail'] = "修改用户:{} 的交易密码".format(userId)
        elif realName:
            objPlayerData.strRealName = realName
            dictActionBill['actionDetail'] = "修改用户:{} 的姓名为:{}".format(
                userId, realName)
        else:
            if status == 0:
                # 解封
                objPlayerData.iStatus = status
                objPlayerData.iLockStartTime = 0
                objPlayerData.iLockEndTime = 0
                objPlayerData.strLockReason = ""
                # yield from update_status(userId,'ACTIVE')

            else:
                # 冻结账号
                if not all([lockTime, lockReason]):
                    logging.debug(errorLogic.lockTime_or_lockReason_lack)
                    raise exceptionLogic(
                        errorLogic.lockTime_or_lockReason_lack)
                objPlayerData.iStatus = 1
                objPlayerData.iLockStartTime = timeHelp.getNow()
                objPlayerData.iLockEndTime = timeHelp.getNow() + int(lockTime)
                objPlayerData.strLockReason = lockReason
                # yield from update_status(userId,'SUSPENDED')
            dictActionBill[
                'actionDetail'] = "为用户:{} 解封账号" if status == 0 else "冻结用户:{} 账号,冻结原因:{}".format(
                    userId, lockReason)

        yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
            objPlayerData, objLock)
        logging.getLogger('bill').info(json.dumps(dictActionBill))
        resp = cResp()

        data = cData()
        data.realName = objPlayerData.strRealName
        data.accountId = objPlayerData.strAccountId
        data.phone = objPlayerData.strPhone
        data.coin = "%.2f" % round(objPlayerData.iCoin / 100, 2)
        data.guessCoin = "%.2f" % round(objPlayerData.iGuessCoin / 100, 2)
        data.pinboCoin = "%.2f" % round(objPlayerData.iPingboCoin / 100, 2)
        #todo 188
        data.coin188 = "%.2f" % round(0 / 100, 2)
        data.regTime = objPlayerData.iRegTime
        data.email = objPlayerData.strEmail
        data.loginTime = objPlayerData.iLastLoginTime
        data.loginIp = [
            objPlayerData.strLastLoginUdid, objPlayerData.strLoginAdderss
        ]
        data.logoutTime = objPlayerData.iLogoutTime
        data.level = objPlayerData.iLevel
        data.status = [
            objPlayerData.iStatus, objPlayerData.iLockEndTime,
            objPlayerData.strLockReason
        ]
        data.bankcard = objPlayerData.arrayBankCard
        resp.data.append(data)

        # 操作用户日志
        conect = classSqlBaseMgr.getInstance()
        with (yield from classSqlBaseMgr.getInstance(
                instanceName='probet_oss').objDbMysqlMgr) as conn:
            sql = select([tb_dj_admin_action_bill]).where(
                tb_dj_admin_action_bill.c.actionDetail.like('%' + userId +
                                                            '%'))
            ret = yield from conn.execute(sql)
            listRes = yield from ret.fetchall()
            for log in listRes:
                logData = UserLogData()
                logData.time = log['actionTime']
                logData.adminAccount = log['accountId']
                logData.detail = log['actionDetail']
                roleNameSql = "select role_name from dj_admin_role WHERE id=(SELECT role_id from dj_admin_account WHERE accountId='{}')".format(
                    log['accountId'])
                roleNameRet = yield from conect._exeCute(roleNameSql)
                roleName = yield from roleNameRet.fetchone()
                logData.roleName = "该管理员不在系统中" if roleName is None else roleName[
                    0]
                resp.logData.append(logData)
        return classJsonDump.dumps(resp)
    except exceptionLogic as e:
        logging.error(repr(e))
        raise e
Exemplo n.º 7
0
def handleHttp(dict_param: dict):
    """app登陆"""
    objRsp = cResp()

    agentId = dict_param.get("agentId", "")
    password = dict_param.get("password", "")
    token = dict_param.get("token", "")
    if not agentId:
        raise exceptionLogic(errorLogic.client_param_invalid)
    if password or token:
        if password:
            strPwd = PwdEncrypt().create_md5(password)

            objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
            ).getPlayerDataByLock(agentId)
            objAgentData = yield from classDataBaseMgr.getInstance(
            ).getAgentData(agentId)
            if objPlayerData is None:
                raise exceptionLogic(errorLogic.player_data_not_found)
            sql = "select status from dj_agent_apply where agentId=%s"
            with (yield from
                  classSqlBaseMgr.getInstance().objDbMysqlMgr) as conn:
                result = yield from conn.execute(sql, [agentId])
                if result.rowcount <= 0:
                    raise exceptionLogic(errorLogic.agent_data_not_found)
                else:
                    for var_row in result:
                        status = var_row.status
            if status == 1:
                raise exceptionLogic(errorLogic.agent_id_under_review)
            if objAgentData is None:
                raise exceptionLogic(errorLogic.agent_data_not_found)
            if objPlayerData.iUserType != 2:
                raise exceptionLogic(errorLogic.agent_data_not_found)
            if strPwd != objPlayerData.strPassword:
                yield from classDataBaseMgr.getInstance(
                ).releasePlayerDataLock(agentId, objLock)
                raise exceptionLogic(errorLogic.login_pwd_not_valid)
            if timeHelp.getNow() < objPlayerData.iLockEndTime:
                yield from classDataBaseMgr.getInstance(
                ).releasePlayerDataLock(agentId, objLock)
                raise exceptionLogic(errorLogic.player_id_invalid)
            else:
                # objAgentData.strAppToken = generate_token(agentId)
                objAgentData.strToken = generate_token(agentId)
                objPlayerData.iStatus = 0
                objPlayerData.iLockStartTime = 0
                objPlayerData.iLockEndTime = 0
                objPlayerData.strLockReason = ""
                objPlayerData.iLastLoginTime = timeHelp.getNow()
                yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
                    objPlayerData, objLock)

        else:
            certify_token(agentId, token)
            objPlayerData = yield from classDataBaseMgr.getInstance(
            ).getPlayerData(agentId)
            objAgentData = yield from classDataBaseMgr.getInstance(
            ).getAgentData(agentId)
            if objPlayerData is None:
                raise exceptionLogic(errorLogic.user_data_not_found)
            sql = "select status from dj_agent_apply where agentId=%s"
            with (yield from
                  classSqlBaseMgr.getInstance().objDbMysqlMgr) as conn:
                result = yield from conn.execute(sql, [agentId])
                if result.rowcount <= 0:
                    raise exceptionLogic(errorLogic.agent_data_not_found)
                else:
                    for var_row in result:
                        status = var_row.status
            if status == 1:
                raise exceptionLogic(errorLogic.agent_id_under_review)
            if objAgentData is None:
                raise exceptionLogic(errorLogic.agent_data_not_found)
            if objPlayerData.iUserType != 2:
                raise exceptionLogic(errorLogic.agent_data_not_found)
            # if token != objAgentData.strAppToken:
            if token != objAgentData.strToken:
                raise exceptionLogic(errorLogic.login_token_not_valid)
            if timeHelp.getNow() < objAgentData.iLockEndTime:
                raise exceptionLogic(errorLogic.player_id_invalid)
            else:
                objAgentData.iStatus = 0
                objAgentData.iLockStartTime = 0
                objAgentData.iLockEndTime = 0
                objAgentData.strLockReason = ""
        yield from classDataBaseMgr.getInstance().setAgentData(objAgentData)
        unReadNum = yield from classSqlBaseMgr.getInstance(
        ).getAgentMsgUnReadNum(agentId)
        # 构造回包
        objRsp.data = cData()
        objRsp.data.agentId = objPlayerData.strAccountId
        objRsp.data.token = objAgentData.strToken
        objRsp.data.cid = objAgentData.iCid
        objRsp.data.headAddress = objPlayerData.strHeadAddress
        objRsp.data.count = unReadNum
        return classJsonDump.dumps(objRsp)
    else:
        raise exceptionLogic(errorLogic.client_param_invalid)
Exemplo n.º 8
0
def handleHttp(dict_param: dict):
    """注册"""

    #TODO 去掉限制注册的提示
    #if not procVariable.debug:
    #    raise exceptionLogic(errorLogic.player_reg_limited)

    objRsp = cResp()

    strAccountId = dict_param.get("accountId", "")
    strPassword = dict_param.get("password", "")
    iCid = dict_param.get("cid", 0)
    source = dict_param.get('source', '')
    if iCid:
        try:
            iCid = int(iCid)
            agentId = yield from classDataBaseMgr.getInstance().getAgentCodeMapping(iCid)
        except Exception as e:
            logging.error(repr(e))
            raise exceptionLogic(errorLogic.client_param_invalid)
    else:
        agentId = ""
    if not all([strAccountId, strPassword, source]):
        raise exceptionLogic(errorLogic.client_param_invalid)

    if precompile.ChineseOrEmptyCharRegex.search(strAccountId):
        raise exceptionLogic(errorLogic.player_pwd_length_out_of_range)

    if precompile.Password.search(strPassword) is None:
        raise exceptionLogic(errorLogic.player_pwd_length_out_of_range)

    objPlayerData  = yield from classDataBaseMgr.getInstance().getPlayerData(strAccountId)
    if objPlayerData is None:
        #注册pinbo
        objPlayerData = classUserData()
        objPlayerData.strAccountId = strAccountId
        objPlayerData.strNick = strAccountId
        objPlayerData.iRegTime = timeHelp.getNow()
        objPlayerData.iLastLoginTime = timeHelp.getNow()
        objPlayerData.strAgentId = agentId
        #objPlayerData.iRandomSecert = random.randint()
        objPlayerData.strPassword = PwdEncrypt().create_md5(strPassword)
        if source == 'pc':
            objPlayerData.strToken = generate_token(strAccountId)
        elif source == 'app':
            objPlayerData.strAppToken = generate_token(strAccountId)
        objPlayerData.strLastLoginIp = dict_param.get("srcIp","")

        if procVariable.debug:
            objPlayerData.iCoin += 100000
            objPlayerData.iGuessCoin += 50000

        #后注册pinbo
        yield from register_pinbo(strAccountId)

        SysMsgData = welcomeMsg(strAccountId)
        yield from classDataBaseMgr.getInstance().addSystemMsg(SysMsgData)
        yield from asyncio.sleep(0.5)
        unReadNum = yield from classSqlBaseMgr.getInstance().getSysMsgUnReadNum(strAccountId)

        yield from initActiveData(strAccountId)

        yield from classDataBaseMgr.getInstance().setPlayerDataByLock(objPlayerData, new=True)
    else:
        raise exceptionLogic(errorLogic.player_id_already_exist)

    # 构造回包
    objRsp.data = cData()
    objRsp.data.accountId = strAccountId
    if source == 'pc':
        objRsp.data.token = objPlayerData.strToken
    elif source == 'app':
        objRsp.data.token = objPlayerData.strAppToken
    objRsp.data.nick = objPlayerData.strNick
    objRsp.data.headAddress = ""
    objRsp.data.coin = "%.2f"%round(objPlayerData.iCoin/100, 2)
    objRsp.data.unReadNum = unReadNum
    objRsp.data.phoneNum = objPlayerData.strPhone
    objRsp.data.tradePwd = 0
    objRsp.data.email = objPlayerData.strEmail
    objRsp.data.bankCard = objPlayerData.arrayBankCard
    # objRsp.data.pinbo_id=pinbo_id
    #初始化所有活动
    yield from initActiveData(strAccountId)
    # 日志
    dictReg = {
        'billType': 'regBill',
        'accountId': objPlayerData.strAccountId,
        'regTime': timeHelp.getNow(),
        'regIp':objPlayerData.strLastLoginIp,
        'channel':objPlayerData.iPlatform,
        'regDevice':objPlayerData.strLastDeviceName,
        'agentId':objPlayerData.strAgentId
    }
    logging.getLogger('bill').info(json.dumps(dictReg))

    # 日志
    dictLogin = {
        'billType': 'loginBill',
        'accountId': objPlayerData.strAccountId,
        'agentId': objPlayerData.strAgentId,
        'loginTime': timeHelp.getNow(),
        'coin': objPlayerData.iCoin,
        'vipLevel': objPlayerData.iLevel,
        'loginDevice': objPlayerData.strLastDeviceModal,
        'loginIp': objPlayerData.strLastLoginIp,
        'vipExp': objPlayerData.iLevelValidWater,
    }
    logging.getLogger('bill').info(json.dumps(dictLogin))

    return classJsonDump.dumps(objRsp)
Exemplo n.º 9
0
def handleHttp(dict_param: dict):
    """登陆"""
    objRsp = cResp()

    # TODO 多设备同时登陆
    source = dict_param.get('source', 'pc')
    strAccountId = dict_param.get("accountId", "")
    strPassword = dict_param.get("password", "")
    strToken = dict_param.get("token", "")
    if not all([strAccountId, source]):
        raise exceptionLogic(errorLogic.client_param_invalid)

    if strToken or strPassword:
        if strPassword:
            strPwd = PwdEncrypt().create_md5(strPassword)

            objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
            ).getPlayerDataByLock(strAccountId)

            if objPlayerData is None:
                raise exceptionLogic(errorLogic.player_data_not_found)
            if strPwd != objPlayerData.strPassword:
                yield from classDataBaseMgr.getInstance(
                ).releasePlayerDataLock(strAccountId, objLock)
                raise exceptionLogic(errorLogic.login_pwd_not_valid)
            if timeHelp.getNow() < objPlayerData.iLockEndTime:
                yield from classDataBaseMgr.getInstance(
                ).releasePlayerDataLock(strAccountId, objLock)
                raise exceptionLogic(errorLogic.player_id_invalid)
            else:
                if source == 'pc':
                    objPlayerData.strToken = generate_token(strAccountId)
                elif source == 'app':
                    objPlayerData.strAppToken = generate_token(strAccountId)
                else:
                    raise exceptionLogic(errorLogic.client_param_invalid)
                objPlayerData.iStatus = 0
                objPlayerData.iLockStartTime = 0
                objPlayerData.iLockEndTime = 0
                objPlayerData.strLockReason = ""
                objPlayerData.strLastDeviceName = ""  #macAddr
                objPlayerData.iLastLoginTime = timeHelp.getNow()
                objPlayerData.strLastLoginIp = dict_param.get("srcIp", "")
                yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
                    objPlayerData, objLock)
                #yield from update_status(strAccountId, 'ACTIVE')
            unReadNum = yield from classSqlBaseMgr.getInstance(
            ).getSysMsgUnReadNum(strAccountId)
        else:
            certify_token(strAccountId, strToken)
            objPlayerData, objLock = yield from classDataBaseMgr.getInstance(
            ).getPlayerDataByLock(strAccountId)

            if objPlayerData is None:
                raise exceptionLogic(errorLogic.player_data_not_found)
            if source == 'pc':
                if strToken != objPlayerData.strToken:
                    yield from classDataBaseMgr.getInstance(
                    ).releasePlayerDataLock(strAccountId, objLock)
                    raise exceptionLogic(errorLogic.login_token_not_valid)
            elif source == 'app':
                if strToken != objPlayerData.strAppToken:
                    yield from classDataBaseMgr.getInstance(
                    ).releasePlayerDataLock(strAccountId, objLock)
                    raise exceptionLogic(errorLogic.login_token_not_valid)
            else:
                raise exceptionLogic(errorLogic.client_param_invalid)
            if timeHelp.getNow() < objPlayerData.iLockEndTime:
                yield from classDataBaseMgr.getInstance(
                ).releasePlayerDataLock(strAccountId, objLock)
                raise exceptionLogic(errorLogic.player_id_invalid)
            else:
                objPlayerData.iStatus = 0
                objPlayerData.iLockStartTime = 0
                objPlayerData.iLockEndTime = 0
                objPlayerData.strLockReason = ""
                objPlayerData.iLastLoginTime = timeHelp.getNow()
                objPlayerData.strLastLoginIp = dict_param.get("srcIp", "")
                objPlayerData.strLastDeviceName = ""  #macAddr
                yield from classDataBaseMgr.getInstance().setPlayerDataByLock(
                    objPlayerData, objLock)
                # yield from update_status(strAccountId, 'ACTIVE')
            unReadNum = yield from classSqlBaseMgr.getInstance(
            ).getSysMsgUnReadNum(strAccountId)
    else:
        raise exceptionLogic(errorLogic.client_param_invalid)

    # 构造回包
    objRsp.data = cData()
    if source == "pc":
        objRsp.data.token = objPlayerData.strToken
    elif source == "app":
        objRsp.data.token = objPlayerData.strAppToken
    objRsp.data.accountId = objPlayerData.strAccountId
    objRsp.data.nick = objPlayerData.strNick
    objRsp.data.coin = "%.2f" % round(objPlayerData.iCoin / 100, 2)
    objRsp.data.headAddress = objPlayerData.strHeadAddress
    objRsp.data.unReadNum = unReadNum
    objRsp.data.phoneNum = objPlayerData.strPhone
    objRsp.data.realName = objPlayerData.strRealName
    objRsp.data.sex = objPlayerData.strSex
    objRsp.data.born = objPlayerData.strBorn
    objRsp.data.address = objPlayerData.dictAddress
    objRsp.data.userType = objPlayerData.iUserType
    objRsp.data.mac = objPlayerData.strLastDeviceName
    if objPlayerData.strTradePassword:
        objRsp.data.tradePwd = 1
    else:
        objRsp.data.tradePwd = 0
    objRsp.data.email = objPlayerData.strEmail
    objRsp.data.bankCard = objPlayerData.arrayBankCard
    #日志
    dictLogin = {
        'billType': 'loginBill',
        'accountId': objPlayerData.strAccountId,
        'agentId': objPlayerData.strAgentId,
        'loginTime': timeHelp.getNow(),
        'coin': objPlayerData.iCoin,
        'vipLevel': objPlayerData.iLevel,
        'loginDevice': objPlayerData.strLastDeviceModal,
        'loginIp': objPlayerData.strLastLoginIp,
        'vipExp': objPlayerData.iLevelValidWater,
    }
    logging.getLogger('bill').info(json.dumps(dictLogin))

    return classJsonDump.dumps(objRsp)