def on_get(self, req, resp): self.initialize() req_para = falcon.util.uri.parse_query_string(req.query_string) if 'dealerid' not in req_para.keys()\ or 'matchA' not in req_para.keys() \ or 'AResult' not in req_para.keys() \ or 'matchB' not in req_para.keys() \ or 'BResult' not in req_para.keys() \ or 'desc' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, '接口参数不正确.') if req_para['AResult'] not in ('W', 'D', 'L'): self.errorReturn(GLBConfig.API_ERROR, '接口参数不正确.') if req_para['BResult'] not in ('W', 'D', 'L'): self.errorReturn(GLBConfig.API_ERROR, '接口参数不正确.') d = self.session.query(Dealer).\ filter(Dealer.uid == req_para['dealerid']).\ filter(Dealer.dealertype == GLBConfig.D_TYPE_H).first() if d is None: self.errorReturn(GLBConfig.API_ERROR, 'dealer不存在.') mA = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == req_para['matchA']).first() if mA is None: self.errorReturn(GLBConfig.API_ERROR, '比赛不存在.') mB = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == req_para['matchB']).first() if mB is None: self.errorReturn(GLBConfig.API_ERROR, '比赛不存在.') self.session.query(DealerMatch).\ filter(DealerMatch.date == SysUtil.getTomorrow()).\ filter(DealerMatch.dealerid == req_para['dealerid']).delete() self.session.flush() dm = DealerMatch( dealerid=req_para['dealerid'], date=SysUtil.getTomorrow(), matchAID=req_para['matchA'], matchAResult=req_para['AResult'], matchBID=req_para['matchB'], matchBResult=req_para['BResult'], matchdesc=req_para['desc'] ) self.session.add(dm) self.session.commit() self.result['data'] = 'success' req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()
def getMatch(self, u, udata, dealerid): tomorrow = SysUtil.getTomorrow() self.session.query(MatchData).\ filter(MatchData.userid == u.userid).\ filter(MatchData.date == tomorrow).delete() self.session.flush() matches = self.session.query(DealerMatch).\ filter(DealerMatch.dealerid == int(dealerid)).\ filter(DealerMatch.date == SysUtil.getTomorrow()).first() if matches is None: self.errorReturn(GLBConfig.API_ERROR, '无推荐内容.') ma = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == matches.matchAID).first() mb = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == matches.matchBID).first() listA = (ma.wrate, ma.drate, ma.lrate) listB = (mb.wrate, mb.drate, mb.lrate) account = self.session.query(AccountRunning).\ filter(AccountRunning.userid == u.userid).\ filter(AccountRunning.date < tomorrow).\ order_by(AccountRunning.date.desc()).first() money = 0.0 if account: if account.riskMoney < 0: money = account.riskMoney rate = listA[SysUtil.getResultIndex( matches.matchAResult)] * listB[SysUtil.getResultIndex( matches.matchBResult)] mMoney = (udata.basemony - money) / (rate - 1.00) md = MatchData(userid=u.userid, date=tomorrow, matchAID=matches.matchAID, matchAResult=matches.matchAResult, matchBID=matches.matchBID, matchBResult=matches.matchBResult, rate=rate, money=mMoney, singleFlag='2') self.session.add(md) self.session.flush(md)
def getMatchModeD(self, u, ud, matchid): tomorrow = SysUtil.getTomorrow() m = self.session.query(MatchInfoD).\ filter(MatchInfoD.matchid == matchid).first() count = 1 md1 = MatchData(userid=u.userid, date=tomorrow, singleFlag=GLBConfig.M_SCORE, matchAID=m.matchid, matchAResult='2', rate=m.s2) self.session.add(md1) md2 = MatchData(userid=u.userid, date=tomorrow, singleFlag=GLBConfig.M_SCORE, matchAID=m.matchid, matchAResult='3', rate=m.s3) self.session.add(md2) md3 = MatchData(userid=u.userid, date=tomorrow, singleFlag=GLBConfig.M_SCORE, matchAID=m.matchid, matchAResult='4', rate=m.s4) self.session.add(md3) self.session.flush() if count > 0: self.calMoney(u, ud, count)
def on_get(self, req, resp): self.initialize() req_para = falcon.util.uri.parse_query_string(req.query_string) if 'userid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'userid 不存在.') if 'dealerid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'dealerid 不存在.') if 'gambleFlag' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'gambleFlag 不存在.') u = self.session.query(User).filter( User.userid == req_para['userid']).first() if u is None: self.errorReturn(GLBConfig.API_ERROR, '用户不存在.') if u.accounttype != GLBConfig.ATYPE_PERSION: self.errorReturn(GLBConfig.API_ERROR, '账户类型错误.') if u.expdate > datetime.date.today: self.errorReturn(GLBConfig.API_ERROR, '用户已过期.') self.matchCalcMoney(u, req_para['dealerid']) matches = self.session.query(MatchData).\ filter(MatchData.userid == u.userid).\ filter(MatchData.date == SysUtil.getTomorrow()).all() maData = [] sumMoney = 0.00 for m in matches: matInfo = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() maData.append({ 'match': m.matchAID, 'matchtype': matInfo.matchtype, 'zhu': matInfo.matchzhu, 'ke': matInfo.matchke, 'wrate': matInfo.wrate, 'drate': matInfo.drate, 'lrate': matInfo.lrate, 'result': m.matchAResult, 'money': m.money }) sumMoney += m.money self.result['data'] = maData self.result['sumMoney'] = sumMoney if req_para['gambleFlag'] == '1': self.session.commit() else: self.session.rollback() req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()
def getDealerMatch(self): dealers = self.session.query(Dealer).filter( Dealer.dealertype == GLBConfig.D_TYPE_C).all() for d in dealers: if len(self.session.query(DealerMatch).\ filter(DealerMatch.dealerid == d.uid).\ filter(DealerMatch.date == SysUtil.getTomorrow()).all()) > 0: continue if d.uid == 1: matches = self.session.query(MatchInfoD).\ filter(MatchInfoD.date == SysUtil.getTomorrow()).\ filter(MatchInfoD.minrate >= 2.0).\ filter(MatchInfoD.minrate <= 3.0).all() elif d.uid == 2: matches = self.session.query(MatchInfoD).\ filter(MatchInfoD.date == SysUtil.getTomorrow()).\ filter(MatchInfoD.minrate >= 1.0).\ filter(MatchInfoD.minrate <= 2.5).all() elif d.uid == 3: matches = self.session.query(MatchInfoD).\ filter(MatchInfoD.date == SysUtil.getTomorrow()).\ filter(MatchInfoD.minrate >= 1.5).\ filter(MatchInfoD.minrate <= 2.5).all() if len(matches) > 1: choice = random.sample(matches, 2) rateAList = (choice[0].wrate, choice[0].drate, choice[0].lrate) minRateAIdex = SysUtil.getMinIndex(rateAList) rateBList = (choice[1].wrate, choice[1].drate, choice[1].lrate) minRateBIdex = SysUtil.getMinIndex(rateBList) dm = DealerMatch( dealerid=d.uid, date=SysUtil.getTomorrow(), matchAID=choice[0].matchid, matchAResult=SysUtil.getMatchResult(minRateAIdex), matchBID=choice[1].matchid, matchBResult=SysUtil.getMatchResult(minRateBIdex), matchdesc='') self.session.add(dm) self.session.commit()
def getMatchGroup(self, u, ud): tomorrow = SysUtil.getTomorrow() # filter(or_(and_(MatchInfoD.date==tomorrow,MatchInfoD.matchTime < datetime.time(22,00,00)), # and_(MatchInfoD.date==SysUtil.getToday(),MatchInfoD.matchTime >= datetime.time(22,00,00)) )).\ matches = self.session.query(MatchInfoD).\ filter(MatchInfoD.date == tomorrow).\ filter(MatchInfoD.singleFlag == '1').\ filter(MatchInfoD.minrate > 0.1).\ order_by(MatchInfoD.wrate).all() count = 0 for m in matches: rateList = (m.wrate, m.drate, m.lrate) rateAIdex = SysUtil.getMaxIndex(rateList) rateBIdex = SysUtil.getMidIndex(rateList) if m.minrate < 1.46: if m.rankDValue > 8 or m.rankDValue < -8: rateAIdex = 0 rateBIdex = 2 if m.matchtypename == '欧洲杯' and m.minrate < 1.30: rateAIdex = SysUtil.getMinIndex(rateList) rateBIdex = SysUtil.getMidIndex(rateList) if m.matchtypename == '奥运女足' and m.minrate < 1.351: rateAIdex = SysUtil.getMinIndex(rateList) rateBIdex = SysUtil.getMidIndex(rateList) if m.matchtypename == '奥运男足' and m.minrate < 1.351: rateAIdex = SysUtil.getMinIndex(rateList) rateBIdex = SysUtil.getMidIndex(rateList) mA = MatchData(userid=u.userid, date=tomorrow, matchAID=m.matchid, matchAResult=SysUtil.getMatchResult(rateAIdex), rate=rateList[rateAIdex], singleFlag=GLBConfig.M_SINGLE) self.session.add(mA) mB = MatchData(userid=u.userid, date=tomorrow, matchAID=m.matchid, matchAResult=SysUtil.getMatchResult(rateBIdex), rate=rateList[rateBIdex], singleFlag=GLBConfig.M_SINGLE) self.session.add(mB) self.session.flush() count += 1 if count > 2: break if count > 0: self.calMoney(u, ud, count)
def getMatchModeASelfChoice(self, u, udata, matchA, AResult, matchB, BResult): tomorrow = SysUtil.getTomorrow() ma = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == matchA).first() if ma is None: self.errorReturn(GLBConfig.API_ERROR, '比赛不存在.') mb = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == matchB).first() if mb is None: self.errorReturn(GLBConfig.API_ERROR, '比赛不存在.') listA = (ma.wrate, ma.drate, ma.lrate) listB = (mb.wrate, mb.drate, mb.lrate) account = self.session.query(AccountRunning).\ filter(AccountRunning.userid == u.userid).\ filter(AccountRunning.status == GLBConfig.ENABLE).\ filter(AccountRunning.date < tomorrow).\ order_by(AccountRunning.date.desc()).first() money = 0.0 if account: if account.riskMoney < 0: money = account.riskMoney rate = listA[SysUtil.getResultIndex(AResult)] * listB[ SysUtil.getResultIndex(BResult)] mMoney = (udata.basemoney - money) / (rate - 1.00) md = MatchData(userid=u.userid, date=tomorrow, matchAID=matchA, matchAResult=AResult, matchBID=matchB, matchBResult=BResult, rate=rate, money=mMoney, singleFlag='2') self.session.add(md) self.session.flush()
def calMoney(self, u, ud, count): tomorrow = SysUtil.getTomorrow() money = ud.basemoney account = self.session.query(AccountRunning).\ filter(AccountRunning.userid == u.userid).\ filter(AccountRunning.status == GLBConfig.ENABLE).\ filter(AccountRunning.date < tomorrow).\ order_by(AccountRunning.date.desc()).first() if account: if account.riskMoney < 0: if u.accounttype == GLBConfig.ATYPE_GROUP: money = ((-1) * account.riskMoney / (ud.basemoney) + 1) * ud.basemoney * count / 3 elif u.accounttype == GLBConfig.ATYPE_PERSION: if ud.mode == GLBConfig.MODE_A or ud.mode == GLBConfig.MODE_B: money = ((-1) * account.riskMoney / (ud.basemoney) + 1) * ud.basemoney * count / 3 elif ud.mode == GLBConfig.MODE_C or ud.mode == GLBConfig.MODE_D: money = ( (-1) * account.riskMoney / (ud.basemoney) + 1) * ud.basemoney * count * 1.5 if money < ud.basemoney * 0.8: money = ud.basemoney * 0.8 matches = self.session.query(MatchData).\ filter(MatchData.userid == u.userid).\ filter(MatchData.status == GLBConfig.ENABLE).\ filter(MatchData.date == tomorrow).all() if len(matches) > 0: base = matches[0].rate sumRPara = 1 for m in matches[1:]: sumRPara += base / m.rate baseMoney = money / sumRPara for m in matches: m.money = round(base / m.rate * baseMoney / 2, 0) * 2 self.session.flush()
def on_get(self, req, resp): self.initialize() maData = [] for m, d in self.session.query(DealerMatch, Dealer).\ filter(DealerMatch.date == SysUtil.getTomorrow()).\ filter(DealerMatch.dealerid == Dealer.uid).all(): mA = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() mB = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchBID).first() maData.append({ 'dealerid': m.dealerid, 'dealername': d.name, 'dealtype': d.dealertype, 'dealerdesc': d.dealerdesc, 'matchdesc': m.matchdesc, 'matchAID': m.matchAID, 'matchAResult': m.matchAResult, 'matchAtype': mA.matchtypename, 'matchAzhu': mA.matchzhu, 'matchAke': mA.matchke, 'matchAw': mA.wrate, 'matchAd': mA.drate, 'matchAl': mA.lrate, 'matchBID': m.matchBID, 'matchBResult': m.matchBResult, 'matchBtype': mB.matchtypename, 'matchBzhu': mB.matchzhu, 'matchBke': mB.matchke, 'matchBw': mB.wrate, 'matchBd': mB.drate, 'matchBl': mB.lrate }) self.result['data'] = maData req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()
def matchCalcMoney(self, u, udata, req_para): self.matchresult(u, udata, SysUtil.getLast2()) self.matchresult(u, udata, SysUtil.getYesterday()) self.matchresult(u, udata, SysUtil.getToday()) ct = self.session.query(func.count('*')).\ filter(MatchData.userid == u.userid).\ filter(MatchData.date == SysUtil.getToday()).\ filter(func.abs(MatchData.ResultMoney) < 0.001).scalar() if datetime.datetime.now().time() < datetime.time(19, 0, 0): if ct != 0: self.errorReturn(GLBConfig.API_ERROR, '有比赛结果未出.') self.session.commit() self.session.query(MatchData).\ filter(MatchData.userid == u.userid).\ filter(MatchData.date == SysUtil.getTomorrow()).delete() self.session.flush() if u.accounttype == GLBConfig.ATYPE_GROUP: self.getMatchGroup(u, udata) elif u.accounttype == GLBConfig.ATYPE_PERSION: if udata.mode == GLBConfig.MODE_A: if 'dealerid' in req_para.keys(): self.getMatchModeA(u, udata, req_para['dealerid']) if 'matchA' in req_para.keys(): self.getMatchModeASelfChoice(u, udata, req_para['matchA'], req_para['AResult'], req_para['matchB'], req_para['BResult']) if udata.mode == GLBConfig.MODE_B: self.getMatchModeB(u, udata) if udata.mode == GLBConfig.MODE_C: self.getMatchModeC(u, udata, req_para['matchid']) if udata.mode == GLBConfig.MODE_D: self.getMatchModeD(u, udata, req_para['matchid'])
def on_get(self, req, resp): self.initialize() req_para = falcon.util.uri.parse_query_string(req.query_string) if 'userid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'userid 不存在.') if 'gambleFlag' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'gambleFlag 不存在.') u = self.session.query(User).filter( User.userid == req_para['userid']).first() if u is None: self.errorReturn(GLBConfig.API_ERROR, '用户不存在.') udata = self.session.query(UserData).filter( UserData.userid == u.userid).first() if udata is None: self.errorReturn(GLBConfig.API_ERROR, '目标金额未设置.') if u.accounttype == GLBConfig.ATYPE_GROUP: if datetime.date.today() > u.expdate: self.errorReturn(GLBConfig.API_ERROR, '用户已过期.') if u.accounttype == GLBConfig.ATYPE_PERSION: if udata.mode == GLBConfig.MODE_A: if 'dealerid' not in req_para.keys(): if 'matchA' not in req_para.keys() \ or 'AResult' not in req_para.keys() \ or 'matchB' not in req_para.keys() \ or 'BResult' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, '接口参数不正确.') if udata.mode == GLBConfig.MODE_C or udata.mode == GLBConfig.MODE_D: if 'matchid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, '接口参数不正确.') self.matchCalcMoney(u, udata, req_para) matches = self.session.query(MatchData).\ filter(MatchData.userid == u.userid).\ filter(MatchData.status == GLBConfig.ENABLE).\ filter(MatchData.date == SysUtil.getTomorrow()).all() maData = [] sumMoney = 0.00 for m in matches: if m.singleFlag == GLBConfig.M_SINGLE: matInfo = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() maData.append({ 'match': m.matchAID, 'matchtype': matInfo.matchtype, 'zhu': matInfo.matchzhu, 'ke': matInfo.matchke, 'wrate': matInfo.wrate, 'drate': matInfo.drate, 'lrate': matInfo.lrate, 'result': m.matchAResult, 'money': m.money }) else: if udata.mode == GLBConfig.MODE_A or udata.mode == GLBConfig.MODE_B: mA = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() mB = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchBID).first() maData.append({ 'matchAID': m.matchAID, 'matchAResult': m.matchAResult, 'matchAtype': mA.matchtypename, 'matchAzhu': mA.matchzhu, 'matchAke': mA.matchke, 'matchAw': mA.wrate, 'matchAd': mA.drate, 'matchAl': mA.lrate, 'matchBID': m.matchBID, 'matchBResult': m.matchBResult, 'matchBtype': mB.matchtypename, 'matchBzhu': mB.matchzhu, 'matchBke': mB.matchke, 'matchBw': mB.wrate, 'matchBd': mB.drate, 'matchBl': mB.lrate, 'money': m.money }) elif udata.mode == GLBConfig.MODE_C or udata.mode == GLBConfig.MODE_D: matInfo = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() maData.append({ 'matchid': m.matchAID, 'matchResult': m.matchAResult, 'matchtype': matInfo.matchtypename, 'matchzhu': matInfo.matchzhu, 'matchke': matInfo.matchke, 'rete': m.rate, 'money': m.money }) sumMoney += m.money self.result['data'] = maData self.result['sumMoney'] = sumMoney if req_para['gambleFlag'] == '1': self.session.commit() else: self.session.rollback() req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()
def on_get(self, req, resp): self.initialize() req_para = falcon.util.uri.parse_query_string(req.query_string) if 'userid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'userid 不存在.') matches = self.session.query(MatchData).\ filter(MatchData.date >= SysUtil.getTomorrow()).\ filter(MatchData.status == GLBConfig.ENABLE).\ filter(MatchData.userid == req_para['userid']).all() maData = [] if matches: for m in matches: if m.singleFlag == GLBConfig.M_SINGLE: matInfo = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() if not matInfo: matInfo = self.session.query(MatchInfo).filter( MatchInfo.matchid == m.matchAID).first() if matInfo: maData.append({ 'match': m.matchAID, 'matchtype': matInfo.matchtype, 'zhu': matInfo.matchzhu, 'ke': matInfo.matchke, 'wrate': matInfo.wrate, 'drate': matInfo.drate, 'lrate': matInfo.lrate, 'result': m.matchAResult, 'money': m.money }) elif m.singleFlag == GLBConfig.M_DUAL: mA = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() if not mA: mA = self.session.query(MatchInfo).filter( MatchInfo.matchid == m.matchAID).first() mB = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchBID).first() if not mB: mB = self.session.query(MatchInfo).filter( MatchInfo.matchid == m.matchBID).first() if mA and mB: maData.append({ 'matchAID': m.matchAID, 'matchAResult': m.matchAResult, 'matchAtype': mA.matchtypename, 'matchAzhu': mA.matchzhu, 'matchAke': mA.matchke, 'matchAw': mA.wrate, 'matchAd': mA.drate, 'matchAl': mA.lrate, 'matchBID': m.matchBID, 'matchBResult': m.matchBResult, 'matchBtype': mB.matchtypename, 'matchBzhu': mB.matchzhu, 'matchBke': mB.matchke, 'matchBw': mB.wrate, 'matchBd': mB.drate, 'matchBl': mB.lrate, 'money': m.money }) elif m.singleFlag == GLBConfig.M_HAFU or m.singleFlag == GLBConfig.M_SCORE: matInfo = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() if not matInfo: matInfo = self.session.query(MatchInfo).filter( MatchInfo.matchid == m.matchAID).first() if matInfo: maData.append({ 'matchid': m.matchAID, 'matchResult': m.matchAResult, 'matchtype': matInfo.matchtypename, 'matchzhu': matInfo.matchzhu, 'matchke': matInfo.matchke, 'rete': m.rate, 'money': m.money }) self.result['data'] = maData else: self.errorReturn(GLBConfig.API_ERROR, '无数据.') req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()
def on_get(self, req, resp): self.initialize() maData = [] req_para = falcon.util.uri.parse_query_string(req.query_string) if 'userid' not in req_para.keys(): self.errorReturn(GLBConfig.API_ERROR, 'userid 不存在.') udata = self.session.query(UserData).filter( UserData.userid == req_para['userid']).first() if udata is None: self.errorReturn(GLBConfig.API_ERROR, '目标金额未设置.') rType = udata.mode if rType == GLBConfig.MODE_A: # 推荐2串1 for m, d in self.session.query(DealerMatch, Dealer).\ filter(DealerMatch.date == SysUtil.getTomorrow()).\ filter(DealerMatch.dealerid == Dealer.uid).all(): mA = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchAID).first() mB = self.session.query(MatchInfoD).filter( MatchInfoD.matchid == m.matchBID).first() maData.append({ 'dealerid': m.dealerid, 'dealername': d.name, 'dealtype': d.dealertype, 'dealerdesc': d.dealerdesc, 'matchdesc': m.matchdesc, 'matchAID': m.matchAID, 'matchAResult': m.matchAResult, 'matchAtype': mA.matchtypename, 'matchAzhu': mA.matchzhu, 'matchAke': mA.matchke, 'matchAw': mA.wrate, 'matchAd': mA.drate, 'matchAl': mA.lrate, 'matchBID': m.matchBID, 'matchBResult': m.matchBResult, 'matchBtype': mB.matchtypename, 'matchBzhu': mB.matchzhu, 'matchBke': mB.matchke, 'matchBw': mB.wrate, 'matchBd': mB.drate, 'matchBl': mB.lrate }) elif rType == GLBConfig.MODE_C: # 推荐半全场 for m in self.session.query(MatchInfoD).\ filter(MatchInfoD.date == SysUtil.getTomorrow()).\ filter(MatchInfoD.ww > 1.0).\ filter(MatchInfoD.minrate > 1.9).\ filter(MatchInfoD.minrate < 3.0).all(): maData.append({ 'matchid': m.matchid, 'matchtype': m.matchtypename, 'matchzhu': m.matchzhu, 'matchke': m.matchke, 's0': m.s0, 's1': m.s1, 's2': m.s2, 's3': m.s3, 's4': m.s4, 's5': m.s5, 's6': m.s6, 's7': m.s7, 'ww': m.ww, 'wd': m.wd, 'wl': m.wl, 'dw': m.dw, 'dd': m.dd, 'dl': m.dl, 'lw': m.lw, 'ld': m.ld, 'll': m.ll }) elif rType == GLBConfig.MODE_D: # 推荐总进球 for m in self.session.query(MatchInfoD).\ filter(MatchInfoD.date == SysUtil.getTomorrow()).\ filter(MatchInfoD.s0 > 1.0).\ filter(MatchInfoD.minrate > 1.2).\ filter(MatchInfoD.minrate < 2.1).all(): maData.append({ 'matchid': m.matchid, 'matchtype': m.matchtypename, 'matchzhu': m.matchzhu, 'matchke': m.matchke, 's0': m.s0, 's1': m.s1, 's2': m.s2, 's3': m.s3, 's4': m.s4, 's5': m.s5, 's6': m.s6, 's7': m.s7, 'ww': m.ww, 'wd': m.wd, 'wl': m.wl, 'dw': m.dw, 'dd': m.dd, 'dl': m.dl, 'lw': m.lw, 'ld': m.ld, 'll': m.ll }) # print(maData) self.result['data'] = maData req.context['result'] = self.result resp.set_header('Powered-By', '*****@*****.**') resp.status = falcon.HTTP_200 self.release()