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 getMatchDraw(date): matches = session.query(MatchInfo).\ filter(MatchInfo.date==date).\ filter(MatchInfo.singleFlag == '1').\ filter(MatchInfo.minrate > 0.1).\ order_by(MatchInfo.wrate).all() count = 0 if matches: 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 = MatchDataBatch(date = date, matchAID = m.matchid, matchAResult = SysUtil.getMatchResult(rateAIdex), rate = rateList[rateAIdex], singleFlag = GLBConfig.M_SINGLE) session.add(mA) mB = MatchDataBatch(date = date, matchAID = m.matchid, matchAResult = SysUtil.getMatchResult(rateBIdex), rate = rateList[rateBIdex], singleFlag = GLBConfig.M_SINGLE) session.add(mB) session.commit() count += 1 if count > 2: break return count