Skip to content

Commit

Permalink
gen new code
Browse files Browse the repository at this point in the history
  • Loading branch information
BREWTAN committed Apr 14, 2016
1 parent ab340c8 commit d2290dd
Show file tree
Hide file tree
Showing 18 changed files with 415 additions and 881 deletions.
1 change: 0 additions & 1 deletion gamectrl/src/main/proto/gamectrl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ message PBIssueFlowGen
string node_type = 10;//节点类型
string auto_gonext = 11; //是否为自动节点
string status = 12; //当前状态

}
string ltype = 1 ;//游戏类型
repeated PBIFlowStep steps = 2; //状态的节点
Expand Down
6 changes: 4 additions & 2 deletions gamectrl/src/main/resources/initflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"timesec_offset":0,
"gs_desc":"游戏暂停销售*,一般是因为手动触发",
"gs_order": "004",
"next_orders":"003"
"next_orders":"003",
"auto_gonext":"0"
},
{
"gs_ecode":"SALE_DONE",
Expand All @@ -56,7 +57,8 @@
"gs_chcode":"获取开奖号码",
"gs_desc":"获取官方开奖号码",
"gs_order": "007",
"next_orders":"008,009,010,011"
"next_orders":"008,009,010,011",
"auto_gonext":"0"
},
{
"gs_ecode":"WIN_OFFICIAL_BOARD_GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@ object FlowStepCheckerService extends OLog with PBUtils with LService[PBIssueFlo
}
})
nodeNeedProc.map { NodeProcessor.process(_) };

if (nodeNeedProc.size > 0) {
Thread.sleep(2000);
log.debug("wait:for next:"+nodeNeedProc.size +",rizesiz="+ nodeNeedProc.filter { _.getStepStatus.equals("1")}.size)
log.debug("wait:for next:" + nodeNeedProc.size + ",rizesiz=" + nodeNeedProc.filter { _.getStepStatus.equals("1") }.size)
}


} catch {
case e: Throwable => log.debug("running ChechError:", e);
Expand All @@ -132,7 +131,7 @@ object FlowStepCheckerService extends OLog with PBUtils with LService[PBIssueFlo
val nextsteps = if (steprecs.size() == 0) {
StepsGenerator.newStepForIssue(issue);
} else {
steprecs.filter { step => "5".equals(step.getStepStatus) }.map { step =>
steprecs.filter { step => "5".equals(step.getStepStatus) && "1".equals(step.getAutoGonext) }.map { step =>
StepsGenerator.nextStepForIssue(issue, step.asInstanceOf[TLTIssueSteps])
}.flatten
}
Expand All @@ -142,6 +141,7 @@ object FlowStepCheckerService extends OLog with PBUtils with LService[PBIssueFlo
//将节点插入数据库
if (nextsteps.size > 0) {
nextsteps.foreach { step =>

try {
val existexample = new TLTIssueStepsExample()
existexample.createCriteria().andIssueStepIdEqualTo(step.getIssueStepId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ import starstart.cgw.gamectrl.scala.flow.NodeProcessor
import onight.tfg.ordbgens.tlt.entity.TLTIssueSteps
import com.github.nscala_time.time.Imports._
import java.util.Date
import onight.tfg.ordbgens.tlt.entity.TLTCoreBetExample
import com.github.nscala_time.time.Imports._
import scala.collection.JavaConversions._

object P010_WinCalculate extends OProcessor with OLog {

def proc(issue: TLTIssue, issueStep: TLTIssueSteps, operator: String): Int = {
log.info("PS::" + issueStep.getGsChcode + ":" + issue.getIssueId + ",status=" + issue.getIssueStatus)
//算奖

val example = new TLTCoreBetExample
example.createCriteria().andIssueNoEqualTo(issue.getIssueNo).andLtypeEqualTo(issue.getLtype)

Mysqls.corebetDAO.selectByExample(example).map { bet =>
log.debug("bet==" + bet+",")
}

return 1;
}

Expand Down
12 changes: 8 additions & 4 deletions gateway/src/main/proto/cgw.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ message PWBet //投注一注
{
string ltype = 1;//游戏类型
string play_type = 2;//玩法类型
string bet_content = 3;//投注内容
string bet_org_content = 3;//投注内容
uint32 bet_counts = 4;//注数
double bet_amounts = 5;//投注金额
int32 bet_money_unit = 6;//投注单元,以元为单位的
uint32 bet_multi = 7;//投注倍数
double bonner_money_mode = 8;//奖金模式
double bonner_rate_mode = 9;//奖金模式
double bonus_money_mode = 8;//奖金模式
double bonus_rate_mode = 9;//奖金模式
string vldcode = 20;//校验码

string lname = 31;//玩法名称
Expand Down Expand Up @@ -58,14 +58,16 @@ message PWAutoChase //追号内容

message PWTicker //投注一单,包括多注
{
//#wname,balls,count,money,moneyUnit,multi,bonnerMode
//#wname,balls,count,money,moneyUnit,multi,bonusMode
repeated PWBet bets = 1;//注码内容
string ltype = 2;//游戏类型
bool is_auto = 20;//是否追号
repeated PWAutoChase chases = 21 ;//追号内容
string issue_no = 31 ;//投注期号(不追号的时候填写)
bool win_stop = 32 ;//中奖后停止追号



string submit_datetime = 33;//投注时间
string user_id = 34;//投注用户
string channel = 35;//投注渠道
Expand All @@ -75,7 +77,9 @@ message PWTicker //投注一单,包括多注

double tick_amounts = 39;//投注总金额
uint32 tick_bet_counts = 40;//总注数

string region=41;//区域
string vldcode = 42;//票号的验证码,作为数据库的主键
double cost_fund0=50;//从用户子账户0扣除的金额
double cost_fund1=51;//从用户子账户1扣除的金额
double cost_fund2=52;//从用户子账户2扣除的金额
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import java.util.Date
import starstart.cgw.pbgens.Cgw.PWTicker
import starstart.cgw.pbgens.Cgw.PWRetTicker
import onight.tfw.ojpa.api.TransactionExecutor
import onight.tfg.ordbgens.tlt.entity.TLTCoreTick
import onight.tfg.ordbgens.tlt.entity.TLTCoreTicket
import onight.tfw.ojpa.api.exception.JPADuplicateIDException

@NActorProvider
object CGWBetActor extends SessionModules[PWTicker] {
Expand All @@ -42,24 +43,40 @@ object CGWBetService extends OLog with PBUtils with LService[PWTicker] {
log.debug("getBug from IP:{},betscount={}", pack.getExtStrProp(PackHeader.PEER_IP), pbo.getBetsCount)
ret.setRetcode("9999").setRetmsg("UNKNOW ERROR");

val tick = pbBeanUtil.copyFromPB(pbo, new TLTCoreTicket)
tick.setTickNo(MD5.getMD5("cwd_" + pbo.getVldcode));
tick.setBetIp(pack.getExtStrProp(PackHeader.PEER_IP));
tick.setTickStatus("1")
if (pbo.getIsAuto) {
tick.setIsAuto("1")
} else {
tick.setIsAuto("0")
}
tick.setBetDatetime(new Date())
log.info("bets:count="+pbo.getBetsCount+",tickno="+tick.getTickNo+":issue="+tick.getIssueNo+":ltype="+tick.getLtype)
val bets = pbo.getBetsList().map { bet =>
val dbbet = pbBeanUtil.copyFromPB(bet, new TLTCoreBet)
pbBeanUtil.copyFromPB(pbo, dbbet)

dbbet.setTickNo(tick.getTickNo)
dbbet.setBetDatetime(new Date());
dbbet.setBetOrgCounts(bet.getBetCounts)
dbbet.setTickNo(UUIDGenerator.generate());
val serialnum = MD5.getMD5(("starstart-ming:" + dbbet.getTickNo));
dbbet.setBetIp(pack.getExtStrProp(PackHeader.PEER_IP));
dbbet.setSerialNum(serialnum)
dbbet.setBetNo("cwd_" + bet.getVldcode)
dbbet.setBetStatus("1")
dbbet.setIsAuto("0")
dbbet.setBetDatetime(new Date());
dbbet
}
val tick = pbBeanUtil.copyFromPB(pbo, new TLTCoreTick)

try {

MysqlDaos.corebetDAO.doInTransaction(new TransactionExecutor {

def doInTransaction: Object = {
MysqlDaos.corebetDAO.batchInsert(bets);
MysqlDaos.coreticketDAO.insert(tick)
return ""
}
})
Expand All @@ -69,11 +86,15 @@ object CGWBetService extends OLog with PBUtils with LService[PWTicker] {
retbet.setBetStatus("0000").setSerialNum(dbbet.getSerialNum).setVldcode(MD5.getMD5(DESCoder.desEncrypt(dbbet.getSerialNum, "zzzz-starstartsFFFF")))
ret.addBetrets(retbet);
}
ret.setTickNo(tick.getTickNo);
ret.setRetcode("0000").setRetmsg("ok");
} catch {
case e: JPADuplicateIDException =>
log.warn("投注异常重复")
ret.setRetcode("0003").setRetmsg("重复提交相同的投注单")
case e: Exception =>
log.error("投注异常", e)
ret.setRetcode("0001").setRetmsg(e.getMessage)
ret.setRetcode("0009").setRetmsg(e.getMessage)
}
handler.onFinished(PacketHelper.toPBReturn(pack, ret.build()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import onight.tfw.ojpa.api.annotations.StoreDAO
import onight.tfw.ojpa.api.OJpaDAO
import scala.beans.BeanProperty
import onight.tfg.ordbgens.tlt.entity.TLTCoreBet
import onight.tfg.ordbgens.tlt.entity.TLTCoreTicket

@NActorProvider
object MysqlDaos extends SessionModules[Message] {

@StoreDAO(domain = classOf[TLTCoreBet],target = "cmysql")
@BeanProperty
var corebetDAO: OJpaDAO[TLTCoreBet] = null


@StoreDAO(domain = classOf[TLTCoreTicket],target = "cmysql")
@BeanProperty
var coreticketDAO: OJpaDAO[TLTCoreTicket] = null

}
Loading

0 comments on commit d2290dd

Please sign in to comment.