智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
2.9 KiB

  1. package task
  2. import (
  3. "applet/app/task/svc"
  4. "math/rand"
  5. "time"
  6. )
  7. //25结算上个月1-30结算订单
  8. func taskHwStarbucksOrder() {
  9. for {
  10. if len(ch) > workerNum {
  11. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  12. } else {
  13. goto START
  14. }
  15. }
  16. START:
  17. ch <- 1
  18. svc.HwLoop("starbucks")
  19. <-ch
  20. }
  21. func taskHwMovieOrder() {
  22. for {
  23. if len(ch) > workerNum {
  24. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  25. } else {
  26. goto START
  27. }
  28. }
  29. START:
  30. ch <- 1
  31. svc.HwLoop("movie")
  32. <-ch
  33. }
  34. func taskHwMcdonaldOrder() {
  35. for {
  36. if len(ch) > workerNum {
  37. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  38. } else {
  39. goto START
  40. }
  41. }
  42. START:
  43. ch <- 1
  44. svc.HwLoop("mcdonald")
  45. <-ch
  46. }
  47. func taskHwNayukiOrder() {
  48. for {
  49. if len(ch) > workerNum {
  50. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  51. } else {
  52. goto START
  53. }
  54. }
  55. START:
  56. ch <- 1
  57. svc.HwLoop("nayuki")
  58. <-ch
  59. }
  60. func taskHwLuckinOrder() {
  61. for {
  62. if len(ch) > workerNum {
  63. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  64. } else {
  65. goto START
  66. }
  67. }
  68. START:
  69. ch <- 1
  70. svc.HwLoop("luckin")
  71. <-ch
  72. }
  73. func taskHwPizzaOrder() {
  74. for {
  75. if len(ch) > workerNum {
  76. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  77. } else {
  78. goto START
  79. }
  80. }
  81. START:
  82. ch <- 1
  83. svc.HwLoop("pizza")
  84. <-ch
  85. }
  86. func taskHwPagodaOrder() {
  87. for {
  88. if len(ch) > workerNum {
  89. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  90. } else {
  91. goto START
  92. }
  93. }
  94. START:
  95. ch <- 1
  96. svc.HwLoop("pagoda")
  97. <-ch
  98. }
  99. func taskHwBurgerKingOrder() {
  100. for {
  101. if len(ch) > workerNum {
  102. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  103. } else {
  104. goto START
  105. }
  106. }
  107. START:
  108. ch <- 1
  109. svc.HwLoop("burger_king")
  110. <-ch
  111. }
  112. func taskHwHeyteaOrder() {
  113. for {
  114. if len(ch) > workerNum {
  115. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  116. } else {
  117. goto START
  118. }
  119. }
  120. START:
  121. ch <- 1
  122. svc.HwLoop("heytea")
  123. <-ch
  124. }
  125. func taskHwToKfcOrder() {
  126. for {
  127. if len(ch) > workerNum {
  128. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  129. } else {
  130. goto START
  131. }
  132. }
  133. START:
  134. ch <- 1
  135. svc.HwLoop("to_kfc")
  136. <-ch
  137. }
  138. func taskHwWallaceOrder() {
  139. for {
  140. if len(ch) > workerNum {
  141. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  142. } else {
  143. goto START
  144. }
  145. }
  146. START:
  147. ch <- 1
  148. svc.HwLoop("wallace")
  149. <-ch
  150. }
  151. func taskHwFlowerCakeOrder() {
  152. for {
  153. if len(ch) > workerNum {
  154. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  155. } else {
  156. goto START
  157. }
  158. }
  159. START:
  160. ch <- 1
  161. svc.HwLoop("flowerCake")
  162. <-ch
  163. }
  164. func taskHwDeliveryOrder() {
  165. for {
  166. if len(ch) > workerNum {
  167. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  168. } else {
  169. goto START
  170. }
  171. }
  172. START:
  173. ch <- 1
  174. svc.HwLoop("delivery")
  175. <-ch
  176. }
  177. func taskHwTourismOrder() {
  178. for {
  179. if len(ch) > workerNum {
  180. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  181. } else {
  182. goto START
  183. }
  184. }
  185. START:
  186. ch <- 1
  187. svc.HwLoop("tourism")
  188. <-ch
  189. }