frame.go 919 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package insecureframe
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/redis"
  5. "bet24.com/servers/insecureframe/gate"
  6. "bet24.com/servers/insecureframe/robot"
  7. "bet24.com/servers/transaction"
  8. "bet24.com/servers/user"
  9. "math/rand"
  10. "time"
  11. )
  12. func Run(sink gate.GateSink,
  13. redisUrl, redisPsw string, redisDb int, logPath string) {
  14. log.Debug("insecureframe.Run")
  15. rand.Seed(time.Now().UnixNano())
  16. if redisUrl != "" {
  17. redis.InitPool(redisUrl, redisPsw, redisDb)
  18. }
  19. transaction.Run()
  20. gate.Run(sink, logPath)
  21. go redis.Subscribe(gate.RecvChannelData)
  22. if sink.GetRobotCount() > 0 {
  23. robot.RunRobot(sink, gate.GetGate())
  24. }
  25. }
  26. func GetUserByUserId(userId int) *user.UserInfo {
  27. return gate.GetUserByUserId(userId)
  28. }
  29. func WriteUserMoney(userId int, amount, tax int, status, scoreType int, sourceName string, isChip bool) (bool, int) {
  30. return gate.WriteUserMoney(userId, amount, tax, status, scoreType, sourceName, isChip)
  31. }