main.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package main
  2. import (
  3. "fmt"
  4. jsonrpclite "git.ius.plus/justin.xing/JsonRpcLiteGo"
  5. )
  6. var (
  7. dingTalkService *DingTalkService = new(DingTalkService)
  8. loginService *LoginService = new(LoginService)
  9. adminService *AdminService = new(AdminService)
  10. departmentService *DepartmentService = new(DepartmentService)
  11. employeeService *EmployeeService = new(EmployeeService)
  12. workingDayService *WorkingDayService = new(WorkingDayService)
  13. workingDayStatisticsService *WorkingDayStatisticsService = new(WorkingDayStatisticsService)
  14. statisticsTableService *StatisticsTableService = new(StatisticsTableService)
  15. viewCodeService *ViewCodeService = new(ViewCodeService)
  16. emailService *EmailService = new(EmailService)
  17. holidayService *HolidayService = new(HolidayService)
  18. domainService *DomainService = new(DomainService)
  19. messageTemplateService *MessageTemplateService = new(MessageTemplateService)
  20. progressService *ProgressService = new(ProgressService)
  21. )
  22. func main() {
  23. //Initialize database manager.
  24. databaseManager.Initialize()
  25. //Start session manager
  26. sessionManager.Start()
  27. //Create and start rpc server.
  28. jsonrpclite.SetRpcLogger(Logger)
  29. dingTalkService.initialize()
  30. progressService.initialize()
  31. router := jsonrpclite.NewRpcRouter()
  32. router.RegisterService("DingTalkService", dingTalkService)
  33. router.RegisterService("LoginService", loginService)
  34. router.RegisterService("AdminService", adminService)
  35. router.RegisterService("DepartmentService", departmentService)
  36. router.RegisterService("EmployeeService", employeeService)
  37. router.RegisterService("WorkingDayService", workingDayService)
  38. router.RegisterService("WorkingDayStatisticsService", workingDayStatisticsService)
  39. router.RegisterService("StatisticsTableService", statisticsTableService)
  40. router.RegisterService("ViewCodeService", viewCodeService)
  41. router.RegisterService("EmailService", emailService)
  42. router.RegisterService("HolidayService", holidayService)
  43. router.RegisterService("DomainService", domainService)
  44. router.RegisterService("MessageTemplateService", messageTemplateService)
  45. router.RegisterService("ProgressService", progressService)
  46. engine := jsonrpclite.NewRpcHttpServerEngine(8080)
  47. //engine := jsonrpclite.NewRpcHttpServerEngine(12087)
  48. server := jsonrpclite.NewRpcServer(engine)
  49. server.Start(router)
  50. fmt.Println("Server started.")
  51. fmt.Scanln()
  52. }