def post(self, code): if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} if g.current_member.isTsetPLay == 1: return { 'errorCode': "3030", 'errorMsg': "试玩用户不提供此功能", 'success': False } ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member m_data = ce.balance(None) return m_data
def post(self, code): parser = RequestParser(trim=True) parser.add_argument('deviceTypeCode', type=str) # 電腦版: PC, 手機版: Mobile parser.add_argument('gameCode', type=str) #游戏代码 parser.add_argument('isDemo', type=str, default=0) #是否试玩,默认否 kargs = parser.parse_args(strict=True) if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} # if g.current_member.isTsetPLay == 1: # return { 'errorCode': "3030",'errorMsg':"试玩用户不提供此功能", 'success': False} ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member m_data = ce.login(kargs) return m_data
def post(self, code): parser = RequestParser(trim=True) parser.add_argument('isDemo', type=int) parser.add_argument('merchantCode', type=str) parser.add_argument('username', type=str) parser.add_argument('token', type=str) parser.add_argument('timestamp', type=str) kargs = parser.parse_args(strict=True) if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} # if g.current_member.isTsetPLay == 1: # return { 'errorCode': "3030",'errorMsg':"试玩用户不提供此功能", 'success': False} ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member m_data = ce.register() return m_data
def post(self, code): parser = RequestParser(trim=True) parser.add_argument('amount', type=float) kargs = parser.parse_args(strict=True) if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} if g.current_member.isTsetPLay == 1: return { 'errorCode': "3030", 'errorMsg': "试玩用户不提供此功能", 'success': False } ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member ce.context["orderid"] = createECOrderId(g.current_member.id) ce.context['amount'] = kargs['amount'] m_data = ce.withdrawal(kargs) return m_data
def post(self): if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} parser = RequestParser(trim=True) parser.add_argument('fromEC', type=str, required=True) #源娱乐城 parser.add_argument('toEC', type=str, required=True) #目标娱乐城 parser.add_argument('amount', type=float, required=True) #金额 parser.add_argument('isDemo', type=int, default=0) #金额 kargs = parser.parse_args(strict=True) if g.current_member.username not in tempUser: return {"success": False, 'errorCode': 3000, 'errorMsg': "没有权限"} amount = kargs['amount'] if amount < 1: return {"success": False, 'errorCode': 3001, 'errorMsg': "转账发生错误"} fromEC = kargs['fromEC'] toEC = kargs['toEC'] mContext = {} mContext["member"] = g.current_member mContext["ip"] = host_to_value(request.remote_addr) mContext["real_ip"] = request.remote_addr mContext["loginEC"] = toEC #选择登录的娱乐城 current_app.logger.info('---------%s从%s转账到%s 开始------------' % (g.current_member.username, fromEC, toEC)) m_data = {'success': True} if fromEC == 'MAIN': ce = EntertainmentCityFactory.getEntertainmentCity(toEC) ce.context["member"] = g.current_member ce.register() m_data = AmountTransfer.accountToEntertainmentCity( mContext, kargs, ce) elif toEC == 'MAIN': m_data = AmountTransfer.withdrawalToAccount(mContext, kargs) # else: # m_data = AmountTransfer.withdrawalToAccount(mContext,kargs) # ce = EntertainmentCityFactory.getEntertainmentCity(toEC); # ce.context["member"] = g.current_member # m_data = AmountTransfer.accountToEntertainmentCity(mContext,kargs,ce) #AmountTransfer.saveECLog(g.current_member.id, g.current_member.username, int(time.time()), toEC, mContext['ip']) current_app.logger.info('---------%s从%s转账到%s 结束------------' % (g.current_member.username, fromEC, toEC)) return m_data
def get(self, code): if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} if g.current_member.isTsetPLay == 1: return { 'errorCode': "3030", 'errorMsg': "试玩用户不提供此功能", 'success': False } parser = RequestParser(trim=True) parser.add_argument('startDate', type=str) parser.add_argument('endDate', type=str) parser.add_argument('pageIndex', type=int) parser.add_argument('gameType', type=str) kargs = parser.parse_args(strict=True) ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member m_data = ce.betRecord(kargs) return m_data.text
def post(self, code): if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} if g.current_member.isTsetPLay == 1: return { 'errorCode': "3030", 'errorMsg': "试玩用户不提供此功能", 'success': False } parser = RequestParser(trim=True) parser.add_argument('merchantCode', type=str) parser.add_argument('merchantTransSN', type=str) # parser.add_argument('GameTransSN', type=str) parser.add_argument('timestamp', type=str) # parser.add_argument('username', type=str) kargs = parser.parse_args(strict=True) ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = g.current_member m_data = ce.checkTransfer(kargs) return m_data
def get(self, code): ce = EntertainmentCityFactory.getEntertainmentCity(code) m_data = ce.gameList(1) return m_data
def everybalence(self, code, name): member = UpdataallWallet(name) ce = EntertainmentCityFactory.getEntertainmentCity(code) ce.context["member"] = member.username m_data = ce.updatebalance(ce.context["member"]) return m_data
def job_1(limit): timeStamp = int(time.time()) startDate = ( datetime.datetime.fromtimestamp(timeStamp) + datetime.timedelta(seconds=-limit + 1)).strftime("%Y-%m-%d %H:%M:%S") endDate = (datetime.datetime.fromtimestamp(timeStamp) ).strftime("%Y-%m-%d %H:%M:%S") with scheduler.app.app_context(): current_app.logger.info('同步交易记录 %s至 %s 开始' % (startDate, endDate)) ecList = getECByDB() try: for ec in ecList: if ec == 'kk': continue current_app.logger.info('同步%s交易记录 %s至 %s 开始' % (ec, startDate, endDate)) ceEntity = None try: ceEntity = EntertainmentCityFactory.getEntertainmentCity( ec) except Exception as e: current_app.logger.exception(e) current_app.logger.error('同步%s数据异常 %s至 %s' % (ec, startDate, endDate)) continue if ec == 'AG': gtList = ['Live', 'Slot', 'Hunter', 'Yoplay', 'Sport'] for gameType in gtList: try: records_DB = None allRecords = getAllBetRecords( ceEntity, gameType, startDate, endDate) #current_app.logger.info(allRecords) if allRecords and allRecords is not None: from app.entertainmentcity.EntertainmentCityEnum import ECTypeEnum gameTypeCode = ECTypeEnum[gameType].value records_DB = diffBetRecords( ec, gameTypeCode, allRecords, billNoEnum[ec].value) if records_DB and records_DB is not None: ceEntity.saveBetRecordsToDB( ec, gameType, records_DB) except Exception as e: current_app.logger.exception(e) current_app.logger.error( '同步%s-%s数据异常 %s至 %s' % (ec, gameType, startDate, endDate)) if ec == 'PT': allRecords = getAllBetRecords( ceEntity, ceEntity.context['gameTypes'], startDate, endDate) #current_app.logger.info(allRecords) try: records_DB = None if allRecords is not None: records_DB = diffBetRecords( ec, ceEntity.context['gameTypes'], allRecords, billNoEnum[ec].value) #allRecords = json.loads('[{"GameID":"50-1559618295-147909177-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020049","ChairID":"3","UserCount":"4","CellScore":"5.00","AllBet":"5.00","Profit":"-5.00","Revenue":"0.00","CardValue":"3d1d2236262b1119350b08170000001","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:18:15","GameEndTime":"2019-06-04T11:18:57","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618346-147910646-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020116","ChairID":"4","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"2c04031b2a370c15223a09360a29333","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:06","GameEndTime":"2019-06-04T11:19:19","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618361-147911112-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020270","ChairID":"4","UserCount":"3","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0000001c0c332a28252908320000003","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:21","GameEndTime":"2019-06-04T11:19:36","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618400-147912269-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020278","ChairID":"3","UserCount":"4","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0c0522213b170b1a351129140000004","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:00","GameEndTime":"2019-06-04T11:20:11","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618385-147911824-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020004","ChairID":"4","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"1d2b132a09033a39352d04022505155","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:45","GameEndTime":"2019-06-04T11:20:21","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618421-147912848-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020261","ChairID":"4","UserCount":"3","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0000002118162b17050b15230000002","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:21","GameEndTime":"2019-06-04T11:20:37","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618439-147913400-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020225","ChairID":"4","UserCount":"4","CellScore":"3.00","AllBet":"3.00","Profit":"10.45","Revenue":"0.55","CardValue":"2313190000003905142c0c033c0b374","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:39","GameEndTime":"2019-06-04T11:20:56","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618463-147914137-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020124","ChairID":"3","UserCount":"3","CellScore":"3.00","AllBet":"3.00","Profit":"2.85","Revenue":"0.15","CardValue":"0000002a09043313160d39320000003","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:03","GameEndTime":"2019-06-04T11:21:14","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618482-147914656-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020145","ChairID":"3","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"3118121d2c273d0b2a2d28220807144","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:22","GameEndTime":"2019-06-04T11:21:35","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618496-147915101-1","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020218","ChairID":"1","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"3c16250d2908012d3919370526061a5","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:36","GameEndTime":"2019-06-04T11:21:55","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"}]') if records_DB and records_DB is not None: ceEntity.saveBetRecordsToDB( ec, ceEntity.context['gameTypes'], records_DB) except Exception as e: current_app.logger.exception(e) current_app.logger.error('同步%s数据异常 %s至 %s' % (ec, startDate, endDate)) if ec == 'KAIYUAN': allRecords = getAllBetRecords( ceEntity, ceEntity.context['gameTypes'], startDate, endDate) #current_app.logger.info(allRecords) try: records_DB = None if allRecords is not None: records_DB = diffBetRecords( ec, ceEntity.context['gameTypes'], allRecords, billNoEnum[ec].value) # allRecords = json.loads('[{"GameID":"50-1559618295-147909177-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020049","ChairID":"3","UserCount":"4","CellScore":"5.00","AllBet":"5.00","Profit":"-5.00","Revenue":"0.00","CardValue":"3d1d2236262b1119350b08170000001","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:18:15","GameEndTime":"2019-06-04T11:18:57","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618346-147910646-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020116","ChairID":"4","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"2c04031b2a370c15223a09360a29333","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:06","GameEndTime":"2019-06-04T11:19:19","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618361-147911112-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020270","ChairID":"4","UserCount":"3","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0000001c0c332a28252908320000003","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:21","GameEndTime":"2019-06-04T11:19:36","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:27:01.96"},{"GameID":"50-1559618400-147912269-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020278","ChairID":"3","UserCount":"4","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0c0522213b170b1a351129140000004","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:00","GameEndTime":"2019-06-04T11:20:11","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618385-147911824-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020004","ChairID":"4","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"1d2b132a09033a39352d04022505155","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:19:45","GameEndTime":"2019-06-04T11:20:21","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618421-147912848-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020261","ChairID":"4","UserCount":"3","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"0000002118162b17050b15230000002","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:21","GameEndTime":"2019-06-04T11:20:37","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618439-147913400-4","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020225","ChairID":"4","UserCount":"4","CellScore":"3.00","AllBet":"3.00","Profit":"10.45","Revenue":"0.55","CardValue":"2313190000003905142c0c033c0b374","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:20:39","GameEndTime":"2019-06-04T11:20:56","CreateDateTime":"2019-06-04T11:21:02.437","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618463-147914137-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020124","ChairID":"3","UserCount":"3","CellScore":"3.00","AllBet":"3.00","Profit":"2.85","Revenue":"0.15","CardValue":"0000002a09043313160d39320000003","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:03","GameEndTime":"2019-06-04T11:21:14","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618482-147914656-3","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020145","ChairID":"3","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"3118121d2c273d0b2a2d28220807144","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:22","GameEndTime":"2019-06-04T11:21:35","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"},{"GameID":"50-1559618496-147915101-1","Account":"600655_2nmqq123","ServerID":"2201","KindID":"220","TableID":"44020218","ChairID":"1","UserCount":"5","CellScore":"1.00","AllBet":"1.00","Profit":"-1.00","Revenue":"0.00","CardValue":"3c16250d2908012d3919370526061a5","ChannelID":"600655","LineCode":"600655_AUQI","GameStartTime":"2019-06-04T11:21:36","GameEndTime":"2019-06-04T11:21:55","CreateDateTime":"2019-06-04T11:24:02.203","UpdateDateTime":"2019-06-04T11:30:02.48"}]') if records_DB and records_DB is not None: ceEntity.saveBetRecordsToDB( ec, ceEntity.context['gameTypes'], records_DB) except Exception as e: current_app.logger.exception(e) current_app.logger.error('同步%s数据异常 %s至 %s' % (ec, startDate, endDate)) current_app.logger.info('同步%s交易记录 %s至 %s 结束' % (ec, startDate, endDate)) except Exception as e: current_app.logger.exception(e) finally: current_app.logger.info('更新redis中的交易记录') ecBetsDetailsToRedis(int(time.time()) - 3600, int(time.time()))
def withdrawalToAccount(context, kargs): uid = context['member'].id username = context['member'].username isTsetPLay = context['member'].isTsetPLay actionTime = int(time.time()) last_ce = None ecTradeDao = None if 'isDemo' in kargs: if kargs['isDemo'] == '1' or isTsetPLay == 1: current_app.logger.info('%s试玩账号不需要额度转换' % (username)) return {"success": True} if 'fromEC' in kargs and kargs['fromEC'] is not None: last_ce = kargs['fromEC'] else: #获取上一次用户登录的娱乐城 ecLogDao = EntertainmentCityLog() last_ce = ecLogDao.getLastLogin(uid) if last_ce is None: return {"success": True} current_app.logger.info("%s本次娱乐城:%s" % (username, context['loginEC'])) current_app.logger.info("%s上次娱乐城:%s" % (username, last_ce)) #如果本次与上一次登录的是同一个娱乐城或者上一次在kk。则不用转账 if (last_ce == "MAIN") or (last_ce == context['loginEC']): current_app.logger.info('%s不需要取款' % (username)) return {"success": True} amount = None lastEC = EntertainmentCityFactory.getEntertainmentCity(last_ce) lastEC.context["member"] = context["member"] #去上一个娱乐城查询余额 try: m_res = lastEC.balance(kargs) if m_res['success'] == False: current_app.logger.error("%s查询余额错误:%s" % (username, m_res)) return { "success": False, 'errorCode': 3001, 'errorMsg': "查询余额错误" } except Exception as e: current_app.logger.exception(format(e)) current_app.logger.error("%s查询余额错误:%s" % (username, m_res)) return {"success": False, 'errorCode': 3001, 'errorMsg': "查询余额错误"} #娱乐城的余额 balance = float(m_res['data']['balance']) current_app.logger.info('%s在%s余额:%s' % (username, last_ce, balance)) if 'amount' in kargs: amount = kargs['amount'] current_app.logger.info('%s从%s取款:%s' % (username, last_ce, amount)) if amount > balance: current_app.logger.info("%s取款金额大于娱乐城余额,余额是%s" % (username, balance)) return { "success": False, 'errorCode': 3001, 'errorMsg': "转账失败" } else: balance = amount lastEC.context["amount"] = balance orderid = createECOrderId(uid) lastEC.context['orderid'] = orderid wjorderId = None #取款 if balance >= 1: current_app.logger.info('开始取款') #生成交易记录 ecTradeDao = AmountTransfer.saveECTradeLog(uid, username, balance, actionTime, 'MAIN', last_ce, orderid, None, context['real_ip'], 0, 0) try: m_res = lastEC.withdrawal(None) except Exception as e: current_app.logger.exception(e) current_app.logger.error('%s从%s取款失败' % (username, last_ce)) AmountTransfer.updateECTradeLog(ecTradeDao, None, 0, 0, 0) #生成交易明细 AmountTransfer.saveECTradeDetail(uid, username, actionTime, balance, orderid, last_ce, None, 0, '娱乐城取款失败,不用额度确认', None) # AmountTransfer.saveECTradeLog(uid, username, balance, actionTime, 'MAIN',last_ce, orderid, wjorderId, context['real_ip'],2,0,'娱乐城转账失败,余额已从娱乐城转出,需要人工审核结案') return { "success": False, 'errorCode': 3001, 'errorMsg': "转账失败" } if m_res['success'] == False: current_app.logger.error('%s从%s取款失败:%s' % (username, last_ce, m_res)) AmountTransfer.updateECTradeLog(ecTradeDao, None, 0, 0, 0) AmountTransfer.saveECTradeDetail(uid, username, actionTime, balance, orderid, last_ce, None, 0, '娱乐城取款失败,不用额度确认', None) return { "success": False, 'errorCode': 3001, 'errorMsg': "转账失败" } wjorderId = AmountTransfer.getWjorderId(m_res, last_ce) AmountTransfer.updateECTradeLog(ecTradeDao, wjorderId, 0, 1, 2) AmountTransfer.saveECTradeDetail(uid, username, actionTime, balance, orderid, last_ce, None, 1, '交易成功', None) current_app.logger.info('%s结束取款' % (username)) current_app.logger.info('%s取出余额:%s' % (username, balance)) else: current_app.logger.info('%s结束取款取款金额小于1元' % (username)) return {"success": True} #将余额存回主账户 current_app.logger.info("%s转回主账户开始" % (username)) #如果钱已经从娱乐城取出,但是更新主账户金额时发生错误(例如数据库链接不上),需要日志记录,否前钱不回来 try: member = Member.amountToMemberAccount(username, balance) except Exception as e: current_app.logger.exception(e) current_app.logger.error("%s转回主账户失败,内部错误%s" % (username, e)) current_app.logger.error( "%s从%s娱乐城取款%s已经完成,但是将金额更新回主账户时错误,请查看详细日志。" % (username, last_ce, balance)) current_app.logger.error({ "success": False, 'errorCode': 9001, 'errorMsg': "%s从%s娱乐城取款%s已经完成,但是将金额更新回主账户时错误,这是一个严重错误,需要人工存入" % (username, last_ce, balance) }) AmountTransfer.updateECTradeLog( ecTradeDao, wjorderId, 0, 1, 2, 0, "%s从%s娱乐城取款%s已经完成,将余额存入回主账户的过程中发生错误,这是一个严重错误,需要人工存入" % (username, last_ce, balance), '确认转账状态与判断不符而造成掉额度,开始进行补额度 - [系統]') AmountTransfer.saveECTradeDetail( uid, username, actionTime, balance, orderid, 'MAIN', 1, 2, '交易失败', '确认转账状态与判断不符而造成掉额度,开始进行补额度 - [系統]') return {"success": False, 'errorCode': 3001, 'errorMsg': "转账失败"} current_app.logger.info("转回主账户完成") AmountTransfer.updateECTradeLog(ecTradeDao, wjorderId, 1, 1, 1, None, '转账成功', None) AmountTransfer.saveCoinlog(uid, balance, member, actionTime, orderid, wjorderId, 'MAIN', last_ce, context['ip'], 400, '转回主账户完成') AmountTransfer.saveECTradeDetail(uid, username, actionTime, balance, orderid, 'MAIN', None, 1, '交易成功', None) return {"success": True}
def post(self, code): if not hasattr(g, 'current_member'): return {'errorCode': "9999", 'errorMsg': "用戶未登录", 'success': False} parser = RequestParser(trim=True) parser.add_argument('deviceTypeCode', type=str) # 電腦版: PC, 手機版: Mobile parser.add_argument('gameCode', type=str) #游戏代码 parser.add_argument('isDemo', type=str, default=0) #是否试玩,默认否 kargs = parser.parse_args(strict=True) current_app.logger.info("%s用户登录%s娱乐城" % (g.current_member.username, code)) if g.current_member.username not in tempUser: return {"success": False, 'errorCode': 3000, 'errorMsg': "没有权限"} try: mContext = {} mContext["member"] = g.current_member mContext["ip"] = host_to_value(request.remote_addr) mContext["real_ip"] = request.remote_addr mContext["loginEC"] = code #选择登录的娱乐城 m_data = {'success': True} ce = EntertainmentCityFactory.getEntertainmentCity(code) if ce is None: current_app.logger.error({ "success": False, 'errorCode': 3000, 'errorMsg': "没有中找到娱乐城" }) return { "success": False, 'errorCode': 3000, 'errorMsg': "登录失败" } ce.context["member"] = g.current_member if code != 'MAIN': m_data = ce.register() if 'success' not in m_data or m_data['success'] == False: return { "success": False, 'errorCode': 3000, 'errorMsg': "登录失败" } if g.current_member.auto_change == 1: current_app.logger.info('---------额度转换开始------------') AmountTransfer.withdrawalToAccount(mContext, kargs) if code != 'MAIN': AmountTransfer.accountToEntertainmentCity( mContext, kargs, ce) current_app.logger.info('---------额度转换结束------------') if code != 'MAIN': m_data = ce.login(kargs) if 'success' not in m_data or m_data['success'] == False: return { "success": False, 'errorCode': 3000, 'errorMsg': "登录失败" } AmountTransfer.saveECLog(g.current_member.id, g.current_member.username, int(time.time()), code, mContext['ip']) except RuntimeError as e: return {"success": False, 'errorCode': 3000, 'errorMsg': "登录失败"} return m_data
def get(self, code): ce = EntertainmentCityFactory.getEntertainmentCity(code) kargs = None m_data = ce.checkTransfer(kargs) return m_data