├── LICENSE ├── README.md ├── db-改版支持5版本数据库.sql ├── lottery-admin └── test ├── lottery-api └── test ├── lottery-mobile ├── pom.xml └── src │ └── main │ ├── java │ └── me │ │ └── zohar │ │ ├── MobileApplication.java │ │ └── lottery │ │ ├── PageController.java │ │ ├── betting │ │ └── controller │ │ │ └── BettingController.java │ │ ├── config │ │ └── security │ │ │ ├── AuthenticationFailHandler.java │ │ │ ├── AuthenticationSuccessHandler.java │ │ │ ├── CustomUserDetailsService.java │ │ │ ├── LogoutHandler.java │ │ │ ├── UserAccountDetails.java │ │ │ └── WebSecurityConfig.java │ │ ├── dictconfig │ │ └── controller │ │ │ └── DictController.java │ │ ├── game │ │ └── controller │ │ │ └── GameController.java │ │ ├── issue │ │ └── controller │ │ │ └── IssueController.java │ │ ├── mastercontrol │ │ └── controller │ │ │ └── MasterControlController.java │ │ ├── rechargewithdraw │ │ └── controller │ │ │ ├── RechargeController.java │ │ │ ├── RechargeWithdrawLogController.java │ │ │ └── WithdrawController.java │ │ └── useraccount │ │ └── controller │ │ └── UserAccountController.java │ └── resources │ ├── application.yml │ ├── static │ ├── css │ │ └── common │ │ │ └── common.css │ ├── images │ │ ├── index │ │ │ ├── login.png │ │ │ ├── recharge.png │ │ │ ├── register.png │ │ │ ├── service.png │ │ │ └── withdraw.png │ │ └── lottery-logo │ │ │ ├── cqssc.png │ │ │ ├── gd11x5.png │ │ │ ├── js11x5.png │ │ │ ├── jx11x5.png │ │ │ ├── tjssc.png │ │ │ └── xjssc.png │ ├── js │ │ ├── common │ │ │ ├── common.js │ │ │ └── ssc.js │ │ ├── cqssc.js │ │ └── personal-center.js │ └── plugins │ │ └── combinatorics │ │ └── combinatorics.js │ └── templates │ └── common │ ├── footer.html │ └── header.html ├── lottery-task ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── me │ │ │ └── zohar │ │ │ ├── TaskApplication.java │ │ │ └── lottery │ │ │ ├── RedisMessageListener.java │ │ │ ├── betting │ │ │ └── task │ │ │ │ └── BettingRebateAutoSettlementTask.java │ │ │ ├── config │ │ │ ├── mq │ │ │ │ └── XxlMqConf.java │ │ │ └── schedule │ │ │ │ └── ScheduleConfig.java │ │ │ ├── information │ │ │ └── task │ │ │ │ └── SyncLotteryInformationTask.java │ │ │ ├── issue │ │ │ └── task │ │ │ │ ├── GenerateIssueTask.java │ │ │ │ ├── SyncCqsscLotteryNumTask.java │ │ │ │ ├── SyncGd11x5LotteryNumTask.java │ │ │ │ ├── SyncJs11x5LotteryNumTask.java │ │ │ │ ├── SyncJx11x5LotteryNumTask.java │ │ │ │ ├── SyncSh11x5LotteryNumTask.java │ │ │ │ ├── SyncTjsscLotteryNumTask.java │ │ │ │ ├── SyncXjsscLotteryNumTask.java │ │ │ │ ├── SyncYnsscLotteryNumTask.java │ │ │ │ └── SyncZj11x5LotteryNumTask.java │ │ │ └── rechargewithdraw │ │ │ └── task │ │ │ ├── RechargeOrderAutoSettlementTask.java │ │ │ └── RechargeOrderTimeoutDealTask.java │ │ └── resources │ │ └── application.yml └── target │ └── classes │ ├── META-INF │ └── maven │ │ └── me.zohar │ │ └── lottery-task │ │ ├── pom.properties │ │ └── pom.xml │ ├── application.yml │ └── me │ └── zohar │ ├── TaskApplication.class │ └── lottery │ ├── RedisMessageListener.class │ ├── betting │ └── task │ │ └── BettingRebateAutoSettlementTask.class │ ├── config │ ├── mq │ │ └── XxlMqConf.class │ └── schedule │ │ └── ScheduleConfig.class │ ├── information │ └── task │ │ └── SyncLotteryInformationTask.class │ ├── issue │ └── task │ │ ├── GenerateIssueTask.class │ │ ├── SyncCqsscLotteryNumTask.class │ │ ├── SyncGd11x5LotteryNumTask.class │ │ ├── SyncJs11x5LotteryNumTask.class │ │ ├── SyncJx11x5LotteryNumTask.class │ │ ├── SyncSh11x5LotteryNumTask.class │ │ ├── SyncTjsscLotteryNumTask.class │ │ ├── SyncXjsscLotteryNumTask.class │ │ ├── SyncYnsscLotteryNumTask.class │ │ └── SyncZj11x5LotteryNumTask.class │ └── rechargewithdraw │ └── task │ ├── RechargeOrderAutoSettlementTask.class │ └── RechargeOrderTimeoutDealTask.class ├── lottery-web └── test ├── lottery-原版8.0数据库.sql ├── pom.xml ├── 彩种图标大全.png ├── 截图 ├── 下级开户.png ├── 下级账号管理.png ├── 充值.png ├── 团队充值明细.png ├── 团队帐变报表.png ├── 投注.png ├── 投注订单详情.png ├── 投注记录.png ├── 提现.png ├── 撤单.png ├── 购彩大厅.png ├── 追号.png ├── 追号记录.png └── 首页.png ├── 盛大彩票网站-彩票,时时彩,博彩网站.rar └── 视图 ├── 每日盈亏.txt ├── 游戏情况.txt └── 返点赔率情况.txt /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lottery 2 | 盛大彩票网站-彩票,时时彩,博彩网站 3 | ### 压缩包里为工程的完整代码,包含全部资料 4 | -------------------------------------------------------------------------------- /lottery-admin/test: -------------------------------------------------------------------------------- 1 | 1111 2 | -------------------------------------------------------------------------------- /lottery-api/test: -------------------------------------------------------------------------------- 1 | 111 2 | -------------------------------------------------------------------------------- /lottery-mobile/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | me.zohar 8 | lottery 9 | 0.0.1-SNAPSHOT 10 | 11 | lottery-mobile 12 | lottery-web 13 | jar 14 | 15 | UTF-8 16 | 17 | 18 | 19 | me.zohar 20 | lottery-api 21 | 0.0.1-SNAPSHOT 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 28 | 29 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-thymeleaf 35 | 36 | 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-maven-plugin 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/MobileApplication.java: -------------------------------------------------------------------------------- 1 | package me.zohar; 2 | 3 | import org.springframework.boot.ApplicationArguments; 4 | import org.springframework.boot.ApplicationRunner; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; 9 | import com.alicp.jetcache.anno.config.EnableMethodCache; 10 | 11 | @SpringBootApplication 12 | @EnableMethodCache(basePackages = "me.zohar.lottery") 13 | @EnableCreateCacheAnnotation 14 | public class MobileApplication implements ApplicationRunner { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(MobileApplication.class, args); 18 | } 19 | 20 | @Override 21 | public void run(ApplicationArguments args) throws Exception { 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/PageController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | @Controller 7 | public class PageController { 8 | 9 | /** 10 | * 首页 11 | * 12 | * @return 13 | */ 14 | @GetMapping("/") 15 | public String index() { 16 | return "index"; 17 | } 18 | 19 | @GetMapping("/login") 20 | public String login() { 21 | return "login"; 22 | } 23 | 24 | @GetMapping("/register") 25 | public String register() { 26 | return "register"; 27 | } 28 | 29 | /** 30 | * 游戏大厅 31 | * 32 | * @return 33 | */ 34 | @GetMapping("/game-hall") 35 | public String gameHall() { 36 | return "game-hall"; 37 | } 38 | 39 | /** 40 | * 开奖大厅 41 | * 42 | * @return 43 | */ 44 | @GetMapping("/lottery-hall") 45 | public String lotteryHall() { 46 | return "lottery-hall"; 47 | } 48 | 49 | /** 50 | * 我的主页 51 | * @return 52 | */ 53 | @GetMapping("/my-home-page") 54 | public String myHomePage() { 55 | return "my-home-page"; 56 | } 57 | 58 | /** 59 | * 提现 60 | * @return 61 | */ 62 | @GetMapping("/withdraw") 63 | public String withdraw() { 64 | return "withdraw"; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/betting/controller/BettingController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.betting.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | import me.zohar.lottery.betting.param.BettingOrderQueryCondParam; 13 | import me.zohar.lottery.betting.param.PlaceOrderParam; 14 | import me.zohar.lottery.betting.service.BettingService; 15 | import me.zohar.lottery.common.vo.Result; 16 | import me.zohar.lottery.config.security.UserAccountDetails; 17 | 18 | @Controller 19 | @RequestMapping("/betting") 20 | public class BettingController { 21 | 22 | @Autowired 23 | private BettingService bettingService; 24 | 25 | /** 26 | * 获取我或下级账号投注信息详情 27 | * 28 | * @param id 29 | * @return 30 | */ 31 | @GetMapping("/findMyOrLowerLevelBettingOrderDetails") 32 | @ResponseBody 33 | public Result findMyOrLowerLevelBettingOrderDetails(String id) { 34 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 35 | .getPrincipal(); 36 | return Result.success().setData(bettingService.findMyOrLowerLevelBettingOrderDetails(id, user.getUserAccountId())); 37 | } 38 | 39 | /** 40 | * 分页获取我的投注订单信息 41 | * 42 | * @param param 43 | * @return 44 | */ 45 | @GetMapping("/findMyBettingOrderInfoByPage") 46 | @ResponseBody 47 | public Result findMyBettingOrderInfoByPage(BettingOrderQueryCondParam param) { 48 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 49 | .getPrincipal(); 50 | param.setUserAccountId(user.getUserAccountId()); 51 | return Result.success().setData(bettingService.findMyBettingOrderInfoByPage(param)); 52 | } 53 | 54 | @GetMapping("/findTodayLatestThe5TimeBettingRecord") 55 | @ResponseBody 56 | public Result findTodayLatestThe5TimeBettingRecord(String gameCode) { 57 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 58 | .getPrincipal(); 59 | return Result.success() 60 | .setData(bettingService.findTodayLatestThe5TimeBettingRecord(user.getUserAccountId(), gameCode)); 61 | } 62 | 63 | /** 64 | * 下单 65 | * 66 | * @return 67 | */ 68 | @PostMapping("/placeOrder") 69 | @ResponseBody 70 | public Result placeOrder(@RequestBody PlaceOrderParam placeOrderParam) { 71 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 72 | .getPrincipal(); 73 | bettingService.placeOrder(placeOrderParam, user.getUserAccountId()); 74 | return Result.success(); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/AuthenticationFailHandler.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.springframework.security.core.AuthenticationException; 11 | import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; 12 | import org.springframework.stereotype.Component; 13 | 14 | import com.alibaba.fastjson.JSONObject; 15 | 16 | import me.zohar.lottery.common.vo.Result; 17 | 18 | /** 19 | * 登录失败处理类 20 | * 21 | * @author zohar 22 | * @date 2019年1月23日 23 | * 24 | */ 25 | @Component 26 | public class AuthenticationFailHandler extends SimpleUrlAuthenticationFailureHandler { 27 | 28 | @Override 29 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, 30 | AuthenticationException e) throws IOException, ServletException { 31 | response.setCharacterEncoding("UTF-8"); 32 | response.setContentType("application/json"); 33 | PrintWriter out = response.getWriter(); 34 | out.println(JSONObject.toJSONString(Result.fail(500, "用户名或密码错误"))); 35 | out.flush(); 36 | out.close(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/AuthenticationSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.core.Authentication; 12 | import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; 13 | import org.springframework.stereotype.Component; 14 | 15 | import com.alibaba.fastjson.JSONObject; 16 | 17 | import me.zohar.lottery.common.vo.Result; 18 | import me.zohar.lottery.useraccount.service.UserAccountService; 19 | 20 | /** 21 | * 登录成功处理类 22 | * 23 | * @author zohar 24 | * @date 2019年1月23日 25 | * 26 | */ 27 | @Component 28 | public class AuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { 29 | 30 | @Autowired 31 | private UserAccountService userAccountService; 32 | 33 | @Override 34 | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, 35 | Authentication authentication) throws IOException, ServletException { 36 | UserAccountDetails user = (UserAccountDetails) authentication.getPrincipal(); 37 | userAccountService.updateLatelyLoginTime(user.getUserAccountId()); 38 | 39 | response.setCharacterEncoding("UTF-8"); 40 | response.setContentType("application/json"); 41 | PrintWriter out = response.getWriter(); 42 | out.println(JSONObject.toJSONString(Result.success().setMsg("登录成功"))); 43 | out.flush(); 44 | out.close(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/CustomUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.userdetails.UserDetails; 5 | import org.springframework.security.core.userdetails.UserDetailsService; 6 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 7 | import org.springframework.stereotype.Service; 8 | 9 | import lombok.extern.slf4j.Slf4j; 10 | import me.zohar.lottery.useraccount.service.UserAccountService; 11 | import me.zohar.lottery.useraccount.vo.LoginAccountInfoVO; 12 | 13 | /** 14 | * 通过实现UserDetailsService接口提供复杂认证 15 | * 16 | * @author 黄振华 17 | * @date 2018年8月28日 18 | * 19 | */ 20 | @Service 21 | @Slf4j 22 | public class CustomUserDetailsService implements UserDetailsService { 23 | 24 | @Autowired 25 | private UserAccountService userAccountService; 26 | 27 | @Override 28 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 29 | LoginAccountInfoVO loginAccountInfo = userAccountService.getLoginAccountInfo(username); 30 | if (loginAccountInfo == null) { 31 | log.warn("账号不存在:{}", username); 32 | throw new UsernameNotFoundException("用户名或密码不正确"); 33 | } 34 | 35 | return new UserAccountDetails(loginAccountInfo); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/LogoutHandler.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.springframework.security.core.Authentication; 11 | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; 12 | import org.springframework.stereotype.Component; 13 | 14 | import com.alibaba.fastjson.JSONObject; 15 | 16 | import me.zohar.lottery.common.vo.Result; 17 | 18 | /** 19 | * 退出登录处理类 20 | * 21 | * @author zohar 22 | * @date 2019年1月23日 23 | * 24 | */ 25 | @Component 26 | public class LogoutHandler implements LogoutSuccessHandler { 27 | 28 | @Override 29 | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 30 | throws IOException, ServletException { 31 | System.out.println("logout...."); 32 | response.setCharacterEncoding("UTF-8"); 33 | response.setContentType("application/json"); 34 | PrintWriter out = response.getWriter(); 35 | out.println(JSONObject.toJSONString(Result.success().setMsg("退出成功"))); 36 | out.flush(); 37 | out.close(); 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/UserAccountDetails.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.security.core.GrantedAuthority; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | 8 | import me.zohar.lottery.useraccount.vo.LoginAccountInfoVO; 9 | 10 | public class UserAccountDetails implements UserDetails { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | private String id; 18 | 19 | private String userName; 20 | 21 | private String loginPwd; 22 | 23 | public UserAccountDetails(LoginAccountInfoVO loginAccountInfo) { 24 | if (loginAccountInfo != null) { 25 | this.id = loginAccountInfo.getId(); 26 | this.userName = loginAccountInfo.getUserName(); 27 | this.loginPwd = loginAccountInfo.getLoginPwd(); 28 | } 29 | } 30 | 31 | /** 32 | * 获取登陆用户账号id 33 | * 34 | * @return 35 | */ 36 | public String getUserAccountId() { 37 | return this.id; 38 | } 39 | 40 | @Override 41 | public Collection getAuthorities() { 42 | return null; 43 | } 44 | 45 | @Override 46 | public String getPassword() { 47 | return this.loginPwd; 48 | } 49 | 50 | @Override 51 | public String getUsername() { 52 | return this.userName; 53 | } 54 | 55 | @Override 56 | public boolean isAccountNonExpired() { 57 | return true; 58 | } 59 | 60 | @Override 61 | public boolean isAccountNonLocked() { 62 | return true; 63 | } 64 | 65 | @Override 66 | public boolean isCredentialsNonExpired() { 67 | return true; 68 | } 69 | 70 | @Override 71 | public boolean isEnabled() { 72 | return true; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/config/security/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.security; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 7 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 8 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 10 | 11 | @EnableWebSecurity 12 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 13 | 14 | @Autowired 15 | private CustomUserDetailsService customUserDetailsService; 16 | 17 | @Autowired 18 | private AuthenticationSuccessHandler successHandler; 19 | 20 | @Autowired 21 | private AuthenticationFailHandler failHandler; 22 | 23 | @Autowired 24 | private LogoutHandler logoutHandler; 25 | 26 | @Override 27 | protected void configure(HttpSecurity http) throws Exception { 28 | http.csrf().disable() 29 | .authorizeRequests() 30 | .antMatchers("/").permitAll() 31 | .antMatchers("/register").permitAll() 32 | .antMatchers("/game-hall").permitAll() 33 | .antMatchers("/lottery-hall").permitAll() 34 | .antMatchers("/my-home-page").permitAll() 35 | .antMatchers("/game/findTop5HotGame").permitAll() 36 | .antMatchers("/game/findAllGameSituation").permitAll() 37 | .antMatchers("/masterControl/getInviteRegisterSetting").permitAll() 38 | .antMatchers("/userAccount/register").permitAll() 39 | .antMatchers("/userAccount/getUserAccountInfo").permitAll() 40 | .anyRequest().authenticated() 41 | .and().formLogin().loginPage("/login").loginProcessingUrl("/login") 42 | .successHandler(successHandler).failureHandler(failHandler).permitAll() 43 | .and().logout().logoutUrl("/logout").logoutSuccessHandler(logoutHandler).permitAll(); 44 | } 45 | 46 | @Override 47 | public void configure(WebSecurity web) throws Exception { 48 | web.ignoring().antMatchers("/css/**", "/images/**", "/js/**", "/plugins/**"); 49 | } 50 | 51 | /** 52 | * 添加 UserDetailsService, 实现自定义登录校验 53 | */ 54 | @Override 55 | protected void configure(AuthenticationManagerBuilder builder) throws Exception { 56 | builder.eraseCredentials(false).userDetailsService(customUserDetailsService) 57 | .passwordEncoder(new BCryptPasswordEncoder()); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/dictconfig/controller/DictController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.dictconfig.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | import me.zohar.lottery.common.vo.Result; 9 | import me.zohar.lottery.dictconfig.DictHolder; 10 | 11 | @Controller 12 | @RequestMapping("/dict") 13 | public class DictController { 14 | 15 | @GetMapping("/findDictItemInCache") 16 | @ResponseBody 17 | public Result findDictItemInCache(String dictTypeCode) { 18 | return Result.success().setData(DictHolder.findDictItem(dictTypeCode)); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/game/controller/GameController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.game.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | import me.zohar.lottery.common.vo.Result; 10 | import me.zohar.lottery.game.service.GameService; 11 | 12 | @Controller 13 | @RequestMapping("/game") 14 | public class GameController { 15 | 16 | @Autowired 17 | private GameService gameService; 18 | 19 | @GetMapping("/findTop5HotGame") 20 | @ResponseBody 21 | public Result findTop5HotGame() { 22 | return Result.success().setData(gameService.findTop5HotGame()); 23 | } 24 | 25 | @GetMapping("/findAllGameSituation") 26 | @ResponseBody 27 | public Result findAllGameSituation() { 28 | return Result.success().setData(gameService.findAllGameSituation()); 29 | } 30 | 31 | @GetMapping("/findGamePlayAndNumLocateByGameCode") 32 | @ResponseBody 33 | public Result findGamePlayAndNumLocateByGameCode(String gameCode) { 34 | return Result.success().setData(gameService.findGamePlayDetailsByGameCode(gameCode)); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/issue/controller/IssueController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | import me.zohar.lottery.common.vo.Result; 10 | import me.zohar.lottery.issue.service.IssueService; 11 | 12 | @Controller 13 | @RequestMapping("/issue") 14 | public class IssueController { 15 | 16 | @Autowired 17 | private IssueService issueService; 18 | 19 | @GetMapping("/findLatelyThe50TimeIssue") 20 | @ResponseBody 21 | public Result findLatelyThe50TimeIssue(String gameCode) { 22 | return Result.success().setData(issueService.findLatelyThe50TimeIssue(gameCode)); 23 | } 24 | 25 | @GetMapping("/getCurrentIssue") 26 | @ResponseBody 27 | public Result getCurrentIssue(String gameCode) { 28 | return Result.success().setData(issueService.getCurrentIssue(gameCode)); 29 | } 30 | 31 | @GetMapping("/getNextIssue") 32 | @ResponseBody 33 | public Result getNextIssue(String gameCode) { 34 | return Result.success().setData(issueService.getNextIssue(gameCode)); 35 | } 36 | 37 | @GetMapping("/getLatelyIssue") 38 | @ResponseBody 39 | public Result getLatelyIssue(String gameCode) { 40 | return Result.success().setData(issueService.getLatelyIssue(gameCode)); 41 | } 42 | 43 | @GetMapping("/findTodayTrackingNumberIssue") 44 | @ResponseBody 45 | public Result findTodayTrackingNumberIssue(String gameCode) { 46 | return Result.success().setData(issueService.findTodayTrackingNumberIssue(gameCode)); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/mastercontrol/controller/MasterControlController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.mastercontrol.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | import me.zohar.lottery.common.vo.Result; 10 | import me.zohar.lottery.mastercontrol.service.MasterControlService; 11 | 12 | /** 13 | * 总控 14 | * 15 | * @author zohar 16 | * @date 2019年3月9日 17 | * 18 | */ 19 | @Controller 20 | @RequestMapping("/masterControl") 21 | public class MasterControlController { 22 | 23 | @Autowired 24 | private MasterControlService service; 25 | 26 | @GetMapping("/getInviteRegisterSetting") 27 | @ResponseBody 28 | public Result getInviteRegisterSetting() { 29 | return Result.success().setData(service.getInviteRegisterSetting()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/rechargewithdraw/controller/RechargeController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.rechargewithdraw.controller; 2 | 3 | import java.io.IOException; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.context.SecurityContextHolder; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | import me.zohar.lottery.common.vo.Result; 14 | import me.zohar.lottery.config.security.UserAccountDetails; 15 | import me.zohar.lottery.rechargewithdraw.param.MuspayCallbackParam; 16 | import me.zohar.lottery.rechargewithdraw.param.RechargeOrderParam; 17 | import me.zohar.lottery.rechargewithdraw.service.RechargeService; 18 | 19 | /** 20 | * 21 | * @author zohar 22 | * @date 2019年1月21日 23 | * 24 | */ 25 | @Controller 26 | @RequestMapping("/recharge") 27 | public class RechargeController { 28 | 29 | @Autowired 30 | private RechargeService rechargeService; 31 | 32 | @RequestMapping("/muspayCallback") 33 | @ResponseBody 34 | public String muspayCallback(@RequestBody MuspayCallbackParam param) throws IOException { 35 | rechargeService.checkOrderWithMuspay(param); 36 | return Result.success().getMsg(); 37 | } 38 | 39 | @PostMapping("/generateRechargeOrder") 40 | @ResponseBody 41 | public Result generateRechargeOrder(RechargeOrderParam param) { 42 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 43 | .getPrincipal(); 44 | param.setUserAccountId(user.getUserAccountId()); 45 | return Result.success().setData(rechargeService.generateRechargeOrder(param)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/rechargewithdraw/controller/RechargeWithdrawLogController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.rechargewithdraw.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | 10 | import me.zohar.lottery.common.vo.Result; 11 | import me.zohar.lottery.config.security.UserAccountDetails; 12 | import me.zohar.lottery.rechargewithdraw.param.RechargeWithdrawLogQueryCondParam; 13 | import me.zohar.lottery.rechargewithdraw.service.RechargeWithdrawLogService; 14 | 15 | @Controller 16 | @RequestMapping("/rechargeWithdrawLog") 17 | public class RechargeWithdrawLogController { 18 | 19 | @Autowired 20 | private RechargeWithdrawLogService rechargeWithdrawLogService; 21 | 22 | @GetMapping("/findMyRechargeWithdrawLogByPage") 23 | @ResponseBody 24 | public Result findMyRechargeWithdrawLogByPage(RechargeWithdrawLogQueryCondParam param) { 25 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 26 | .getPrincipal(); 27 | param.setUserAccountId(user.getUserAccountId()); 28 | return Result.success().setData(rechargeWithdrawLogService.findMyRechargeWithdrawLogByPage(param)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/rechargewithdraw/controller/WithdrawController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.rechargewithdraw.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | 10 | import me.zohar.lottery.common.vo.Result; 11 | import me.zohar.lottery.config.security.UserAccountDetails; 12 | import me.zohar.lottery.rechargewithdraw.param.StartWithdrawParam; 13 | import me.zohar.lottery.rechargewithdraw.service.WithdrawService; 14 | 15 | @Controller 16 | @RequestMapping("/withdraw") 17 | public class WithdrawController { 18 | 19 | @Autowired 20 | private WithdrawService withdrawService; 21 | 22 | @PostMapping("/startWithdraw") 23 | @ResponseBody 24 | public Result startWithdraw(StartWithdrawParam param) { 25 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 26 | .getPrincipal(); 27 | param.setUserAccountId(user.getUserAccountId()); 28 | withdrawService.startWithdraw(param); 29 | return Result.success(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/java/me/zohar/lottery/useraccount/controller/UserAccountController.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.useraccount.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | 11 | import me.zohar.lottery.common.vo.Result; 12 | import me.zohar.lottery.config.security.UserAccountDetails; 13 | import me.zohar.lottery.useraccount.param.AccountChangeLogQueryCondParam; 14 | import me.zohar.lottery.useraccount.param.BindBankInfoParam; 15 | import me.zohar.lottery.useraccount.param.ModifyLoginPwdParam; 16 | import me.zohar.lottery.useraccount.param.ModifyMoneyPwdParam; 17 | import me.zohar.lottery.useraccount.param.UserAccountRegisterParam; 18 | import me.zohar.lottery.useraccount.service.UserAccountService; 19 | import me.zohar.lottery.useraccount.vo.UserAccountInfoVO; 20 | 21 | @Controller 22 | @RequestMapping("/userAccount") 23 | public class UserAccountController { 24 | 25 | @Autowired 26 | private UserAccountService userAccountService; 27 | 28 | @PostMapping("/bindBankInfo") 29 | @ResponseBody 30 | public Result bindBankInfo(BindBankInfoParam param) { 31 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 32 | .getPrincipal(); 33 | param.setUserAccountId(user.getUserAccountId()); 34 | userAccountService.bindBankInfo(param); 35 | return Result.success(); 36 | } 37 | 38 | @GetMapping("/getBankInfo") 39 | @ResponseBody 40 | public Result getBankInfo() { 41 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 42 | .getPrincipal(); 43 | return Result.success().setData(userAccountService.getBankInfo(user.getUserAccountId())); 44 | } 45 | 46 | @PostMapping("/modifyLoginPwd") 47 | @ResponseBody 48 | public Result modifyLoginPwd(ModifyLoginPwdParam param) { 49 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 50 | .getPrincipal(); 51 | param.setUserAccountId(user.getUserAccountId()); 52 | userAccountService.modifyLoginPwd(param); 53 | return Result.success(); 54 | } 55 | 56 | @PostMapping("/modifyMoneyPwd") 57 | @ResponseBody 58 | public Result modifyMoneyPwd(ModifyMoneyPwdParam param) { 59 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 60 | .getPrincipal(); 61 | param.setUserAccountId(user.getUserAccountId()); 62 | userAccountService.modifyMoneyPwd(param); 63 | return Result.success(); 64 | } 65 | 66 | @PostMapping("/register") 67 | @ResponseBody 68 | public Result register(UserAccountRegisterParam param) { 69 | userAccountService.register(param); 70 | return Result.success(); 71 | } 72 | 73 | @GetMapping("/getUserAccountInfo") 74 | @ResponseBody 75 | public Result getUserAccountInfo() { 76 | Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 77 | if ("anonymousUser".equals(principal)) { 78 | return Result.success(); 79 | } 80 | UserAccountDetails user = (UserAccountDetails) principal; 81 | UserAccountInfoVO userAccountInfo = userAccountService.getUserAccountInfo(user.getUserAccountId()); 82 | return Result.success().setData(userAccountInfo); 83 | } 84 | 85 | @GetMapping("/findMyAccountChangeLogByPage") 86 | @ResponseBody 87 | public Result findMyAccountChangeLogByPage(AccountChangeLogQueryCondParam param) { 88 | UserAccountDetails user = (UserAccountDetails) SecurityContextHolder.getContext().getAuthentication() 89 | .getPrincipal(); 90 | param.setUserAccountId(user.getUserAccountId()); 91 | return Result.success().setData(userAccountService.findAccountChangeLogByPage(param)); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | spring: 4 | datasource: 5 | url: jdbc:mysql://127.0.0.1:3306/lottery?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai 6 | username: root 7 | password: 123456 8 | driverClassName: com.mysql.jdbc.Driver 9 | jpa: 10 | show-sql: true 11 | generate-ddl: true 12 | hibernate: 13 | ddl-auto: none 14 | thymeleaf: 15 | cache: false 16 | redis: 17 | port: 6379 18 | host: localhost 19 | jetcache: 20 | areaInCacheName: false 21 | local: 22 | default: 23 | type: linkedhashmap 24 | keyConvertor: fastjson 25 | remote: 26 | default: 27 | type: redis.lettuce 28 | keyConvertor: fastjson 29 | uri: redis://127.0.0.1:6379/ -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/css/common/common.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | [v-cloak] { 4 | display: none; 5 | } 6 | 7 | a { 8 | cursor: pointer; 9 | } 10 | 11 | .page-body { 12 | padding-top: 2.5rem; 13 | padding-bottom: 4.5rem; 14 | } -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/index/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/index/login.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/index/recharge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/index/recharge.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/index/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/index/register.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/index/service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/index/service.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/index/withdraw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/index/withdraw.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/cqssc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/cqssc.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/gd11x5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/gd11x5.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/js11x5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/js11x5.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/jx11x5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/jx11x5.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/tjssc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/tjssc.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/images/lottery-logo/xjssc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-mobile/src/main/resources/static/images/lottery-logo/xjssc.png -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/js/common/common.js: -------------------------------------------------------------------------------- 1 | Vue.http.interceptors.push(function(request) { 2 | return function(response) { 3 | if (response.body.code != 200) { 4 | response.ok = false; 5 | layer.alert(response.body.msg, { 6 | title : '提示', 7 | icon : 7, 8 | time : 3000 9 | }); 10 | } 11 | }; 12 | }); -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/js/common/ssc.js: -------------------------------------------------------------------------------- 1 | var ssc = new Vue({ 2 | el : '#ssc', 3 | data : { 4 | gameCode : '', 5 | gameName : '', 6 | latelyIssue : {}, 7 | currentIssue : {}, 8 | bettingState : '', 9 | countdownHour : '00', 10 | countdownMinute : '00', 11 | countdownSecond : '00', 12 | 13 | openCountdownHour : '00', 14 | openCountdownMinute : '00', 15 | openCountdownSecond : '00', 16 | latelyThe5TimeLotteryResults : [], 17 | todayLatestBettingRecords : [], 18 | // 选中号码的注数 19 | bettingCount : 0, 20 | // 选中号码投注的金额 21 | bettingAmount : 0, 22 | // 投注金额底数 23 | baseAmount : 2, 24 | // 倍数 25 | multiple : 1, 26 | preBettingRecords : [], 27 | // 游戏玩法类别map 28 | gamePlayCategoryMap : new Map(), 29 | gamePlayCategorys : [], 30 | selectedGamePlayCategory : {}, 31 | subGamePlayCategorys : [], 32 | selectedPlay : {}, 33 | // 选号号位集合 34 | numLocates : [] 35 | }, 36 | computed : { 37 | // 监听倍数输入框的值,控制只能输入正整数数字 38 | inputMultiple : { 39 | get : function() { 40 | return this.multiple; 41 | }, 42 | set : function(newValue) { 43 | if (/^[0-9]*[1-9][0-9]*$/.test(newValue)) { 44 | this.multiple = parseInt(newValue); 45 | } else if (newValue == '') { 46 | this.multiple = ''; 47 | } 48 | } 49 | }, 50 | 51 | // 预投注的总投注金额 52 | preBettingTotalAmount : { 53 | get : function() { 54 | var preBettingRecords = this.preBettingRecords; 55 | if (preBettingRecords.length == 0) { 56 | return 0; 57 | } 58 | var preBettingTotalAmount = 0; 59 | for (var i = 0; i < preBettingRecords.length; i++) { 60 | var preBettingRecord = preBettingRecords[i]; 61 | preBettingTotalAmount += (this.baseAmount * this.multiple * preBettingRecord.bettingCount); 62 | } 63 | return preBettingTotalAmount; 64 | } 65 | }, 66 | // 预投注的总注数 67 | preBettingTotalCount : { 68 | get : function() { 69 | var preBettingRecords = this.preBettingRecords; 70 | if (preBettingRecords.length == 0) { 71 | return 0; 72 | } 73 | var preBettingTotalCount = 0; 74 | for (var i = 0; i < preBettingRecords.length; i++) { 75 | preBettingTotalCount += preBettingRecords[i].bettingCount; 76 | } 77 | return preBettingTotalCount; 78 | } 79 | } 80 | }, 81 | created : function() { 82 | this.gameCode = globalGameCode; 83 | this.gameName = globalGameName; 84 | this.refreshLatelyIssue(); 85 | this.refreshCurrentIssue(); 86 | this.loadGamePlay(); 87 | this.refreshLatelyThe5TimeIssue(); 88 | this.refreshTodayLatestBettingRecord(); 89 | 90 | }, 91 | methods : { 92 | showPlayIntroduceDesc : function() { 93 | layer.tips($('.play-introduce-desc').text(), '.play-introduce', { 94 | tips : [ 2, '#f13131' ], 95 | maxWidth : 250, 96 | time : 0, 97 | closeBtn : 0 98 | }); 99 | }, 100 | hidePlayIntroduceDesc : function() { 101 | layer.closeAll('tips'); 102 | }, 103 | 104 | /** 105 | * 切换游戏玩法类别 106 | */ 107 | switchGamePlayCategory : function(gamePlayCategory) { 108 | var subGamePlayCategorys = []; 109 | var subGamePlayCategoryMap = this.gamePlayCategoryMap.get(gamePlayCategory.gamePlayCategoryName); 110 | for (key in subGamePlayCategoryMap) { 111 | var subGamePlayCategory = { 112 | subGamePlayCategoryName : key, 113 | plays : [] 114 | }; 115 | for (gamePlayKey in subGamePlayCategoryMap[key]) { 116 | subGamePlayCategory.plays.push(subGamePlayCategoryMap[key][gamePlayKey]); 117 | } 118 | subGamePlayCategorys.push(subGamePlayCategory); 119 | } 120 | this.selectedGamePlayCategory = gamePlayCategory; 121 | this.subGamePlayCategorys = subGamePlayCategorys; 122 | this.switchPlay(subGamePlayCategorys[0].plays[0]); 123 | }, 124 | 125 | /** 126 | * 切换玩法 127 | */ 128 | switchPlay : function(play) { 129 | this.selectedPlay = play; 130 | 131 | var numLocates = []; 132 | var numLocateArr = play.numLocates; 133 | for (var i = 0; i < numLocateArr.length; i++) { 134 | var data = numLocateArr[i]; 135 | var numLocate = { 136 | locateName : data.numLocateName, 137 | maxSelected : data.maxSelected, 138 | hasFilterBtnFlag : data.hasFilterBtnFlag, 139 | nums : [] 140 | }; 141 | var numArr = data.optionalNums; 142 | for (var j = 0; j < numArr.length; j++) { 143 | numLocate.nums.push({ 144 | num : numArr[j].num, 145 | odds : numArr[j].odds, 146 | selectedFlag : false 147 | }); 148 | } 149 | numLocates.push(numLocate); 150 | } 151 | this.numLocates = numLocates; 152 | this.resetBettingCountAndAmount(); 153 | }, 154 | 155 | /** 156 | * 加载游戏玩法 157 | */ 158 | loadGamePlay : function() { 159 | var that = this; 160 | this.$http.get('/game/findGamePlayAndNumLocateByGameCode', { 161 | params : { 162 | gameCode : that.gameCode 163 | } 164 | }).then(function(res) { 165 | var gamePlayCategorys = []; 166 | var gamePlayCategoryMap = new Map(); 167 | var result = res.body.data; 168 | for (var i = 0; i < result.length; i++) { 169 | var obj = result[i]; 170 | if (obj.state == '0') { 171 | continue; 172 | } 173 | var gamePlay = { 174 | gamePlayCode : obj.gamePlayCode, 175 | gamePlayName : obj.gamePlayName, 176 | gamePlayDesc : obj.gamePlayDesc, 177 | odds : obj.odds, 178 | oddsMode : obj.oddsMode, 179 | numLocates : obj.numLocates, 180 | gameCode : obj.gameCode, 181 | gamePlayCategoryCode : obj.gamePlayCategoryCode, 182 | gamePlayCategoryName : obj.gamePlayCategoryName, 183 | subGamePlayCategoryCode : obj.subGamePlayCategoryCode, 184 | subGamePlayCategoryName : obj.subGamePlayCategoryName 185 | }; 186 | var gamePlayCategoryName = gamePlay.gamePlayCategoryName; 187 | var subGamePlayCategoryName = gamePlay.subGamePlayCategoryName; 188 | if (gamePlayCategoryMap.get(gamePlayCategoryName) == null) { 189 | gamePlayCategoryMap.set(gamePlayCategoryName, {}); 190 | gamePlayCategorys.push({ 191 | gamePlayCategoryCode : gamePlay.gamePlayCategoryCode, 192 | gamePlayCategoryName : gamePlayCategoryName 193 | }); 194 | } 195 | var gamePlayCategory = gamePlayCategoryMap.get(gamePlayCategoryName); 196 | if (gamePlayCategory[subGamePlayCategoryName] == null) { 197 | gamePlayCategory[subGamePlayCategoryName] = {}; 198 | } 199 | gamePlayCategory[subGamePlayCategoryName][gamePlay.gamePlayName] = gamePlay; 200 | } 201 | 202 | that.gamePlayCategorys = gamePlayCategorys; 203 | that.gamePlayCategoryMap = gamePlayCategoryMap; 204 | that.switchGamePlayCategory(gamePlayCategorys[0]); 205 | }); 206 | }, 207 | 208 | /** 209 | * 全选号球 210 | */ 211 | selectAllNo : function(index) { 212 | var nums = this.numLocates[index].nums; 213 | for (var i = 0; i < nums.length; i++) { 214 | nums[i].selectedFlag = true; 215 | } 216 | this.calcBettingCountAndAmount(); 217 | }, 218 | 219 | /** 220 | * 选择全部单数号球 221 | */ 222 | selectOddNum : function(index) { 223 | var nums = this.numLocates[index].nums; 224 | for (var i = 0; i < nums.length; i++) { 225 | nums[i].selectedFlag = !(nums[i].num % 2 == 0); 226 | } 227 | this.calcBettingCountAndAmount(); 228 | }, 229 | 230 | /** 231 | * 选择全部双数号球 232 | */ 233 | selectEvenNum : function(index) { 234 | var nums = this.numLocates[index].nums; 235 | for (var i = 0; i < nums.length; i++) { 236 | nums[i].selectedFlag = (nums[i].num % 2 == 0); 237 | } 238 | this.calcBettingCountAndAmount(); 239 | }, 240 | 241 | /** 242 | * 选择全部大的号球 243 | */ 244 | selectBigNum : function(index) { 245 | var nums = this.numLocates[index].nums; 246 | var bigStartIndex = parseInt(nums.length / 2); 247 | for (var i = 0; i < nums.length; i++) { 248 | nums[i].selectedFlag = i >= bigStartIndex; 249 | } 250 | this.calcBettingCountAndAmount(); 251 | }, 252 | 253 | /** 254 | * 选择全部小的号球 255 | */ 256 | selectSmallNum : function(index) { 257 | var nums = this.numLocates[index].nums; 258 | var smallEndIndex = parseInt(nums.length / 2) - 1; 259 | for (var i = 0; i < nums.length; i++) { 260 | nums[i].selectedFlag = i <= smallEndIndex; 261 | } 262 | this.calcBettingCountAndAmount(); 263 | }, 264 | 265 | /** 266 | * 清空所有位置号球选中状态 267 | */ 268 | clearAllLocateSelected : function() { 269 | for (var i = 0; i < this.numLocates.length; i++) { 270 | var nums = this.numLocates[i].nums; 271 | for (var j = 0; j < nums.length; j++) { 272 | nums[j].selectedFlag = false; 273 | } 274 | } 275 | }, 276 | 277 | /** 278 | * 清空号球选中状态 279 | */ 280 | clearSelected : function(index) { 281 | var nums = this.numLocates[index].nums; 282 | for (var i = 0; i < nums.length; i++) { 283 | nums[i].selectedFlag = false; 284 | } 285 | this.calcBettingCountAndAmount(); 286 | }, 287 | 288 | /** 289 | * 切换号球选中状态 290 | */ 291 | switchNumSelectedState : function(i, j) { 292 | var selectedFlag = this.numLocates[i].nums[j].selectedFlag; 293 | this.numLocates[i].nums[j].selectedFlag = !selectedFlag; 294 | this.calcBettingCountAndAmount(); 295 | }, 296 | 297 | /** 298 | * 获取选择的号球 299 | */ 300 | getSelectedBalls : function() { 301 | var selectedBalls = []; 302 | for (var i = 0; i < this.numLocates.length; i++) { 303 | var arr = []; 304 | var nums = this.numLocates[i].nums; 305 | for (var j = 0; j < nums.length; j++) { 306 | var num = nums[j]; 307 | if (num.selectedFlag) { 308 | arr.push(num.num); 309 | } 310 | } 311 | selectedBalls.push(arr); 312 | } 313 | return selectedBalls; 314 | }, 315 | 316 | /** 317 | * 切换元角模式 318 | */ 319 | switchYuanJiaoMode : function(baseAmount) { 320 | var that = this; 321 | if (that.preBettingRecords.length > 0) { 322 | layer.confirm('切换元角分模式将影响您现有投注项,是否继续?', { 323 | icon : 7, 324 | title : '提示' 325 | }, function(index) { 326 | var preBettingRecords = that.preBettingRecords; 327 | for (var i = 0; i < preBettingRecords.length; i++) { 328 | preBettingRecords[i].bettingAmount = baseAmount; 329 | } 330 | that.baseAmount = baseAmount; 331 | layer.close(index); 332 | }); 333 | } else { 334 | that.baseAmount = baseAmount; 335 | } 336 | }, 337 | 338 | /** 339 | * 倍数减1,倍数最低是1倍 340 | */ 341 | multipleSubtract1 : function() { 342 | if (!/^[0-9]*[1-9][0-9]*$/.test(this.multiple)) { 343 | this.multiple = 1; 344 | } 345 | if (this.multiple > 1) { 346 | this.multiple = this.multiple - 1; 347 | } 348 | }, 349 | 350 | /** 351 | * 倍数加1 352 | */ 353 | multipleAdd1 : function() { 354 | if (!/^[0-9]*[1-9][0-9]*$/.test(this.multiple)) { 355 | this.multiple = 1; 356 | } 357 | this.multiple = this.multiple + 1; 358 | }, 359 | 360 | /** 361 | * 重置选中号码的注数和投注的金额 362 | */ 363 | resetBettingCountAndAmount : function() { 364 | this.bettingCount = 0; 365 | this.bettingAmount = 0; 366 | }, 367 | 368 | /** 369 | * 阶乘 370 | */ 371 | factorial : function(e) { 372 | return e <= 1 ? 1 : e * this.factorial(e - 1); 373 | }, 374 | 375 | /** 376 | * 计算选中号码的注数和投注的金额 377 | */ 378 | calcBettingCountAndAmount : function() { 379 | var selectedBalls = this.getSelectedBalls(); 380 | var ballJoins = []; 381 | for (var i = 0; i < selectedBalls.length; i++) { 382 | ballJoins.push(selectedBalls[i].join('')); 383 | } 384 | var bettingCount = 0; 385 | var packageNumGroup = []; 386 | switch (this.selectedPlay.gamePlayCode) { 387 | case '5XDW': 388 | for (var c = 0; c < 5; c++) { 389 | bettingCount += ballJoins[c].length; 390 | } 391 | break; 392 | case 'H1ZX': 393 | bettingCount = ballJoins[ballJoins.length - 1].length; 394 | break; 395 | case '5XZX': 396 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length * ballJoins[3].length * ballJoins[4].length; 397 | break; 398 | case 'Q4ZX': 399 | case 'H4ZX': 400 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length * ballJoins[3].length; 401 | break; 402 | case 'Q3ZX': 403 | case 'Z3ZX': 404 | case 'H3ZX': 405 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length; 406 | break; 407 | case 'Q3ZXHZ': 408 | bettingCount = 0; 409 | break; 410 | case 'Q2ZX': 411 | case 'H2ZX': 412 | bettingCount = ballJoins[0].length * ballJoins[1].length; 413 | break; 414 | case 'Q31M': 415 | case 'Z31M': 416 | case 'H31M': 417 | case '4X1M': 418 | bettingCount = ballJoins[0].length; 419 | break; 420 | case 'Q2ZUX': 421 | case 'H2ZUX': 422 | case 'Q32M': 423 | case 'Z32M': 424 | case 'H32M': 425 | case '4X2M': 426 | case '5X2M': 427 | bettingCount = ballJoins[0].length * (ballJoins[0].length - 1) / 2; 428 | break; 429 | case '5X3M': 430 | bettingCount = ballJoins[0].length * (ballJoins[0].length - 1) * (ballJoins[0].length - 2) / 6; 431 | break; 432 | case 'R2ZX': 433 | for (var c = 0; c < 4; c++) { 434 | for (var p = c + 1; p < 5; p++) { 435 | bettingCount += ballJoins[c].length * ballJoins[p].length; 436 | } 437 | } 438 | break; 439 | // case 'ZUX120': 440 | // ballJoins[0].length > 4 && (bettingCount = 5 === 441 | // ballJoins[0].length ? 1 : this.factorial(ballJoins[0].length) / 442 | // (120 * this.factorial(ballJoins[0].length - 5))); 443 | // break; 444 | default: 445 | throw 'unknown play ' + this.selectedPlayCode 446 | } 447 | this.bettingCount = bettingCount; 448 | this.bettingAmount = bettingCount * this.baseAmount; 449 | }, 450 | 451 | generatePreBettingRecords : function() { 452 | if (this.bettingCount == 0) { 453 | return; 454 | } 455 | var selectedNos = []; 456 | var selectedBalls = this.getSelectedBalls(); 457 | for (var i = 0; i < selectedBalls.length; i++) { 458 | if (selectedBalls[i].length == 0) { 459 | selectedNos.push('-'); 460 | } else { 461 | selectedNos.push(selectedBalls[i].join('_')); 462 | } 463 | } 464 | var preBettingRecords = [ { 465 | gamePlayCategoryCode : this.selectedPlay.gamePlayCategoryCode, 466 | gamePlayCode : this.selectedPlay.gamePlayCode, 467 | gamePlayName : this.selectedPlay.gamePlayName, 468 | selectedNo : selectedNos.join(','), 469 | bettingCount : this.bettingCount 470 | } ]; 471 | return preBettingRecords; 472 | }, 473 | 474 | /** 475 | * 添加到预选投注记录列表 476 | */ 477 | addToPreBettingOrder : function() { 478 | var preBettingRecords = this.generatePreBettingRecords(); 479 | if (preBettingRecords == null || preBettingRecords.length == 0) { 480 | return; 481 | } 482 | this.preBettingRecords = this.preBettingRecords.concat(preBettingRecords); 483 | this.clearAllLocateSelected(); 484 | this.resetBettingCountAndAmount(); 485 | }, 486 | 487 | /** 488 | * 删除预选投注记录 489 | */ 490 | delPreBettingOrder : function(index) { 491 | this.preBettingRecords.splice(index, 1); 492 | }, 493 | 494 | /** 495 | * 清空预选投注记录 496 | */ 497 | clearPreBettingOrder : function() { 498 | this.preBettingRecords = []; 499 | }, 500 | 501 | /** 502 | * 一键下单 503 | */ 504 | onekeyPlaceOrder : function() { 505 | this.addToPreBettingOrder(); 506 | this.placeOrder(); 507 | }, 508 | 509 | /** 510 | * 下单 511 | */ 512 | placeOrder : function() { 513 | var that = this; 514 | if (that.preBettingRecords == null || that.preBettingRecords.length == 0) { 515 | return; 516 | } 517 | var placeOrderParam = { 518 | gameCode : that.selectedPlay.gameCode, 519 | issueNum : that.currentIssue.issueNum, 520 | baseAmount : that.baseAmount, 521 | multiple : that.multiple, 522 | bettingRecords : that.preBettingRecords 523 | }; 524 | that.$http.post('/betting/placeOrder', placeOrderParam).then(function(res) { 525 | layer.alert('下单成功!', { 526 | icon : 1, 527 | time : 3000, 528 | shade : false 529 | }); 530 | that.clearPreBettingOrder(); 531 | header.refreshBalance(); 532 | that.refreshTodayLatestBettingRecord(); 533 | }); 534 | }, 535 | 536 | /** 537 | * 刷新今日最新的投注记录 538 | */ 539 | refreshTodayLatestBettingRecord : function() { 540 | var that = this; 541 | that.$http.get('/betting/findTodayLatestThe5TimeBettingRecord', { 542 | params : { 543 | gameCode : that.gameCode 544 | } 545 | }).then(function(res) { 546 | var todayLatestBettingRecords = []; 547 | for (var i = 0; i < res.body.data.length; i++) { 548 | var bettingRecord = { 549 | bettingOrderId : res.body.data[i].bettingOrderId, 550 | gamePlayName : res.body.data[i].gamePlayName, 551 | issueNum : res.body.data[i].issueNum, 552 | bettingAmount : res.body.data[i].bettingAmount, 553 | stateName : res.body.data[i].stateName 554 | }; 555 | todayLatestBettingRecords.push(bettingRecord); 556 | } 557 | that.todayLatestBettingRecords = todayLatestBettingRecords; 558 | }); 559 | }, 560 | 561 | splitlotteryNum : function(lotteryNum) { 562 | if (lotteryNum == null || lotteryNum == '') { 563 | return []; 564 | } 565 | return lotteryNum.split(','); 566 | }, 567 | 568 | getNextIssue : function() { 569 | var that = this; 570 | that.$http.get('/issue/getNextIssue', { 571 | params : { 572 | gameCode : that.gameCode 573 | } 574 | }).then(function(res) { 575 | var currentTime = dayjs(res.body.timestamp); 576 | var startTime = dayjs(res.body.data.startTime); 577 | var residueSecond = startTime.diff(currentTime, 'second'); 578 | that.residueSecond = residueSecond; 579 | that.openCountdown(); 580 | }); 581 | }, 582 | 583 | /** 584 | * 开市倒计时 585 | */ 586 | openCountdown : function() { 587 | var that = this; 588 | var openCountdownInterval = window.setInterval(function() { 589 | var residueSecond = that.residueSecond; 590 | that.updateOpenCountdownClock(residueSecond); 591 | 592 | residueSecond--; 593 | that.residueSecond = residueSecond; 594 | 595 | if (residueSecond < 0) { 596 | window.clearInterval(openCountdownInterval); 597 | that.refreshLatelyIssue(); 598 | that.refreshCurrentIssue(); 599 | } 600 | }, 1000); 601 | }, 602 | 603 | /** 604 | * 更新开市倒计时 605 | */ 606 | updateOpenCountdownClock : function(residueSecond) { 607 | var that = this; 608 | var openCountdownHour = 0; 609 | var openCountdownMinute = 0; 610 | var openCountdownSecond = 0; 611 | if (residueSecond > 0) { 612 | openCountdownHour = parseInt(residueSecond / (60 * 60) % 24); 613 | openCountdownMinute = parseInt(residueSecond / 60 % 60); 614 | openCountdownSecond = parseInt(residueSecond % 60); 615 | } 616 | if (openCountdownHour < 10) { 617 | openCountdownHour = '0' + openCountdownHour; 618 | } 619 | if (openCountdownMinute < 10) { 620 | openCountdownMinute = '0' + openCountdownMinute; 621 | } 622 | if (openCountdownSecond < 10) { 623 | openCountdownSecond = '0' + openCountdownSecond; 624 | } 625 | that.openCountdownHour = openCountdownHour; 626 | that.openCountdownMinute = openCountdownMinute; 627 | that.openCountdownSecond = openCountdownSecond; 628 | }, 629 | 630 | /** 631 | * 刷新最近的期号 632 | */ 633 | refreshLatelyIssue : function(updateFlag) { 634 | var that = this; 635 | that.$http.get('/issue/getLatelyIssue', { 636 | params : { 637 | gameCode : that.gameCode 638 | } 639 | }).then(function(res) { 640 | var latelyIssue = res.body.data; 641 | if (latelyIssue == null) { 642 | that.latelyIssue = { 643 | issue : '**' 644 | }; 645 | return; 646 | } 647 | that.latelyIssue = latelyIssue; 648 | var lotteryNumArr = that.splitlotteryNum(that.latelyIssue.lotteryNum); 649 | if (lotteryNumArr == 0) { 650 | window.setTimeout(function() { 651 | that.refreshLatelyIssue(true); 652 | }, 5000); 653 | } else if (updateFlag) { 654 | header.refreshBalance(); 655 | that.refreshLatelyThe5TimeIssue(); 656 | that.refreshTodayLatestBettingRecord(); 657 | } 658 | }); 659 | }, 660 | 661 | /** 662 | * 更新倒计时 663 | */ 664 | updateCountdownClock : function(residueSecond) { 665 | var that = this; 666 | var countdownHour = 0; 667 | var countdownMinute = 0; 668 | var countdownSecond = 0; 669 | if (residueSecond > 0) { 670 | countdownHour = parseInt(residueSecond / (60 * 60) % 24); 671 | countdownMinute = parseInt(residueSecond / 60 % 60); 672 | countdownSecond = parseInt(residueSecond % 60); 673 | } 674 | if (countdownHour < 10) { 675 | countdownHour = '0' + countdownHour; 676 | } 677 | if (countdownMinute < 10) { 678 | countdownMinute = '0' + countdownMinute; 679 | } 680 | if (countdownSecond < 10) { 681 | countdownSecond = '0' + countdownSecond; 682 | } 683 | that.countdownHour = countdownHour; 684 | that.countdownMinute = countdownMinute; 685 | that.countdownSecond = countdownSecond; 686 | }, 687 | 688 | /** 689 | * 开奖倒计时,15秒时间 已截止投注 690 | */ 691 | lotteryCountdown : function() { 692 | var that = this; 693 | var lotteryCountdownInterval = window.setInterval(function() { 694 | var residueSecond = that.residueSecond; 695 | that.updateCountdownClock(residueSecond); 696 | 697 | residueSecond--; 698 | that.residueSecond = residueSecond; 699 | that.bettingState = '已截止投注'; 700 | 701 | if (residueSecond < 0) { 702 | window.clearInterval(lotteryCountdownInterval); 703 | that.refreshLatelyIssue(true); 704 | that.refreshCurrentIssue(); 705 | } 706 | }, 1000); 707 | }, 708 | 709 | /** 710 | * 投注倒计时,9分30秒时间 可以投注 711 | */ 712 | bettingCountdown : function() { 713 | var that = this; 714 | var bettingCountdownInterval = window.setInterval(function() { 715 | var residueSecond = that.residueSecond; 716 | that.updateCountdownClock(residueSecond); 717 | 718 | residueSecond--; 719 | that.residueSecond = residueSecond; 720 | that.bettingState = '可以投注'; 721 | 722 | if (residueSecond < 0) { 723 | window.clearInterval(bettingCountdownInterval); 724 | layer.alert(that.currentIssue.issue + '期销售已封盘....,请进入下一期购买', { 725 | icon : 7, 726 | time : 3000, 727 | shade : false 728 | }); 729 | that.residueSecond = 15; 730 | that.lotteryCountdown(); 731 | } 732 | }, 1000); 733 | }, 734 | 735 | /** 736 | * 刷新当前的期号 737 | */ 738 | refreshCurrentIssue : function() { 739 | var that = this; 740 | that.$http.get('/issue/getCurrentIssue', { 741 | params : { 742 | gameCode : that.gameCode 743 | } 744 | }).then(function(res) { 745 | var currentIssue = res.body.data; 746 | if (currentIssue == null) { 747 | that.currentIssue = { 748 | issue : '*************' 749 | }; 750 | that.getNextIssue(); 751 | return; 752 | } 753 | that.currentIssue = currentIssue; 754 | var currentTime = dayjs(res.body.timestamp); 755 | var endTime = dayjs(res.body.data.endTime); 756 | var residueSecond = endTime.diff(currentTime, 'second'); 757 | if (residueSecond > 15) { 758 | that.residueSecond = residueSecond - 15; 759 | that.bettingCountdown(); 760 | } else if (residueSecond > 0 && residueSecond <= 15) { 761 | that.residueSecond = residueSecond; 762 | that.lotteryCountdown(); 763 | } 764 | }); 765 | }, 766 | 767 | /** 768 | * 刷新最近5次的开奖期号数据 769 | */ 770 | refreshLatelyThe5TimeIssue : function() { 771 | var that = this; 772 | this.$http.get('/issue/findLatelyThe5TimeIssue', { 773 | params : { 774 | gameCode : that.gameCode 775 | } 776 | }).then(function(res) { 777 | var latelyThe5TimeLotteryResults = []; 778 | for (var i = 0; i < res.body.data.length; i++) { 779 | var lotteryNum = res.body.data[i].lotteryNum; 780 | var lotteryResult = { 781 | issueNum : res.body.data[i].issueNum, 782 | lotteryNums : lotteryNum != null ? lotteryNum.split(",") : [] 783 | }; 784 | latelyThe5TimeLotteryResults.push(lotteryResult); 785 | } 786 | that.latelyThe5TimeLotteryResults = latelyThe5TimeLotteryResults; 787 | }); 788 | }, 789 | 790 | gotoBettingRecordPage : function() { 791 | window.location.href = '/betting-record'; 792 | } 793 | } 794 | }); -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/js/cqssc.js: -------------------------------------------------------------------------------- 1 | new Vue({ 2 | el : '#content', 3 | data : { 4 | latelyIssue : {}, 5 | currentIssue : {}, 6 | bettingState : '', 7 | countdownHour : '00', 8 | countdownMinute : '00', 9 | countdownSecond : '00', 10 | 11 | openCountdownHour : '00', 12 | openCountdownMinute : '00', 13 | openCountdownSecond : '00', 14 | latelyThe5TimeLotteryResults : [], 15 | todayLatestBettingRecords : [], 16 | // 选中号码的注数 17 | bettingCount : 0, 18 | // 选中号码投注的金额 19 | bettingAmount : 0, 20 | // 投注金额底数 21 | baseAmount : 2, 22 | // 倍数 23 | multiple : 1, 24 | preBettingRecords : [], 25 | // 游戏玩法类别map 26 | gamePlayCategoryMap : new Map(), 27 | gamePlayCategorys : [], 28 | selectedGamePlayCategory : {}, 29 | subGamePlayCategorys : [], 30 | selectedPlay : {}, 31 | // 选号号位集合 32 | numLocates : [] 33 | }, 34 | computed : { 35 | // 监听倍数输入框的值,控制只能输入正整数数字 36 | inputMultiple : { 37 | get : function() { 38 | return this.multiple; 39 | }, 40 | set : function(newValue) { 41 | if (/^[0-9]*[1-9][0-9]*$/.test(newValue)) { 42 | this.multiple = parseInt(newValue); 43 | } else if (newValue == '') { 44 | this.multiple = ''; 45 | } 46 | } 47 | }, 48 | 49 | // 预投注的总投注金额 50 | preBettingTotalAmount : { 51 | get : function() { 52 | var preBettingRecords = this.preBettingRecords; 53 | if (preBettingRecords.length == 0) { 54 | return 0; 55 | } 56 | var preBettingTotalAmount = 0; 57 | for (var i = 0; i < preBettingRecords.length; i++) { 58 | var preBettingRecord = preBettingRecords[i]; 59 | preBettingTotalAmount += (this.baseAmount * this.multiple * preBettingRecord.bettingCount); 60 | } 61 | return preBettingTotalAmount; 62 | } 63 | }, 64 | // 预投注的总注数 65 | preBettingTotalCount : { 66 | get : function() { 67 | var preBettingRecords = this.preBettingRecords; 68 | if (preBettingRecords.length == 0) { 69 | return 0; 70 | } 71 | var preBettingTotalCount = 0; 72 | for (var i = 0; i < preBettingRecords.length; i++) { 73 | preBettingTotalCount += preBettingRecords[i].bettingCount; 74 | } 75 | return preBettingTotalCount; 76 | } 77 | } 78 | }, 79 | created : function() { 80 | this.refreshLatelyIssue(); 81 | this.refreshCurrentIssue(); 82 | this.loadGamePlay(); 83 | this.refreshLatelyThe5TimeIssue(); 84 | this.refreshTodayLatestBettingRecord(); 85 | 86 | }, 87 | methods : { 88 | showPlayIntroduceDesc : function() { 89 | layer.tips($('.play-introduce-desc').text(), '.play-introduce', { 90 | tips : [ 2, '#f13131' ], 91 | maxWidth : 250, 92 | time : 0, 93 | closeBtn : 0 94 | }); 95 | }, 96 | hidePlayIntroduceDesc : function() { 97 | layer.closeAll('tips'); 98 | }, 99 | 100 | /** 101 | * 切换游戏玩法类别 102 | */ 103 | switchGamePlayCategory : function(gamePlayCategory) { 104 | var subGamePlayCategorys = []; 105 | var subGamePlayCategoryMap = this.gamePlayCategoryMap.get(gamePlayCategory.gamePlayCategoryName); 106 | for (key in subGamePlayCategoryMap) { 107 | var subGamePlayCategory = { 108 | subGamePlayCategoryName : key, 109 | plays : [] 110 | }; 111 | for (gamePlayKey in subGamePlayCategoryMap[key]) { 112 | subGamePlayCategory.plays.push(subGamePlayCategoryMap[key][gamePlayKey]); 113 | } 114 | subGamePlayCategorys.push(subGamePlayCategory); 115 | } 116 | this.selectedGamePlayCategory = gamePlayCategory; 117 | this.subGamePlayCategorys = subGamePlayCategorys; 118 | this.switchPlay(subGamePlayCategorys[0].plays[0]); 119 | }, 120 | 121 | /** 122 | * 切换玩法 123 | */ 124 | switchPlay : function(play) { 125 | this.selectedPlay = play; 126 | 127 | var numLocates = []; 128 | var numLocateArr = play.numLocates; 129 | for (var i = 0; i < numLocateArr.length; i++) { 130 | var data = numLocateArr[i]; 131 | var numLocate = { 132 | locateName : data.numLocateName, 133 | maxSelected : data.maxSelected, 134 | hasFilterBtnFlag : data.hasFilterBtnFlag, 135 | nums : [] 136 | }; 137 | var numArr = data.nums.split(','); 138 | for (var j = 0; j < numArr.length; j++) { 139 | numLocate.nums.push({ 140 | num : numArr[j], 141 | selectedFlag : false 142 | }); 143 | } 144 | numLocates.push(numLocate); 145 | } 146 | this.numLocates = numLocates; 147 | this.resetBettingCountAndAmount(); 148 | }, 149 | 150 | /** 151 | * 加载游戏玩法 152 | */ 153 | loadGamePlay : function() { 154 | var that = this; 155 | this.$http.get('/game/findGamePlayAndNumLocateByGameCode', { 156 | params : { 157 | gameCode : 'CQSSC' 158 | } 159 | }).then(function(res) { 160 | var gamePlayCategorys = []; 161 | var gamePlayCategoryMap = new Map(); 162 | var result = res.body.data; 163 | for (var i = 0; i < result.length; i++) { 164 | var obj = result[i]; 165 | if (obj.state == '0') { 166 | continue; 167 | } 168 | var gamePlay = { 169 | gamePlayCode : obj.gamePlayCode, 170 | gamePlayName : obj.gamePlayName, 171 | gamePlayDesc : obj.gamePlayDesc, 172 | odds : obj.odds, 173 | numLocates : obj.numLocates, 174 | gameCode : obj.gameCode, 175 | gamePlayCategoryCode : obj.gamePlayCategoryCode, 176 | gamePlayCategoryName : obj.gamePlayCategoryName, 177 | subGamePlayCategoryCode : obj.subGamePlayCategoryCode, 178 | subGamePlayCategoryName : obj.subGamePlayCategoryName 179 | }; 180 | var gamePlayCategoryName = gamePlay.gamePlayCategoryName; 181 | var subGamePlayCategoryName = gamePlay.subGamePlayCategoryName; 182 | if (gamePlayCategoryMap.get(gamePlayCategoryName) == null) { 183 | gamePlayCategoryMap.set(gamePlayCategoryName, {}); 184 | gamePlayCategorys.push({ 185 | gamePlayCategoryCode : gamePlay.gamePlayCategoryCode, 186 | gamePlayCategoryName : gamePlayCategoryName 187 | }); 188 | } 189 | var gamePlayCategory = gamePlayCategoryMap.get(gamePlayCategoryName); 190 | if (gamePlayCategory[subGamePlayCategoryName] == null) { 191 | gamePlayCategory[subGamePlayCategoryName] = {}; 192 | } 193 | gamePlayCategory[subGamePlayCategoryName][gamePlay.gamePlayName] = gamePlay; 194 | } 195 | 196 | that.gamePlayCategorys = gamePlayCategorys; 197 | that.gamePlayCategoryMap = gamePlayCategoryMap; 198 | that.switchGamePlayCategory(gamePlayCategorys[0]); 199 | }); 200 | }, 201 | 202 | /** 203 | * 全选号球 204 | */ 205 | selectAllNo : function(index) { 206 | var nums = this.numLocates[index].nums; 207 | for (var i = 0; i < nums.length; i++) { 208 | nums[i].selectedFlag = true; 209 | } 210 | this.calcBettingCountAndAmount(); 211 | }, 212 | 213 | /** 214 | * 选择全部奇数号球 215 | */ 216 | selectOddNum : function(index) { 217 | var nums = this.numLocates[index].nums; 218 | for (var i = 0; i < nums.length; i++) { 219 | nums[i].selectedFlag = !(nums[i].num % 2 == 0); 220 | } 221 | this.calcBettingCountAndAmount(); 222 | }, 223 | 224 | /** 225 | * 选择全部偶数号球 226 | */ 227 | selectEvenNum : function(index) { 228 | var nums = this.numLocates[index].nums; 229 | for (var i = 0; i < nums.length; i++) { 230 | nums[i].selectedFlag = (nums[i].num % 2 == 0); 231 | } 232 | this.calcBettingCountAndAmount(); 233 | }, 234 | 235 | /** 236 | * 选择全部大的号球 237 | */ 238 | selectBigNum : function(index) { 239 | var nums = this.numLocates[index].nums; 240 | var bigStartIndex = parseInt(nums.length / 2); 241 | for (var i = 0; i < nums.length; i++) { 242 | nums[i].selectedFlag = i >= bigStartIndex; 243 | } 244 | this.calcBettingCountAndAmount(); 245 | }, 246 | 247 | /** 248 | * 选择全部小的号球 249 | */ 250 | selectSmallNum : function(index) { 251 | var nums = this.numLocates[index].nums; 252 | var smallEndIndex = parseInt(nums.length / 2) - 1; 253 | for (var i = 0; i < nums.length; i++) { 254 | nums[i].selectedFlag = i <= smallEndIndex; 255 | } 256 | this.calcBettingCountAndAmount(); 257 | }, 258 | 259 | /** 260 | * 清空所有位置号球选中状态 261 | */ 262 | clearAllLocateSelected : function() { 263 | for (var i = 0; i < this.numLocates.length; i++) { 264 | var nums = this.numLocates[i].nums; 265 | for (var j = 0; j < nums.length; j++) { 266 | nums[j].selectedFlag = false; 267 | } 268 | } 269 | }, 270 | 271 | /** 272 | * 清空号球选中状态 273 | */ 274 | clearSelected : function(index) { 275 | var nums = this.numLocates[index].nums; 276 | for (var i = 0; i < nums.length; i++) { 277 | nums[i].selectedFlag = false; 278 | } 279 | this.calcBettingCountAndAmount(); 280 | }, 281 | 282 | /** 283 | * 切换号球选中状态 284 | */ 285 | switchNumSelectedState : function(i, j) { 286 | var selectedFlag = this.numLocates[i].nums[j].selectedFlag; 287 | this.numLocates[i].nums[j].selectedFlag = !selectedFlag; 288 | this.calcBettingCountAndAmount(); 289 | }, 290 | 291 | /** 292 | * 获取选择的号球 293 | */ 294 | getSelectedBalls : function() { 295 | var selectedBalls = []; 296 | for (var i = 0; i < this.numLocates.length; i++) { 297 | var arr = []; 298 | var nums = this.numLocates[i].nums; 299 | for (var j = 0; j < nums.length; j++) { 300 | var num = nums[j]; 301 | if (num.selectedFlag) { 302 | arr.push(num.num); 303 | } 304 | } 305 | selectedBalls.push(arr); 306 | } 307 | return selectedBalls; 308 | }, 309 | 310 | /** 311 | * 切换元角模式 312 | */ 313 | switchYuanJiaoMode : function(baseAmount) { 314 | var that = this; 315 | if (that.preBettingRecords.length > 0) { 316 | layer.confirm('切换元角分模式将影响您现有投注项,是否继续?', { 317 | icon : 7, 318 | title : '提示' 319 | }, function(index) { 320 | var preBettingRecords = that.preBettingRecords; 321 | for (var i = 0; i < preBettingRecords.length; i++) { 322 | preBettingRecords[i].bettingAmount = baseAmount; 323 | } 324 | that.baseAmount = baseAmount; 325 | layer.close(index); 326 | }); 327 | } else { 328 | that.baseAmount = baseAmount; 329 | } 330 | }, 331 | 332 | /** 333 | * 倍数减1,倍数最低是1倍 334 | */ 335 | multipleSubtract1 : function() { 336 | if (!/^[0-9]*[1-9][0-9]*$/.test(this.multiple)) { 337 | this.multiple = 1; 338 | } 339 | if (this.multiple > 1) { 340 | this.multiple = this.multiple - 1; 341 | } 342 | }, 343 | 344 | /** 345 | * 倍数加1 346 | */ 347 | multipleAdd1 : function() { 348 | if (!/^[0-9]*[1-9][0-9]*$/.test(this.multiple)) { 349 | this.multiple = 1; 350 | } 351 | this.multiple = this.multiple + 1; 352 | }, 353 | 354 | /** 355 | * 重置选中号码的注数和投注的金额 356 | */ 357 | resetBettingCountAndAmount : function() { 358 | this.bettingCount = 0; 359 | this.bettingAmount = 0; 360 | }, 361 | 362 | /** 363 | * 计算选中号码的注数和投注的金额 364 | */ 365 | calcBettingCountAndAmount : function() { 366 | var selectedBalls = this.getSelectedBalls(); 367 | var ballJoins = []; 368 | for (var i = 0; i < selectedBalls.length; i++) { 369 | ballJoins.push(selectedBalls[i].join('')); 370 | } 371 | var bettingCount = 0; 372 | var packageNumGroup = []; 373 | switch (this.selectedPlay.gamePlayCode) { 374 | case '5XDW': 375 | for (var c = 0; c < 5; c++) { 376 | bettingCount += ballJoins[c].length; 377 | } 378 | break; 379 | case 'H1ZX': 380 | bettingCount = ballJoins[ballJoins.length - 1].length; 381 | break; 382 | case '5XZX': 383 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length * ballJoins[3].length * ballJoins[4].length; 384 | break; 385 | case 'Q4ZX': 386 | case 'H4ZX': 387 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length * ballJoins[3].length; 388 | break; 389 | case 'Q3ZX': 390 | case 'Z3ZX': 391 | case 'H3ZX': 392 | bettingCount = ballJoins[0].length * ballJoins[1].length * ballJoins[2].length; 393 | break; 394 | case 'Q3ZXHZ': 395 | bettingCount = 0; 396 | break; 397 | case 'Q2ZX': 398 | case 'H2ZX': 399 | bettingCount = ballJoins[0].length * ballJoins[1].length; 400 | break; 401 | case 'Q31M': 402 | case 'Z31M': 403 | case 'H31M': 404 | case '4X1M': 405 | bettingCount = ballJoins[0].length; 406 | break; 407 | case 'Q2ZUX': 408 | case 'H2ZUX': 409 | case 'Q32M': 410 | case 'Z32M': 411 | case 'H32M': 412 | case '4X2M': 413 | case '5X2M': 414 | bettingCount = ballJoins[0].length * (ballJoins[0].length - 1) / 2; 415 | break; 416 | case '5X3M': 417 | bettingCount = ballJoins[0].length * (ballJoins[0].length - 1) * (ballJoins[0].length - 2) / 6; 418 | break; 419 | case 'R2ZX': 420 | for (var c = 0; c < 4; c++) { 421 | for (var p = c + 1; p < 5; p++) { 422 | bettingCount += ballJoins[c].length * ballJoins[p].length; 423 | } 424 | } 425 | break; 426 | default: 427 | throw 'unknown play ' + this.selectedPlayCode 428 | } 429 | this.bettingCount = bettingCount; 430 | this.bettingAmount = bettingCount * this.baseAmount; 431 | }, 432 | 433 | generatePreBettingRecords : function() { 434 | if (this.bettingCount == 0) { 435 | return; 436 | } 437 | var selectedNos = []; 438 | var selectedBalls = this.getSelectedBalls(); 439 | for (var i = 0; i < selectedBalls.length; i++) { 440 | if (selectedBalls[i].length == 0) { 441 | selectedNos.push('-'); 442 | } else { 443 | selectedNos.push(selectedBalls[i].join('')); 444 | } 445 | } 446 | var preBettingRecords = [ { 447 | gamePlayCategoryCode : this.selectedPlay.gamePlayCategoryCode, 448 | gamePlayCode : this.selectedPlay.gamePlayCode, 449 | gamePlayName : this.selectedPlay.gamePlayName, 450 | selectedNo : selectedNos.join(','), 451 | bettingCount : this.bettingCount 452 | } ]; 453 | return preBettingRecords; 454 | }, 455 | 456 | /** 457 | * 添加到预选投注记录列表 458 | */ 459 | addToPreBettingOrder : function() { 460 | var preBettingRecords = this.generatePreBettingRecords(); 461 | if (preBettingRecords.length == 0) { 462 | return; 463 | } 464 | this.preBettingRecords = this.preBettingRecords.concat(preBettingRecords); 465 | this.clearAllLocateSelected(); 466 | this.resetBettingCountAndAmount(); 467 | }, 468 | 469 | /** 470 | * 删除预选投注记录 471 | */ 472 | delPreBettingOrder : function(index) { 473 | this.preBettingRecords.splice(index, 1); 474 | }, 475 | 476 | /** 477 | * 清空预选投注记录 478 | */ 479 | clearPreBettingOrder : function() { 480 | this.preBettingRecords = []; 481 | }, 482 | 483 | /** 484 | * 下单 485 | */ 486 | placeOrder : function() { 487 | var that = this; 488 | var placeOrderParam = { 489 | gameCode : that.selectedPlay.gameCode, 490 | issueNum : that.currentIssue.issueNum, 491 | baseAmount : that.baseAmount, 492 | multiple : that.multiple, 493 | bettingRecords : that.preBettingRecords 494 | }; 495 | that.$http.post('/betting/placeOrder', placeOrderParam).then(function(res) { 496 | layer.alert('下单成功!', { 497 | icon : 1, 498 | time : 3000, 499 | shade : false 500 | }); 501 | that.clearPreBettingOrder(); 502 | header.refreshBalance(); 503 | that.refreshTodayLatestBettingRecord(); 504 | }); 505 | }, 506 | 507 | /** 508 | * 刷新今日最新的投注记录 509 | */ 510 | refreshTodayLatestBettingRecord : function() { 511 | var that = this; 512 | that.$http.get('/betting/findTodayLatestThe5TimeBettingRecord', { 513 | params : { 514 | gameCode : 'CQSSC' 515 | } 516 | }).then(function(res) { 517 | var todayLatestBettingRecords = []; 518 | for (var i = 0; i < res.body.data.length; i++) { 519 | var bettingRecord = { 520 | bettingOrderId : res.body.data[i].bettingOrderId, 521 | gamePlayName : res.body.data[i].gamePlayName, 522 | issueNum : res.body.data[i].issueNum, 523 | bettingAmount : res.body.data[i].bettingAmount, 524 | stateName : res.body.data[i].stateName 525 | }; 526 | todayLatestBettingRecords.push(bettingRecord); 527 | } 528 | that.todayLatestBettingRecords = todayLatestBettingRecords; 529 | }); 530 | }, 531 | 532 | splitlotteryNum : function(lotteryNum) { 533 | if (lotteryNum == null || lotteryNum == '') { 534 | return []; 535 | } 536 | return lotteryNum.split(','); 537 | }, 538 | 539 | getNextIssue : function() { 540 | var that = this; 541 | that.$http.get('/issue/getNextIssue', { 542 | params : { 543 | gameCode : 'CQSSC' 544 | } 545 | }).then(function(res) { 546 | var currentTime = dayjs(res.body.timestamp); 547 | var startTime = dayjs(res.body.data.startTime); 548 | var residueSecond = startTime.diff(currentTime, 'second'); 549 | that.residueSecond = residueSecond; 550 | that.openCountdown(); 551 | }); 552 | }, 553 | 554 | /** 555 | * 开市倒计时 556 | */ 557 | openCountdown : function() { 558 | var that = this; 559 | var openCountdownInterval = window.setInterval(function() { 560 | var residueSecond = that.residueSecond; 561 | that.updateOpenCountdownClock(residueSecond); 562 | 563 | residueSecond--; 564 | that.residueSecond = residueSecond; 565 | 566 | if (residueSecond < 0) { 567 | window.clearInterval(openCountdownInterval); 568 | that.refreshLatelyIssue(); 569 | that.refreshCurrentIssue(); 570 | } 571 | }, 1000); 572 | }, 573 | 574 | /** 575 | * 更新开市倒计时 576 | */ 577 | updateOpenCountdownClock : function(residueSecond) { 578 | var that = this; 579 | var openCountdownHour = 0; 580 | var openCountdownMinute = 0; 581 | var openCountdownSecond = 0; 582 | if (residueSecond > 0) { 583 | openCountdownHour = parseInt(residueSecond / (60 * 60) % 24); 584 | openCountdownMinute = parseInt(residueSecond / 60 % 60); 585 | openCountdownSecond = parseInt(residueSecond % 60); 586 | } 587 | if (openCountdownHour < 10) { 588 | openCountdownHour = '0' + openCountdownHour; 589 | } 590 | if (openCountdownMinute < 10) { 591 | openCountdownMinute = '0' + openCountdownMinute; 592 | } 593 | if (openCountdownSecond < 10) { 594 | openCountdownSecond = '0' + openCountdownSecond; 595 | } 596 | that.openCountdownHour = openCountdownHour; 597 | that.openCountdownMinute = openCountdownMinute; 598 | that.openCountdownSecond = openCountdownSecond; 599 | }, 600 | 601 | /** 602 | * 刷新最近的期号 603 | */ 604 | refreshLatelyIssue : function(updateFlag) { 605 | var that = this; 606 | that.$http.get('/issue/getLatelyIssue', { 607 | params : { 608 | gameCode : 'CQSSC' 609 | } 610 | }).then(function(res) { 611 | var latelyIssue = res.body.data; 612 | if (latelyIssue == null) { 613 | that.latelyIssue = { 614 | issue : '**' 615 | }; 616 | return; 617 | } 618 | that.latelyIssue = latelyIssue; 619 | var lotteryNumArr = that.splitlotteryNum(that.latelyIssue.lotteryNum); 620 | if (lotteryNumArr == 0) { 621 | window.setTimeout(function() { 622 | that.refreshLatelyIssue(true); 623 | }, 5000); 624 | } else if (updateFlag) { 625 | header.refreshBalance(); 626 | that.refreshLatelyThe5TimeIssue(); 627 | that.refreshTodayLatestBettingRecord(); 628 | } 629 | }); 630 | }, 631 | 632 | /** 633 | * 更新倒计时 634 | */ 635 | updateCountdownClock : function(residueSecond) { 636 | var that = this; 637 | var countdownHour = 0; 638 | var countdownMinute = 0; 639 | var countdownSecond = 0; 640 | if (residueSecond > 0) { 641 | countdownHour = parseInt(residueSecond / (60 * 60) % 24); 642 | countdownMinute = parseInt(residueSecond / 60 % 60); 643 | countdownSecond = parseInt(residueSecond % 60); 644 | } 645 | if (countdownHour < 10) { 646 | countdownHour = '0' + countdownHour; 647 | } 648 | if (countdownMinute < 10) { 649 | countdownMinute = '0' + countdownMinute; 650 | } 651 | if (countdownSecond < 10) { 652 | countdownSecond = '0' + countdownSecond; 653 | } 654 | that.countdownHour = countdownHour; 655 | that.countdownMinute = countdownMinute; 656 | that.countdownSecond = countdownSecond; 657 | }, 658 | 659 | /** 660 | * 开奖倒计时,15秒时间 已截止投注 661 | */ 662 | lotteryCountdown : function() { 663 | var that = this; 664 | var lotteryCountdownInterval = window.setInterval(function() { 665 | var residueSecond = that.residueSecond; 666 | that.updateCountdownClock(residueSecond); 667 | 668 | residueSecond--; 669 | that.residueSecond = residueSecond; 670 | that.bettingState = '已截止投注'; 671 | 672 | if (residueSecond < 0) { 673 | window.clearInterval(lotteryCountdownInterval); 674 | that.refreshLatelyIssue(true); 675 | that.refreshCurrentIssue(); 676 | } 677 | }, 1000); 678 | }, 679 | 680 | /** 681 | * 投注倒计时,9分30秒时间 可以投注 682 | */ 683 | bettingCountdown : function() { 684 | var that = this; 685 | var bettingCountdownInterval = window.setInterval(function() { 686 | var residueSecond = that.residueSecond; 687 | that.updateCountdownClock(residueSecond); 688 | 689 | residueSecond--; 690 | that.residueSecond = residueSecond; 691 | that.bettingState = '可以投注'; 692 | 693 | if (residueSecond < 0) { 694 | window.clearInterval(bettingCountdownInterval); 695 | layer.alert(that.currentIssue.issue + '期销售已封盘....,请进入下一期购买', { 696 | icon : 7, 697 | time : 3000, 698 | shade : false 699 | }); 700 | that.residueSecond = 15; 701 | that.lotteryCountdown(); 702 | } 703 | }, 1000); 704 | }, 705 | 706 | /** 707 | * 刷新当前的期号 708 | */ 709 | refreshCurrentIssue : function() { 710 | var that = this; 711 | that.$http.get('/issue/getCurrentIssue', { 712 | params : { 713 | gameCode : 'CQSSC' 714 | } 715 | }).then(function(res) { 716 | var currentIssue = res.body.data; 717 | if (currentIssue == null) { 718 | that.currentIssue = { 719 | issue : '*************' 720 | }; 721 | that.getNextIssue(); 722 | return; 723 | } 724 | that.currentIssue = currentIssue; 725 | var currentTime = dayjs(res.body.timestamp); 726 | var endTime = dayjs(res.body.data.endTime); 727 | var residueSecond = endTime.diff(currentTime, 'second'); 728 | if (residueSecond > 15) { 729 | that.residueSecond = residueSecond - 15; 730 | that.bettingCountdown(); 731 | } else if (residueSecond > 0 && residueSecond <= 15) { 732 | that.residueSecond = residueSecond; 733 | that.lotteryCountdown(); 734 | } 735 | }); 736 | }, 737 | 738 | /** 739 | * 刷新最近5次的开奖期号数据 740 | */ 741 | refreshLatelyThe5TimeIssue : function() { 742 | this.$http.get('/issue/findLatelyThe5TimeIssue', { 743 | params : { 744 | gameCode : 'CQSSC' 745 | } 746 | }).then(function(res) { 747 | var latelyThe5TimeLotteryResults = []; 748 | for (var i = 0; i < res.body.data.length; i++) { 749 | var lotteryNum = res.body.data[i].lotteryNum; 750 | var lotteryResult = { 751 | issueNum : res.body.data[i].issueNum, 752 | lotteryNums : lotteryNum != null ? lotteryNum.split(",") : [] 753 | }; 754 | latelyThe5TimeLotteryResults.push(lotteryResult); 755 | } 756 | this.latelyThe5TimeLotteryResults = latelyThe5TimeLotteryResults; 757 | }); 758 | }, 759 | 760 | gotoBettingRecordPage : function() { 761 | window.location.href = '/betting-record'; 762 | } 763 | } 764 | }); -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/js/personal-center.js: -------------------------------------------------------------------------------- 1 | var personalCenter = new Vue({ 2 | el : '#personal-center', 3 | data : { 4 | currentTab : '', 5 | gameDictItems : [], 6 | 7 | /** 8 | * 邀请码tab相关参数start 9 | */ 10 | inviteRegisterFlag : false, 11 | inviteDetailsInfo : {}, 12 | 13 | /** 14 | * 银行卡资料管理tab相关参数start 15 | */ 16 | editBankInfoFlag : false, 17 | bankInfo : {}, 18 | openAccountBank : '', 19 | accountHolder : '', 20 | bankCardAccount : '', 21 | 22 | /** 23 | * 登录密码修改tab相关参数start 24 | */ 25 | oldLoginPwd : '', 26 | newLoginPwd : '', 27 | confirmLoginPwd : '', 28 | 29 | /** 30 | * 资金密码修改tab相关参数start 31 | */ 32 | oldMoneyPwd : '', 33 | newMoneyPwd : '', 34 | confirmMoneyPwd : '', 35 | 36 | /** 37 | * 个人账变start 38 | */ 39 | accountChangeGameCode : '', 40 | accountChangeStartTime : dayjs().format('YYYY-MM-DD'), 41 | accountChangeEndTime : dayjs().format('YYYY-MM-DD'), 42 | accountChangeTypeCode : '', 43 | accountChangeTypeDictItems : [], 44 | 45 | /** 46 | * 个人充提start 47 | */ 48 | rechargeWithdrawOrderType : '', 49 | rechargeWithdrawStartTime : dayjs().format('YYYY-MM-DD'), 50 | rechargeWithdrawEndTime : dayjs().format('YYYY-MM-DD'), 51 | rechargeWithdrawOrderTypeDictItems : [] 52 | }, 53 | computed : {}, 54 | created : function() { 55 | }, 56 | mounted : function() { 57 | this.loadInviteRegisterSetting(); 58 | this.switchAccountChangeTab(); 59 | }, 60 | methods : { 61 | 62 | loadInviteRegisterSetting : function() { 63 | var that = this; 64 | that.$http.get('/masterControl/getInviteRegisterSetting').then(function(res) { 65 | if (res.body.data != null) { 66 | that.inviteRegisterFlag = res.body.data.enabled; 67 | } 68 | }); 69 | }, 70 | 71 | /** 72 | * 邀请码tab相关方法start 73 | */ 74 | switchInviteCodeTab : function() { 75 | this.currentTab = 'inviteCode'; 76 | this.loadInvoteCodeInfo(); 77 | }, 78 | 79 | loadInvoteCodeInfo : function() { 80 | var that = this; 81 | that.$http.get('/userAccount/getInviteDetailsInfo').then(function(res) { 82 | if (res.body.data == null) { 83 | that.inviteDetailsInfo = {}; 84 | return; 85 | } 86 | that.inviteDetailsInfo = res.body.data; 87 | }); 88 | }, 89 | 90 | generateInviteCode : function() { 91 | var that = this; 92 | that.$http.get('/userAccount/generateInviteCode').then(function(res) { 93 | that.loadInvoteCodeInfo(); 94 | }); 95 | }, 96 | 97 | /** 98 | * 银行卡资料管理tab相关方法start 99 | */ 100 | switchBankCardInfoTab : function() { 101 | this.currentTab = 'bankCardInfo'; 102 | this.editBankInfoFlag = false; 103 | this.loadBankInfo(); 104 | }, 105 | 106 | loadBankInfo : function() { 107 | var that = this; 108 | that.$http.get('/userAccount/getBankInfo').then(function(res) { 109 | that.bankInfo = res.body.data; 110 | }); 111 | }, 112 | 113 | editBankInfo : function() { 114 | this.editBankInfoFlag = true; 115 | this.openAccountBank = this.bankInfo.openAccountBank; 116 | this.accountHolder = this.bankInfo.accountHolder; 117 | this.bankCardAccount = this.bankInfo.bankCardAccount; 118 | }, 119 | 120 | bindBankInfo : function() { 121 | var that = this; 122 | if (that.openAccountBank == null || that.openAccountBank == '') { 123 | layer.alert('请输入开户银行', { 124 | title : '提示', 125 | icon : 7, 126 | time : 3000 127 | }); 128 | return; 129 | } 130 | if (that.accountHolder == null || that.accountHolder == '') { 131 | layer.alert('请输入开户人姓名', { 132 | title : '提示', 133 | icon : 7, 134 | time : 3000 135 | }); 136 | return; 137 | } 138 | if (that.bankCardAccount == null || that.bankCardAccount == '') { 139 | layer.alert('请输入银行卡账号', { 140 | title : '提示', 141 | icon : 7, 142 | time : 3000 143 | }); 144 | return; 145 | } 146 | that.$http.post('/userAccount/bindBankInfo', { 147 | openAccountBank : that.openAccountBank, 148 | accountHolder : that.accountHolder, 149 | bankCardAccount : that.bankCardAccount 150 | }, { 151 | emulateJSON : true 152 | }).then(function(res) { 153 | layer.confirm('银行卡信息绑定成功!', { 154 | icon : 1, 155 | btn : [ '确定' ] 156 | }, function() { 157 | window.location.reload(); 158 | }); 159 | }); 160 | }, 161 | 162 | /** 163 | * 登录密码修改tab相关方法start 164 | */ 165 | switchLoginPwdModifyTab : function() { 166 | this.currentTab = 'loginPwdModify'; 167 | this.resetLoginPwdModifyTabData(); 168 | }, 169 | 170 | resetLoginPwdModifyTabData : function() { 171 | this.oldLoginPwd = ''; 172 | this.newLoginPwd = ''; 173 | this.confirmLoginPwd = ''; 174 | }, 175 | 176 | /** 177 | * 修改登录密码 178 | */ 179 | modifyLoginPwd : function() { 180 | var that = this; 181 | if (that.oldLoginPwd == null || that.oldLoginPwd == '') { 182 | layer.alert('请输入旧的登录密码', { 183 | title : '提示', 184 | icon : 7, 185 | time : 3000 186 | }); 187 | return; 188 | } 189 | if (that.newLoginPwd == null || that.newLoginPwd == '') { 190 | layer.alert('请输入新的登录密码', { 191 | title : '提示', 192 | icon : 7, 193 | time : 3000 194 | }); 195 | return; 196 | } 197 | if (that.confirmLoginPwd == null || that.confirmLoginPwd == '') { 198 | layer.alert('请输入确认登录密码', { 199 | title : '提示', 200 | icon : 7, 201 | time : 3000 202 | }); 203 | return; 204 | } 205 | if (that.newLoginPwd != that.confirmLoginPwd) { 206 | layer.alert('密码不一致', { 207 | title : '提示', 208 | icon : 7, 209 | time : 3000 210 | }); 211 | return; 212 | } 213 | that.$http.post('/userAccount/modifyLoginPwd', { 214 | oldLoginPwd : that.oldLoginPwd, 215 | newLoginPwd : that.newLoginPwd 216 | }, { 217 | emulateJSON : true 218 | }).then(function(res) { 219 | layer.confirm('登录密码修改成功!', { 220 | icon : 1, 221 | btn : [ '确定' ] 222 | }, function() { 223 | window.location.reload(); 224 | }); 225 | }); 226 | }, 227 | 228 | /** 229 | * 资金密码修改tab相关方法start 230 | */ 231 | switchMoneyPwdModifyTab : function() { 232 | this.currentTab = 'moneyPwdModify'; 233 | this.resetMoneyPwdModifyTabData(); 234 | }, 235 | 236 | resetMoneyPwdModifyTabData : function() { 237 | this.oldMoneyPwd = ''; 238 | this.newMoneyPwd = ''; 239 | this.confirmMoneyPwd = ''; 240 | }, 241 | 242 | /** 243 | * 修改资金密码 244 | */ 245 | modifyMoneyPwd : function() { 246 | var that = this; 247 | if (that.oldMoneyPwd == null || that.oldMoneyPwd == '') { 248 | layer.alert('请输入旧的资金密码', { 249 | title : '提示', 250 | icon : 7, 251 | time : 3000 252 | }); 253 | return; 254 | } 255 | if (that.newMoneyPwd == null || that.newMoneyPwd == '') { 256 | layer.alert('请输入新的资金密码', { 257 | title : '提示', 258 | icon : 7, 259 | time : 3000 260 | }); 261 | return; 262 | } 263 | if (that.confirmMoneyPwd == null || that.confirmMoneyPwd == '') { 264 | layer.alert('请输入确认资金密码', { 265 | title : '提示', 266 | icon : 7, 267 | time : 3000 268 | }); 269 | return; 270 | } 271 | if (that.newMoneyPwd != that.confirmMoneyPwd) { 272 | layer.alert('密码不一致', { 273 | title : '提示', 274 | icon : 7, 275 | time : 3000 276 | }); 277 | return; 278 | } 279 | that.$http.post('/userAccount/modifyMoneyPwd', { 280 | oldMoneyPwd : that.oldMoneyPwd, 281 | newMoneyPwd : that.newMoneyPwd 282 | }, { 283 | emulateJSON : true 284 | }).then(function(res) { 285 | layer.confirm('资金密码修改成功!', { 286 | icon : 1, 287 | btn : [ '确定' ] 288 | }, function() { 289 | window.location.reload(); 290 | }); 291 | }); 292 | }, 293 | 294 | /** 295 | * 个人账变相关方法start 296 | */ 297 | 298 | /** 299 | * 切换到个人帐变页面 300 | */ 301 | switchAccountChangeTab : function() { 302 | this.currentTab = 'accountChange'; 303 | this.resetAccountChangeQueryCond(); 304 | this.loadGameDictItem(); 305 | this.loadAccountChangeTypeDictItem(); 306 | this.initAccountChangeTable(); 307 | }, 308 | 309 | resetAccountChangeQueryCond : function() { 310 | this.accountChangeGameCode = ''; 311 | this.accountChangeStartTime = dayjs().format('YYYY-MM-DD'); 312 | this.accountChangeEndTime = dayjs().format('YYYY-MM-DD'); 313 | this.accountChangeTypeCode = ''; 314 | }, 315 | 316 | /** 317 | * 加载账变类型字典项 318 | */ 319 | loadAccountChangeTypeDictItem : function() { 320 | var that = this; 321 | that.$http.get('/dict/findDictItemInCache', { 322 | params : { 323 | dictTypeCode : 'accountChangeType' 324 | } 325 | }).then(function(res) { 326 | this.accountChangeTypeDictItems = res.body.data; 327 | }); 328 | }, 329 | 330 | /** 331 | * 初始化账变表格 332 | */ 333 | initAccountChangeTable : function() { 334 | var that = this; 335 | $('.account-change-table').bootstrapTable('destroy'); 336 | $('.account-change-table').bootstrapTable({ 337 | classes : 'table table-hover', 338 | height : 540, 339 | url : '/userAccount/findMyAccountChangeLogByPage', 340 | pagination : true, 341 | sidePagination : 'server', 342 | pageNumber : 1, 343 | pageSize : 10, 344 | pageList : [ 10, 25, 50, 100 ], 345 | queryParamsType : '', 346 | queryParams : function(params) { 347 | var condParam = { 348 | pageSize : params.pageSize, 349 | pageNum : params.pageNumber, 350 | gameCode : that.accountChangeGameCode, 351 | startTime : that.accountChangeStartTime, 352 | endTime : that.accountChangeEndTime, 353 | accountChangeTypeCode : that.accountChangeTypeCode 354 | }; 355 | return condParam; 356 | }, 357 | responseHandler : function(res) { 358 | return { 359 | total : res.data.total, 360 | rows : res.data.content 361 | }; 362 | }, 363 | columns : [ { 364 | field : 'userName', 365 | title : '用户名' 366 | }, { 367 | field : 'orderNo', 368 | title : '订单号' 369 | }, { 370 | field : 'gameName', 371 | title : '游戏' 372 | }, { 373 | field : 'issueNum', 374 | title : '期号' 375 | }, { 376 | field : 'accountChangeTime', 377 | title : '账变时间' 378 | }, { 379 | field : 'accountChangeTypeName', 380 | title : '类型' 381 | }, { 382 | field : 'accountChangeAmount', 383 | title : '账变金额' 384 | }, { 385 | field : 'balance', 386 | title : '余额' 387 | } ] 388 | }); 389 | }, 390 | 391 | refreshAccountChangeTable : function() { 392 | $('.account-change-table').bootstrapTable('refreshOptions', { 393 | pageNumber : 1 394 | }); 395 | }, 396 | 397 | /** 398 | * 个人充提相关方法start 399 | */ 400 | 401 | /** 402 | * 切换到个人帐变页面 403 | */ 404 | switchRechargeWithdrawTab : function() { 405 | this.currentTab = 'rechargeWithdraw'; 406 | this.resetRechargeWithdrawQueryCond(); 407 | this.loadRechargeWithdrawOrderTypeDictItem(); 408 | this.initRechargeWithdrawTable(); 409 | }, 410 | 411 | resetRechargeWithdrawQueryCond : function() { 412 | this.rechargeWithdrawOrderType = ''; 413 | this.rechargeWithdrawStartTime = dayjs().format('YYYY-MM-DD'); 414 | this.rechargeWithdrawEndTime = dayjs().format('YYYY-MM-DD'); 415 | }, 416 | 417 | /** 418 | * 加载充提订单类型字典项 419 | */ 420 | loadRechargeWithdrawOrderTypeDictItem : function() { 421 | var that = this; 422 | that.$http.get('/dict/findDictItemInCache', { 423 | params : { 424 | dictTypeCode : 'rechargeWithdrawLogOrderType' 425 | } 426 | }).then(function(res) { 427 | this.rechargeWithdrawOrderTypeDictItems = res.body.data; 428 | }); 429 | }, 430 | 431 | /** 432 | * 初始化充提表格 433 | */ 434 | initRechargeWithdrawTable : function() { 435 | var that = this; 436 | $('.recharge-withdraw-table').bootstrapTable('destroy'); 437 | $('.recharge-withdraw-table').bootstrapTable({ 438 | classes : 'table table-hover', 439 | height : 540, 440 | url : '/rechargeWithdrawLog/findMyRechargeWithdrawLogByPage', 441 | pagination : true, 442 | sidePagination : 'server', 443 | pageNumber : 1, 444 | pageSize : 10, 445 | pageList : [ 10, 25, 50, 100 ], 446 | queryParamsType : '', 447 | queryParams : function(params) { 448 | var condParam = { 449 | pageSize : params.pageSize, 450 | pageNum : params.pageNumber, 451 | orderType : that.rechargeWithdrawOrderType, 452 | startTime : that.rechargeWithdrawStartTime, 453 | endTime : that.rechargeWithdrawEndTime 454 | }; 455 | return condParam; 456 | }, 457 | responseHandler : function(res) { 458 | return { 459 | total : res.data.total, 460 | rows : res.data.content 461 | }; 462 | }, 463 | columns : [ { 464 | field : 'orderNo', 465 | title : '订单号' 466 | }, { 467 | field : 'orderTypeName', 468 | title : '订单类型' 469 | }, { 470 | field : 'orderStateName', 471 | title : '订单状态' 472 | }, { 473 | field : 'submitTime', 474 | title : '提交时间' 475 | } ] 476 | }); 477 | }, 478 | 479 | refreshRechargeWithdrawTable : function() { 480 | $('.recharge-withdraw-table').bootstrapTable('refreshOptions', { 481 | pageNumber : 1 482 | }); 483 | }, 484 | 485 | loadGameDictItem : function() { 486 | var that = this; 487 | that.$http.get('/dict/findDictItemInCache', { 488 | params : { 489 | dictTypeCode : 'game' 490 | } 491 | }).then(function(res) { 492 | this.gameDictItems = res.body.data; 493 | }); 494 | } 495 | } 496 | }); -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/static/plugins/combinatorics/combinatorics.js: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: combinatorics.js,v 0.25 2013/03/11 15:42:14 dankogai Exp dankogai $ 3 | * 4 | * Licensed under the MIT license. 5 | * http://www.opensource.org/licenses/mit-license.php 6 | * 7 | * References: 8 | * http://www.ruby-doc.org/core-2.0/Array.html#method-i-combination 9 | * http://www.ruby-doc.org/core-2.0/Array.html#method-i-permutation 10 | * http://en.wikipedia.org/wiki/Factorial_number_system 11 | */ 12 | (function (root, factory) { 13 | if (typeof define === 'function' && define.amd) { 14 | define([], factory); 15 | } else if (typeof exports === 'object') { 16 | module.exports = factory(); 17 | } else { 18 | root.Combinatorics = factory(); 19 | } 20 | }(this, function () { 21 | 'use strict'; 22 | var version = "0.5.4"; 23 | /* combinatory arithmetics */ 24 | var P = function(m, n) { 25 | if (n % 1 !== 0) throw new RangeError; 26 | var p = 1; 27 | while (n--) p *= m--; 28 | return p; 29 | }; 30 | var C = function(m, n) { 31 | if (n > m) { 32 | return 0; 33 | } 34 | return P(m, n) / P(n, n); 35 | }; 36 | var factorial = function(n) { 37 | return P(n, n); 38 | }; 39 | var factoradic = function(n, d) { 40 | var f = 1; 41 | if (!d) { 42 | for (d = 1; f < n; f *= ++d); 43 | if (f > n) f /= d--; 44 | } else { 45 | f = factorial(d); 46 | } 47 | var result = [0]; 48 | for (; d; f /= d--) { 49 | result[d] = Math.floor(n / f); 50 | n %= f; 51 | } 52 | return result; 53 | }; 54 | /* common methods */ 55 | var addProperties = function(dst, src) { 56 | Object.keys(src).forEach(function(p) { 57 | Object.defineProperty(dst, p, { 58 | value: src[p], 59 | configurable: p == 'next' 60 | }); 61 | }); 62 | }; 63 | var hideProperty = function(o, p) { 64 | Object.defineProperty(o, p, { 65 | writable: true 66 | }); 67 | }; 68 | var toArray = function(f) { 69 | var e, result = []; 70 | this.init(); 71 | while (e = this.next()) result.push(f ? f(e) : e); 72 | this.init(); 73 | return result; 74 | }; 75 | var common = { 76 | toArray: toArray, 77 | map: toArray, 78 | forEach: function(f) { 79 | var e; 80 | this.init(); 81 | while (e = this.next()) f(e); 82 | this.init(); 83 | }, 84 | filter: function(f) { 85 | var e, result = []; 86 | this.init(); 87 | while (e = this.next()) if (f(e)) result.push(e); 88 | this.init(); 89 | return result; 90 | }, 91 | find: function(f) { 92 | var e, result; 93 | this.init(); 94 | while (e = this.next()) { 95 | if (f(e)) { 96 | result = e; 97 | break; 98 | } 99 | } 100 | this.init(); 101 | return result; 102 | }, 103 | lazyMap: function(f) { 104 | this._lazyMap = f; 105 | return this; 106 | }, 107 | lazyFilter: function(f) { 108 | Object.defineProperty(this, 'next', { 109 | writable: true 110 | }); 111 | if (typeof f !== 'function') { 112 | this.next = this._next; 113 | } else { 114 | if (typeof (this._next) !== 'function') { 115 | this._next = this.next; 116 | } 117 | var _next = this._next.bind(this); 118 | this.next = (function() { 119 | var e; 120 | while (e = _next()) { 121 | if (f(e)) 122 | return e; 123 | } 124 | return e; 125 | }).bind(this); 126 | } 127 | Object.defineProperty(this, 'next', { 128 | writable: false 129 | }); 130 | return this; 131 | } 132 | 133 | }; 134 | /* power set */ 135 | var power = function(ary, fun) { 136 | var size = 1 << ary.length, 137 | sizeOf = function() { 138 | return size; 139 | }, 140 | that = Object.create(ary.slice(), { 141 | length: { 142 | get: sizeOf 143 | } 144 | }); 145 | hideProperty(that, 'index'); 146 | addProperties(that, { 147 | valueOf: sizeOf, 148 | init: function() { 149 | that.index = 0; 150 | }, 151 | nth: function(n) { 152 | if (n >= size) return; 153 | var i = 0, 154 | result = []; 155 | for (; n; n >>>= 1, i++) if (n & 1) result.push(this[i]); 156 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 157 | }, 158 | next: function() { 159 | return this.nth(this.index++); 160 | } 161 | }); 162 | addProperties(that, common); 163 | that.init(); 164 | return (typeof (fun) === 'function') ? that.map(fun) : that; 165 | }; 166 | /* combination */ 167 | var nextIndex = function(n) { 168 | var smallest = n & -n, 169 | ripple = n + smallest, 170 | new_smallest = ripple & -ripple, 171 | ones = ((new_smallest / smallest) >> 1) - 1; 172 | return ripple | ones; 173 | }; 174 | var combination = function(ary, nelem, fun) { 175 | if (!nelem) nelem = ary.length; 176 | if (nelem < 1) throw new RangeError; 177 | if (nelem > ary.length) throw new RangeError; 178 | var first = (1 << nelem) - 1, 179 | size = C(ary.length, nelem), 180 | maxIndex = 1 << ary.length, 181 | sizeOf = function() { 182 | return size; 183 | }, 184 | that = Object.create(ary.slice(), { 185 | length: { 186 | get: sizeOf 187 | } 188 | }); 189 | hideProperty(that, 'index'); 190 | addProperties(that, { 191 | valueOf: sizeOf, 192 | init: function() { 193 | this.index = first; 194 | }, 195 | next: function() { 196 | if (this.index >= maxIndex) return; 197 | var i = 0, 198 | n = this.index, 199 | result = []; 200 | for (; n; n >>>= 1, i++) { 201 | if (n & 1) result[result.length] = this[i]; 202 | } 203 | 204 | this.index = nextIndex(this.index); 205 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 206 | } 207 | }); 208 | addProperties(that, common); 209 | that.init(); 210 | return (typeof (fun) === 'function') ? that.map(fun) : that; 211 | }; 212 | /* bigcombination */ 213 | var bigNextIndex = function(n, nelem) { 214 | 215 | var result = n; 216 | var j = nelem; 217 | var i = 0; 218 | for (i = result.length - 1; i >= 0; i--) { 219 | if (result[i] == 1) { 220 | j--; 221 | } else { 222 | break; 223 | } 224 | } 225 | if (j == 0) { 226 | // Overflow 227 | result[result.length] = 1; 228 | for (var k = result.length - 2; k >= 0; k--) { 229 | result[k] = (k < nelem-1)?1:0; 230 | } 231 | } else { 232 | // Normal 233 | 234 | // first zero after 1 235 | var i1 = -1; 236 | var i0 = -1; 237 | for (var i = 0; i < result.length; i++) { 238 | if (result[i] == 0 && i1 != -1) { 239 | i0 = i; 240 | } 241 | if (result[i] == 1) { 242 | i1 = i; 243 | } 244 | if (i0 != -1 && i1 != -1) { 245 | result[i0] = 1; 246 | result[i1] = 0; 247 | break; 248 | } 249 | } 250 | 251 | j = nelem; 252 | for (var i = result.length - 1; i >= i1; i--) { 253 | if (result[i] == 1) 254 | j--; 255 | } 256 | for (var i = 0; i < i1; i++) { 257 | result[i] = (i < j)?1:0; 258 | } 259 | } 260 | 261 | return result; 262 | 263 | }; 264 | var buildFirst = function(nelem) { 265 | var result = []; 266 | for (var i = 0; i < nelem; i++) { 267 | result[i] = 1; 268 | } 269 | result[0] = 1; 270 | return result; 271 | }; 272 | var bigCombination = function(ary, nelem, fun) { 273 | if (!nelem) nelem = ary.length; 274 | if (nelem < 1) throw new RangeError; 275 | if (nelem > ary.length) throw new RangeError; 276 | var first = buildFirst(nelem), 277 | size = C(ary.length, nelem), 278 | maxIndex = ary.length, 279 | sizeOf = function() { 280 | return size; 281 | }, 282 | that = Object.create(ary.slice(), { 283 | length: { 284 | get: sizeOf 285 | } 286 | }); 287 | hideProperty(that, 'index'); 288 | addProperties(that, { 289 | valueOf: sizeOf, 290 | init: function() { 291 | this.index = first.concat(); 292 | }, 293 | next: function() { 294 | if (this.index.length > maxIndex) return; 295 | var i = 0, 296 | n = this.index, 297 | result = []; 298 | for (var j = 0; j < n.length; j++, i++) { 299 | if (n[j]) 300 | result[result.length] = this[i]; 301 | } 302 | bigNextIndex(this.index, nelem); 303 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 304 | } 305 | }); 306 | addProperties(that, common); 307 | that.init(); 308 | return (typeof (fun) === 'function') ? that.map(fun) : that; 309 | }; 310 | /* permutation */ 311 | var _permutation = function(ary) { 312 | var that = ary.slice(), 313 | size = factorial(that.length); 314 | that.index = 0; 315 | that.next = function() { 316 | if (this.index >= size) return; 317 | var copy = this.slice(), 318 | digits = factoradic(this.index, this.length), 319 | result = [], 320 | i = this.length - 1; 321 | for (; i >= 0; --i) result.push(copy.splice(digits[i], 1)[0]); 322 | this.index++; 323 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 324 | }; 325 | return that; 326 | }; 327 | // which is really a permutation of combination 328 | var permutation = function(ary, nelem, fun) { 329 | if (!nelem) nelem = ary.length; 330 | if (nelem < 1) throw new RangeError; 331 | if (nelem > ary.length) throw new RangeError; 332 | var size = P(ary.length, nelem), 333 | sizeOf = function() { 334 | return size; 335 | }, 336 | that = Object.create(ary.slice(), { 337 | length: { 338 | get: sizeOf 339 | } 340 | }); 341 | hideProperty(that, 'cmb'); 342 | hideProperty(that, 'per'); 343 | addProperties(that, { 344 | valueOf: function() { 345 | return size; 346 | }, 347 | init: function() { 348 | /* combination can only be used for less than 31 elements */ 349 | if (ary.length < 31) { 350 | this.cmb = combination(ary, nelem); 351 | } else { 352 | this.cmb = bigCombination(ary, nelem); 353 | } 354 | 355 | this.per = _permutation(this.cmb.next()); 356 | }, 357 | next: function() { 358 | var result = this.per.next(); 359 | if (!result) { 360 | var cmb = this.cmb.next(); 361 | if (!cmb) return; 362 | this.per = _permutation(cmb); 363 | return this.next(); 364 | } 365 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 366 | } 367 | }); 368 | addProperties(that, common); 369 | that.init(); 370 | return (typeof (fun) === 'function') ? that.map(fun) : that; 371 | }; 372 | 373 | var PC = function(m) { 374 | var total = 0; 375 | for (var n = 1; n <= m; n++) { 376 | var p = P(m,n); 377 | total += p; 378 | }; 379 | return total; 380 | }; 381 | // which is really a permutation of combination 382 | var permutationCombination = function(ary, fun) { 383 | // if (!nelem) nelem = ary.length; 384 | // if (nelem < 1) throw new RangeError; 385 | // if (nelem > ary.length) throw new RangeError; 386 | var size = PC(ary.length), 387 | sizeOf = function() { 388 | return size; 389 | }, 390 | that = Object.create(ary.slice(), { 391 | length: { 392 | get: sizeOf 393 | } 394 | }); 395 | hideProperty(that, 'cmb'); 396 | hideProperty(that, 'per'); 397 | hideProperty(that, 'nelem'); 398 | addProperties(that, { 399 | valueOf: function() { 400 | return size; 401 | }, 402 | init: function() { 403 | this.nelem = 1; 404 | // console.log("Starting nelem: " + this.nelem); 405 | this.cmb = combination(ary, this.nelem); 406 | this.per = _permutation(this.cmb.next()); 407 | }, 408 | next: function() { 409 | var result = this.per.next(); 410 | if (!result) { 411 | var cmb = this.cmb.next(); 412 | if (!cmb) { 413 | this.nelem++; 414 | // console.log("increment nelem: " + this.nelem + " vs " + ary.length); 415 | if (this.nelem > ary.length) return; 416 | this.cmb = combination(ary, this.nelem); 417 | cmb = this.cmb.next(); 418 | if (!cmb) return; 419 | } 420 | this.per = _permutation(cmb); 421 | return this.next(); 422 | } 423 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 424 | } 425 | }); 426 | addProperties(that, common); 427 | that.init(); 428 | return (typeof (fun) === 'function') ? that.map(fun) : that; 429 | }; 430 | /* Cartesian Product */ 431 | var arraySlice = Array.prototype.slice; 432 | var cartesianProduct = function() { 433 | if (!arguments.length) throw new RangeError; 434 | var args = arraySlice.call(arguments), 435 | size = args.reduce(function(p, a) { 436 | return p * a.length; 437 | }, 1), 438 | sizeOf = function() { 439 | return size; 440 | }, 441 | dim = args.length, 442 | that = Object.create(args, { 443 | length: { 444 | get: sizeOf 445 | } 446 | }); 447 | if (!size) throw new RangeError; 448 | hideProperty(that, 'index'); 449 | addProperties(that, { 450 | valueOf: sizeOf, 451 | dim: dim, 452 | init: function() { 453 | this.index = 0; 454 | }, 455 | get: function() { 456 | if (arguments.length !== this.length) return; 457 | var result = [], 458 | d = 0; 459 | for (; d < dim; d++) { 460 | var i = arguments[d]; 461 | if (i >= this[d].length) return; 462 | result.push(this[d][i]); 463 | } 464 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 465 | }, 466 | nth: function(n) { 467 | var result = [], 468 | d = 0; 469 | for (; d < dim; d++) { 470 | var l = this[d].length; 471 | var i = n % l; 472 | result.push(this[d][i]); 473 | n -= i; 474 | n /= l; 475 | } 476 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 477 | }, 478 | next: function() { 479 | if (this.index >= size) return; 480 | var result = this.nth(this.index); 481 | this.index++; 482 | return result; 483 | } 484 | }); 485 | addProperties(that, common); 486 | that.init(); 487 | return that; 488 | }; 489 | /* baseN */ 490 | var baseN = function(ary, nelem, fun) { 491 | if (!nelem) nelem = ary.length; 492 | if (nelem < 1) throw new RangeError; 493 | var base = ary.length, 494 | size = Math.pow(base, nelem); 495 | var sizeOf = function() { 496 | return size; 497 | }, 498 | that = Object.create(ary.slice(), { 499 | length: { 500 | get: sizeOf 501 | } 502 | }); 503 | hideProperty(that, 'index'); 504 | addProperties(that, { 505 | valueOf: sizeOf, 506 | init: function() { 507 | that.index = 0; 508 | }, 509 | nth: function(n) { 510 | if (n >= size) return; 511 | var result = []; 512 | for (var i = 0; i < nelem; i++) { 513 | var d = n % base; 514 | result.push(ary[d]) 515 | n -= d; n /= base 516 | } 517 | return (typeof (that._lazyMap) === 'function')?that._lazyMap(result):result; 518 | }, 519 | next: function() { 520 | return this.nth(this.index++); 521 | } 522 | }); 523 | addProperties(that, common); 524 | that.init(); 525 | return (typeof (fun) === 'function') ? that.map(fun) : that; 526 | }; 527 | 528 | /* export */ 529 | var Combinatorics = Object.create(null); 530 | addProperties(Combinatorics, { 531 | C: C, 532 | P: P, 533 | factorial: factorial, 534 | factoradic: factoradic, 535 | cartesianProduct: cartesianProduct, 536 | combination: combination, 537 | bigCombination: bigCombination, 538 | permutation: permutation, 539 | permutationCombination: permutationCombination, 540 | power: power, 541 | baseN: baseN, 542 | VERSION: version 543 | }); 544 | return Combinatorics; 545 | })); 546 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/templates/common/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 30 | 31 | 32 | 37 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /lottery-mobile/src/main/resources/templates/common/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 19 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /lottery-task/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | me.zohar 8 | lottery 9 | 0.0.1-SNAPSHOT 10 | 11 | lottery-task 12 | lottery-task 13 | jar 14 | 15 | UTF-8 16 | 17 | 18 | 19 | me.zohar 20 | lottery-api 21 | 0.0.1-SNAPSHOT 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter 26 | 27 | 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-maven-plugin 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/TaskApplication.java: -------------------------------------------------------------------------------- 1 | package me.zohar; 2 | 3 | import java.util.Date; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.ApplicationArguments; 7 | import org.springframework.boot.ApplicationRunner; 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | 11 | import cn.hutool.core.date.DateField; 12 | import cn.hutool.core.date.DateUtil; 13 | import me.zohar.lottery.issue.service.IssueService; 14 | 15 | @SpringBootApplication 16 | public class TaskApplication implements ApplicationRunner { 17 | 18 | @Autowired 19 | private IssueService issueService; 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(TaskApplication.class, args); 23 | } 24 | 25 | @Override 26 | public void run(ApplicationArguments args) throws Exception { 27 | issueService.generateIssue(DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, 0)); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/RedisMessageListener.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery; 2 | 3 | import java.text.MessageFormat; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import javax.annotation.PostConstruct; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.data.redis.core.StringRedisTemplate; 10 | import org.springframework.stereotype.Component; 11 | 12 | import cn.hutool.core.util.StrUtil; 13 | import lombok.extern.slf4j.Slf4j; 14 | import me.zohar.lottery.betting.service.BettingService; 15 | import me.zohar.lottery.common.utils.ThreadPoolUtils; 16 | import me.zohar.lottery.constants.Constant; 17 | import me.zohar.lottery.issue.service.IssueService; 18 | import me.zohar.lottery.rechargewithdraw.service.RechargeService; 19 | 20 | @Slf4j 21 | @Component 22 | public class RedisMessageListener { 23 | 24 | @Autowired 25 | private StringRedisTemplate redisTemplate; 26 | 27 | @Autowired 28 | private IssueService issueService; 29 | 30 | @Autowired 31 | private RechargeService rechargeService; 32 | 33 | @Autowired 34 | private BettingService bettingService; 35 | 36 | @PostConstruct 37 | public void init() { 38 | listenLotterySettlement(); 39 | listenBettingRebateSettlement(); 40 | listenRechargeSettlement(); 41 | } 42 | 43 | public void listenBettingRebateSettlement() { 44 | new Thread(() -> { 45 | while (true) { 46 | try { 47 | String issueId = redisTemplate.opsForList().rightPop(Constant.返点结算期号ID, 2L, TimeUnit.SECONDS); 48 | if (StrUtil.isBlank(issueId)) { 49 | continue; 50 | } 51 | 52 | ThreadPoolUtils.getLotterySettlementPool().execute(() -> { 53 | try { 54 | log.info("系统通知该期进行返点结算,id为{}", issueId); 55 | bettingService.noticeIssueRebateSettlement(issueId); 56 | } catch (Exception e) { 57 | log.error(MessageFormat.format("系统通知该期进行返点结算出现异常,id为{0}", issueId), e); 58 | throw new RuntimeException(); 59 | } 60 | }); 61 | } catch (Exception e) { 62 | log.error("系统通知该期进行返点结算消息队列异常", e); 63 | } 64 | } 65 | }).start(); 66 | 67 | new Thread(() -> { 68 | while (true) { 69 | try { 70 | String bettingRebateId = redisTemplate.opsForList().rightPop(Constant.投注返点ID, 2L, TimeUnit.SECONDS); 71 | if (StrUtil.isBlank(bettingRebateId)) { 72 | continue; 73 | } 74 | 75 | ThreadPoolUtils.getLotterySettlementPool().execute(() -> { 76 | try { 77 | log.info("系统进行投注返点结算操作,id为{}", bettingRebateId); 78 | bettingService.bettingRebateSettlement(bettingRebateId); 79 | } catch (Exception e) { 80 | log.error(MessageFormat.format("系统进行投注返点结算操作出现异常,id为{0}", bettingRebateId), e); 81 | throw new RuntimeException(); 82 | } 83 | }); 84 | } catch (Exception e) { 85 | log.error("投注返点结算消息队列异常", e); 86 | } 87 | } 88 | }).start(); 89 | } 90 | 91 | public void listenLotterySettlement() { 92 | new Thread(() -> { 93 | while (true) { 94 | try { 95 | String issueId = redisTemplate.opsForList().rightPop(Constant.当前开奖期号ID, 2L, TimeUnit.SECONDS); 96 | if (StrUtil.isBlank(issueId)) { 97 | continue; 98 | } 99 | 100 | ThreadPoolUtils.getLotterySettlementPool().execute(() -> { 101 | try { 102 | log.info("系统进行开奖结算操作,期号id为{}", issueId); 103 | issueService.settlement(issueId); 104 | } catch (Exception e) { 105 | log.error(MessageFormat.format("系统进行开奖结算操作出现异常,期号id为{0}", issueId), e); 106 | throw new RuntimeException(); 107 | } 108 | }); 109 | } catch (Exception e) { 110 | log.error("开奖结算消息队列异常", e); 111 | } 112 | } 113 | }).start(); 114 | } 115 | 116 | public void listenRechargeSettlement() { 117 | new Thread(() -> { 118 | while (true) { 119 | try { 120 | String orderNo = redisTemplate.opsForList().rightPop(Constant.充值订单_已支付订单单号, 2L, TimeUnit.SECONDS); 121 | if (StrUtil.isBlank(orderNo)) { 122 | continue; 123 | } 124 | 125 | ThreadPoolUtils.getRechargeSettlementPool().execute(() -> { 126 | try { 127 | log.info("系统进行充值结算操作,订单单号为{}", orderNo); 128 | rechargeService.rechargeOrderSettlement(orderNo); 129 | } catch (Exception e) { 130 | log.error(MessageFormat.format("系统进行充值结算操作出现异常,订单单号为{0}", orderNo), e); 131 | throw new RuntimeException(); 132 | } 133 | }); 134 | } catch (Exception e) { 135 | log.error("充值结算消息队列异常", e); 136 | } 137 | } 138 | }).start(); 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/betting/task/BettingRebateAutoSettlementTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.betting.task; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import lombok.extern.slf4j.Slf4j; 8 | import me.zohar.lottery.betting.service.BettingService; 9 | 10 | @Component 11 | @Slf4j 12 | public class BettingRebateAutoSettlementTask { 13 | 14 | @Autowired 15 | private BettingService bettingService; 16 | 17 | @Scheduled(fixedRate = 90000) 18 | public void execute() { 19 | try { 20 | log.info("投注返点自动结算定时任务start"); 21 | bettingService.bettingRebateAutoSettlement(); 22 | log.info("投注返点自动结算定时任务end"); 23 | } catch (Exception e) { 24 | log.error("投注返点自动结算定时任务", e); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/config/mq/XxlMqConf.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.mq; 2 | 3 | import com.xxl.mq.client.factory.impl.XxlMqSpringClientFactory; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class XxlMqConf { 10 | 11 | @Value("${xxl.mq.admin.address}") 12 | private String adminAddress; 13 | @Value("${xxl.mq.accessToken}") 14 | private String accessToken; 15 | 16 | 17 | @Bean 18 | public XxlMqSpringClientFactory getXxlMqConsumer(){ 19 | XxlMqSpringClientFactory xxlMqSpringClientFactory = new XxlMqSpringClientFactory(); 20 | xxlMqSpringClientFactory.setAdminAddress(adminAddress); 21 | xxlMqSpringClientFactory.setAccessToken(accessToken); 22 | return xxlMqSpringClientFactory; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/config/schedule/ScheduleConfig.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.config.schedule; 2 | 3 | import java.util.concurrent.Executors; 4 | 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | import org.springframework.scheduling.annotation.SchedulingConfigurer; 8 | import org.springframework.scheduling.config.ScheduledTaskRegistrar; 9 | 10 | @EnableScheduling 11 | @Configuration 12 | public class ScheduleConfig implements SchedulingConfigurer { 13 | 14 | @Override 15 | public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { 16 | taskRegistrar.setScheduler(Executors.newScheduledThreadPool(5)); 17 | } 18 | } -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/information/task/SyncLotteryInformationTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.information.task; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import lombok.extern.slf4j.Slf4j; 8 | import me.zohar.lottery.information.service.LotteryInformationService; 9 | 10 | @Component 11 | @Slf4j 12 | public class SyncLotteryInformationTask { 13 | 14 | @Autowired 15 | private LotteryInformationService lotteryInformationService; 16 | 17 | @Scheduled(cron = "0 0 10,20 * * ?") 18 | public void execute() { 19 | try { 20 | log.info("执行同步彩票资讯任务start"); 21 | lotteryInformationService.autoSyncInformation(); 22 | log.info("执行同步彩票资讯任务end"); 23 | } catch (Exception e) { 24 | log.error("执行同步彩票资讯任务发生异常", e); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/GenerateIssueTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Date; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.scheduling.annotation.Scheduled; 7 | import org.springframework.stereotype.Component; 8 | 9 | import cn.hutool.core.date.DateField; 10 | import cn.hutool.core.date.DateUtil; 11 | import lombok.extern.slf4j.Slf4j; 12 | import me.zohar.lottery.issue.service.IssueService; 13 | 14 | @Component 15 | @Slf4j 16 | public class GenerateIssueTask { 17 | 18 | @Autowired 19 | private IssueService issueService; 20 | 21 | /** 22 | * 每天零点10分执行一次 23 | */ 24 | @Scheduled(cron = "0 10 0 * * ?") 25 | public void execute() { 26 | try { 27 | log.info("执行生成期号数据定时任务start"); 28 | issueService.generateIssue(DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, 0)); 29 | log.info("执行生成期号数据定时任务end"); 30 | } catch (Exception e) { 31 | log.error("执行生成期号数据定时任务发生异常", e); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncCqsscLotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.CqsscService; 23 | import me.zohar.lottery.issue.service.IssueService; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncCqsscLotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncCqsscLotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_CQSSC"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private CqsscService cqsscService; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步重庆时时彩开奖号码定时任务start"); 53 | cqsscService.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步重庆时时彩开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步重庆时时彩开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncGd11x5LotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.Gd11x5Service; 23 | import me.zohar.lottery.issue.service.IssueService; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncGd11x5LotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncGd11x5LotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_GD11X5"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private Gd11x5Service gd11x5Service; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步广东11选5开奖号码定时任务start"); 53 | gd11x5Service.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步广东11选5开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步广东11选5开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncJs11x5LotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.Js11x5Service; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncJs11x5LotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncJs11x5LotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_JS11X5"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private Js11x5Service js11x5Service; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步江苏11选5开奖号码定时任务start"); 53 | js11x5Service.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步江苏11选5开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步江苏11选5开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncJx11x5LotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.Jx11x5Service; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncJx11x5LotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncJx11x5LotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_JX11X5"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private Jx11x5Service jx11x5Service; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步江西11选5开奖号码定时任务start"); 53 | jx11x5Service.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步江西11选5开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步江西11选5开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncSh11x5LotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.Sh11x5Service; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncSh11x5LotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncSh11x5LotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_SH11X5"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private Sh11x5Service sh11x5Service; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步上海11选5开奖号码定时任务start"); 53 | sh11x5Service.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步上海11选5开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步上海11选5开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncTjsscLotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.TjsscService; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncTjsscLotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncTjsscLotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_TJSSC"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private TjsscService tjsscService; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步天津时时彩开奖号码定时任务start"); 53 | tjsscService.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步天津时时彩开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步天津时时彩开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncXjsscLotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.XjsscService; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncXjsscLotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncXjsscLotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_XJSSC"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private XjsscService xjsscService; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步新疆时时彩开奖号码定时任务start"); 53 | xjsscService.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步新疆时时彩开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步新疆时时彩开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncYnsscLotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.YnsscService; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncYnsscLotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncYnsscLotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_YNSSC"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private YnsscService ynsscService; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步云南时时彩开奖号码定时任务start"); 53 | ynsscService.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步云南时时彩开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步云南时时彩开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/issue/task/SyncZj11x5LotteryNumTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.issue.task; 2 | 3 | import java.util.Arrays; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.xxl.mq.client.consumer.IMqConsumer; 12 | import com.xxl.mq.client.consumer.MqResult; 13 | import com.xxl.mq.client.consumer.annotation.MqConsumer; 14 | import com.xxl.mq.client.message.XxlMqMessage; 15 | import com.xxl.mq.client.producer.XxlMqProducer; 16 | 17 | import cn.hutool.core.date.DateField; 18 | import cn.hutool.core.date.DateUtil; 19 | import lombok.extern.slf4j.Slf4j; 20 | import me.zohar.lottery.constants.Constant; 21 | import me.zohar.lottery.issue.param.SyncLotteryNumMsg; 22 | import me.zohar.lottery.issue.service.IssueService; 23 | import me.zohar.lottery.issue.service.Zj11x5Service; 24 | import me.zohar.lottery.issue.vo.IssueVO; 25 | 26 | @MqConsumer(topic = SyncZj11x5LotteryNumTask.TOPIC) 27 | @Component 28 | @Slf4j 29 | public class SyncZj11x5LotteryNumTask implements IMqConsumer { 30 | 31 | public static final String TOPIC = "SYNC_LOTTERY_NUM_ZJ11X5"; 32 | 33 | private static final List RETRY_LEVEL = Arrays.asList(65, 25, 18, 18, 16, 16, 14, 14, 10, 10, 25, 25, 18, 34 | 18); 35 | 36 | @Autowired 37 | private Zj11x5Service zj11x5Service; 38 | 39 | @Autowired 40 | private IssueService issueService; 41 | 42 | @Override 43 | public MqResult consume(String data) throws Exception { 44 | SyncLotteryNumMsg msg = JSON.parseObject(data, SyncLotteryNumMsg.class); 45 | IssueVO latelyIssue = issueService.getLatelyIssue(msg.getGameCode()); 46 | if (msg.getIssueNum().compareTo(latelyIssue.getIssueNum()) != 0) { 47 | return MqResult.SUCCESS; 48 | } 49 | 50 | Boolean syncSuccessFlag = false; 51 | try { 52 | log.info("执行同步浙江11选5开奖号码定时任务start"); 53 | zj11x5Service.syncLotteryNum(); 54 | IssueVO issue = issueService.findByGameCodeAndIssueNum(msg.getGameCode(), msg.getIssueNum()); 55 | syncSuccessFlag = !Constant.期号状态_未开奖.equals(issue.getState()); 56 | log.info("执行同步浙江11选5开奖号码定时任务end"); 57 | } catch (Exception e) { 58 | log.error("执行同步浙江11选5开奖号码定时任务发生异常", e); 59 | } 60 | if (!syncSuccessFlag) { 61 | if (msg.getRetries() < RETRY_LEVEL.size() - 1) { 62 | Date effectTime = DateUtil.offset(new Date(), DateField.SECOND, RETRY_LEVEL.get(msg.getRetries())); 63 | msg.setRetries(msg.getRetries() + 1); 64 | XxlMqProducer.produce(new XxlMqMessage(TOPIC, JSON.toJSONString(msg), effectTime)); 65 | } 66 | } 67 | return MqResult.SUCCESS; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/rechargewithdraw/task/RechargeOrderAutoSettlementTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.rechargewithdraw.task; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import lombok.extern.slf4j.Slf4j; 8 | import me.zohar.lottery.rechargewithdraw.service.RechargeService; 9 | 10 | /** 11 | * 充值订单自动结算定时任务 12 | * 13 | * @author zohar 14 | * @date 2019年1月21日 15 | * 16 | */ 17 | @Component 18 | @Slf4j 19 | public class RechargeOrderAutoSettlementTask { 20 | 21 | @Autowired 22 | private RechargeService rechargeService; 23 | 24 | @Scheduled(fixedRate = 60000) 25 | public void execute() { 26 | try { 27 | log.info("充值订单自动结算定时任务start"); 28 | rechargeService.rechargeOrderAutoSettlement(); 29 | log.info("充值订单自动结算定时任务end"); 30 | } catch (Exception e) { 31 | log.error("充值订单自动结算定时任务", e); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /lottery-task/src/main/java/me/zohar/lottery/rechargewithdraw/task/RechargeOrderTimeoutDealTask.java: -------------------------------------------------------------------------------- 1 | package me.zohar.lottery.rechargewithdraw.task; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import lombok.extern.slf4j.Slf4j; 8 | import me.zohar.lottery.rechargewithdraw.service.RechargeService; 9 | 10 | /** 11 | * 充值订单超时处理定时任务 12 | * 13 | * @author zohar 14 | * @date 2019年1月21日 15 | * 16 | */ 17 | @Component 18 | @Slf4j 19 | public class RechargeOrderTimeoutDealTask { 20 | 21 | @Autowired 22 | private RechargeService rechargeService; 23 | 24 | @Scheduled(fixedRate = 60000) 25 | public void execute() { 26 | try { 27 | log.info("充值订单超时处理定时任务start"); 28 | rechargeService.orderTimeoutDeal(); 29 | log.info("充值订单超时处理定时任务end"); 30 | } catch (Exception e) { 31 | log.error("充值订单超时处理定时任务", e); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /lottery-task/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | datasource: 5 | url: jdbc:mysql://127.0.0.1:3306/lottery?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai 6 | username: root 7 | password: 123456 8 | driverClassName: com.mysql.jdbc.Driver 9 | jpa: 10 | show-sql: true 11 | generate-ddl: true 12 | hibernate: 13 | ddl-auto: none 14 | thymeleaf: 15 | cache: false 16 | redis: 17 | port: 6379 18 | host: localhost 19 | xxl: 20 | mq: 21 | admin: 22 | address: http://localhost:8088/xxl-mq-admin 23 | accessToken: null -------------------------------------------------------------------------------- /lottery-task/target/classes/META-INF/maven/me.zohar/lottery-task/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon Dec 20 10:10:13 CST 2021 3 | version=0.0.1-SNAPSHOT 4 | groupId=me.zohar 5 | m2e.projectName=lottery-task 6 | m2e.projectLocation=D\:\\workspace\\lottery\\lottery-task 7 | artifactId=lottery-task 8 | -------------------------------------------------------------------------------- /lottery-task/target/classes/META-INF/maven/me.zohar/lottery-task/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | me.zohar 8 | lottery 9 | 0.0.1-SNAPSHOT 10 | 11 | lottery-task 12 | lottery-task 13 | jar 14 | 15 | UTF-8 16 | 17 | 18 | 19 | me.zohar 20 | lottery-api 21 | 0.0.1-SNAPSHOT 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter 26 | 27 | 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-maven-plugin 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /lottery-task/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | datasource: 5 | url: jdbc:mysql://127.0.0.1:3306/lottery?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai 6 | username: root 7 | password: 123456 8 | driverClassName: com.mysql.jdbc.Driver 9 | jpa: 10 | show-sql: true 11 | generate-ddl: true 12 | hibernate: 13 | ddl-auto: none 14 | thymeleaf: 15 | cache: false 16 | redis: 17 | port: 6379 18 | host: localhost 19 | xxl: 20 | mq: 21 | admin: 22 | address: http://localhost:8088/xxl-mq-admin 23 | accessToken: null -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/TaskApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/TaskApplication.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/RedisMessageListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/RedisMessageListener.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/betting/task/BettingRebateAutoSettlementTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/betting/task/BettingRebateAutoSettlementTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/config/mq/XxlMqConf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/config/mq/XxlMqConf.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/config/schedule/ScheduleConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/config/schedule/ScheduleConfig.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/information/task/SyncLotteryInformationTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/information/task/SyncLotteryInformationTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/GenerateIssueTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/GenerateIssueTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncCqsscLotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncCqsscLotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncGd11x5LotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncGd11x5LotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncJs11x5LotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncJs11x5LotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncJx11x5LotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncJx11x5LotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncSh11x5LotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncSh11x5LotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncTjsscLotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncTjsscLotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncXjsscLotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncXjsscLotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncYnsscLotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncYnsscLotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/issue/task/SyncZj11x5LotteryNumTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/issue/task/SyncZj11x5LotteryNumTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/rechargewithdraw/task/RechargeOrderAutoSettlementTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/rechargewithdraw/task/RechargeOrderAutoSettlementTask.class -------------------------------------------------------------------------------- /lottery-task/target/classes/me/zohar/lottery/rechargewithdraw/task/RechargeOrderTimeoutDealTask.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/lottery-task/target/classes/me/zohar/lottery/rechargewithdraw/task/RechargeOrderTimeoutDealTask.class -------------------------------------------------------------------------------- /lottery-web/test: -------------------------------------------------------------------------------- 1 | 111 2 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | me.zohar 6 | lottery 7 | 0.0.1-SNAPSHOT 8 | pom 9 | 10 | 1.8 11 | 1.8 12 | UTF-8 13 | UTF-8 14 | 2.1.1.RELEASE 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-parent 19 | 2.1.1.RELEASE 20 | 21 | 22 | 23 | 24 | lottery-api 25 | lottery-task 26 | lottery-web 27 | lottery-mobile 28 | lottery-admin 29 | 30 | 31 | -------------------------------------------------------------------------------- /彩种图标大全.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/彩种图标大全.png -------------------------------------------------------------------------------- /截图/下级开户.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/下级开户.png -------------------------------------------------------------------------------- /截图/下级账号管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/下级账号管理.png -------------------------------------------------------------------------------- /截图/充值.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/充值.png -------------------------------------------------------------------------------- /截图/团队充值明细.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/团队充值明细.png -------------------------------------------------------------------------------- /截图/团队帐变报表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/团队帐变报表.png -------------------------------------------------------------------------------- /截图/投注.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/投注.png -------------------------------------------------------------------------------- /截图/投注订单详情.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/投注订单详情.png -------------------------------------------------------------------------------- /截图/投注记录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/投注记录.png -------------------------------------------------------------------------------- /截图/提现.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/提现.png -------------------------------------------------------------------------------- /截图/撤单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/撤单.png -------------------------------------------------------------------------------- /截图/购彩大厅.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/购彩大厅.png -------------------------------------------------------------------------------- /截图/追号.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/追号.png -------------------------------------------------------------------------------- /截图/追号记录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/追号记录.png -------------------------------------------------------------------------------- /截图/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/截图/首页.png -------------------------------------------------------------------------------- /盛大彩票网站-彩票,时时彩,博彩网站.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nichengge/lottery/ca1837a1a55481146a86f321441f2e6f7cdd2b83/盛大彩票网站-彩票,时时彩,博彩网站.rar -------------------------------------------------------------------------------- /视图/每日盈亏.txt: -------------------------------------------------------------------------------- 1 | create view v_everyday_profit_and_loss as 2 | SELECT 3 | concat( `t`.`user_account_id`, '_', CONVERT ( `t`.`everyday` USING utf8 ) ) AS `id`, 4 | `lottery`.`user_account`.`id` AS `user_account_id`, 5 | `lottery`.`user_account`.`user_name` AS `user_name`, 6 | `lottery`.`user_account`.`account_type` AS `account_type`, 7 | `lottery`.`user_account`.`account_level` AS `account_level`, 8 | `lottery`.`user_account`.`account_level_path` AS `account_level_path`, 9 | `lottery`.`user_account`.`balance` AS `balance`, 10 | `t`.`everyday` AS `everyday`, 11 | `t`.`recharge_amount` AS `recharge_amount`, 12 | `t`.`withdraw_amount` AS `withdraw_amount`, 13 | `t`.`total_betting_amount` AS `total_betting_amount`, 14 | `t`.`total_winning_amount` AS `total_winning_amount`, 15 | `t`.`rebate_amount` AS `rebate_amount`, 16 | `t`.`lower_level_rebate_amount` AS `lower_level_rebate_amount`, 17 | `t`.`betting_profit_and_loss` AS `betting_profit_and_loss` 18 | FROM 19 | ( 20 | ( 21 | ( 22 | SELECT 23 | concat( `t`.`user_account_id`, '_', CONVERT ( `t`.`everyday` USING utf8 ) ) AS `id`, 24 | `t`.`user_account_id` AS `user_account_id`, 25 | str_to_date( `t`.`everyday`, '%Y-%m-%d' ) AS `everyday`, 26 | sum( `t`.`recharge_amount` ) AS `recharge_amount`, 27 | sum( `t`.`withdraw_amount` ) AS `withdraw_amount`, 28 | sum( `t`.`total_betting_amount` ) AS `total_betting_amount`, 29 | sum( `t`.`total_winning_amount` ) AS `total_winning_amount`, 30 | sum( `t`.`rebate_amount` ) AS `rebate_amount`, 31 | sum( `t`.`lower_level_rebate_amount` ) AS `lower_level_rebate_amount`, 32 | sum( ( ( `t`.`total_winning_amount` - `t`.`total_betting_amount` ) + `t`.`rebate_amount` ) ) AS `betting_profit_and_loss` 33 | FROM 34 | ( 35 | SELECT 36 | `lottery`.`recharge_order`.`user_account_id` AS `user_account_id`, 37 | date_format( `lottery`.`recharge_order`.`submit_time`, '%Y-%m-%d' ) AS `everyday`, 38 | sum( `lottery`.`recharge_order`.`recharge_amount` ) AS `recharge_amount`, 39 | 0 AS `withdraw_amount`, 40 | 0 AS `total_betting_amount`, 41 | 0 AS `total_winning_amount`, 42 | 0 AS `rebate_amount`, 43 | 0 AS `lower_level_rebate_amount` 44 | FROM 45 | `lottery`.`recharge_order` 46 | WHERE 47 | ( `lottery`.`recharge_order`.`order_state` IN ( '2', '3' ) ) 48 | GROUP BY 49 | `lottery`.`recharge_order`.`user_account_id`, 50 | date_format( `lottery`.`recharge_order`.`submit_time`, '%Y-%m-%d' ) UNION ALL 51 | SELECT 52 | `lottery`.`withdraw_record`.`user_account_id` AS `user_account_id`, 53 | date_format( `lottery`.`withdraw_record`.`submit_time`, '%Y-%m-%d' ) AS `everyday`, 54 | 0 AS `recharge_amount`, 55 | sum( `lottery`.`withdraw_record`.`withdraw_amount` ) AS `withdraw_amount`, 56 | 0 AS `total_betting_amount`, 57 | 0 AS `total_winning_amount`, 58 | 0 AS `rebate_amount`, 59 | 0 AS `lower_level_rebate_amount` 60 | FROM 61 | `lottery`.`withdraw_record` 62 | WHERE 63 | ( `lottery`.`withdraw_record`.`state` IN ( '1', '2', '4' ) ) 64 | GROUP BY 65 | `lottery`.`withdraw_record`.`user_account_id`, 66 | date_format( `lottery`.`withdraw_record`.`submit_time`, '%Y-%m-%d' ) UNION ALL 67 | SELECT 68 | `lottery`.`betting_order`.`user_account_id` AS `user_account_id`, 69 | date_format( `lottery`.`betting_order`.`betting_time`, '%Y-%m-%d' ) AS `everyday`, 70 | 0 AS `recharge_amount`, 71 | 0 AS `withdraw_amount`, 72 | sum( 73 | ( 74 | CASE 75 | 76 | WHEN ( `lottery`.`betting_order`.`state` IN ( '1', '2', '3' ) ) THEN 77 | `lottery`.`betting_order`.`total_betting_amount` ELSE 0 78 | END 79 | ) 80 | ) AS `total_betting_amount`, 81 | sum( ( CASE WHEN ( `lottery`.`betting_order`.`state` = '3' ) THEN `lottery`.`betting_order`.`total_winning_amount` ELSE 0 END ) ) AS `total_winning_amount`, 82 | sum( 83 | ( 84 | CASE 85 | 86 | WHEN ( `lottery`.`betting_order`.`state` IN ( '1', '2', '3' ) ) THEN 87 | `lottery`.`betting_order`.`rebate_amount` ELSE 0 88 | END 89 | ) 90 | ) AS `rebate_amount`, 91 | 0 AS `lower_level_rebate_amount` 92 | FROM 93 | `lottery`.`betting_order` 94 | GROUP BY 95 | `lottery`.`betting_order`.`user_account_id`, 96 | date_format( `lottery`.`betting_order`.`betting_time`, '%Y-%m-%d' ) UNION ALL 97 | SELECT 98 | `lottery`.`betting_rebate`.`rebate_account_id` AS `user_account_id`, 99 | date_format( `lottery`.`betting_rebate`.`create_time`, '%Y-%m-%d' ) AS `DATE_FORMAT(betting_rebate.create_time,'%Y-%m-%d')`, 100 | 0 AS `recharge_amount`, 101 | 0 AS `withdraw_amount`, 102 | 0 AS `total_betting_amount`, 103 | 0 AS `total_winning_amount`, 104 | 0 AS `rebate_amount`, 105 | sum( 106 | ( CASE WHEN ( `lottery`.`betting_rebate`.`rebate_account_id` <> `lottery`.`betting_order`.`user_account_id` ) THEN `lottery`.`betting_rebate`.`rebate_amount` ELSE 0 END ) 107 | ) AS `lower_level_rebate_amount` 108 | FROM 109 | ( `lottery`.`betting_rebate` LEFT JOIN `lottery`.`betting_order` ON ( ( `lottery`.`betting_rebate`.`betting_order_id` = `lottery`.`betting_order`.`id` ) ) ) 110 | GROUP BY 111 | `lottery`.`betting_rebate`.`rebate_account_id`, 112 | date_format( `lottery`.`betting_rebate`.`create_time`, '%Y-%m-%d' ) 113 | ) `t` 114 | GROUP BY 115 | `t`.`user_account_id`, 116 | `t`.`everyday` 117 | ) 118 | ) `t` 119 | JOIN `lottery`.`user_account` 120 | ) 121 | WHERE 122 | ( `t`.`user_account_id` = `lottery`.`user_account`.`id` ) -------------------------------------------------------------------------------- /视图/游戏情况.txt: -------------------------------------------------------------------------------- 1 | create view v_game_situation as 2 | select 3 | game.*, 4 | ( 5 | select 6 | sum(rule.issue_count) 7 | from issue_setting setting 8 | left join issue_generate_rule rule 9 | on setting.id = rule.issue_setting_id 10 | where setting.game_id = game.id 11 | ) issue_count, 12 | issue.issue_num current_issue, 13 | issue.issue_num_inner current_issue_inner, 14 | issue.end_time current_issue_end_time, 15 | ( 16 | select 17 | pre_issue.issue_num 18 | from issue pre_issue 19 | where pre_issue.game_code = game.game_code 20 | and pre_issue.issue_num < issue.issue_num 21 | order by pre_issue.issue_num desc 22 | limit 1 23 | ) pre_issue, 24 | ( 25 | select 26 | pre_issue.lottery_num 27 | from issue pre_issue 28 | where pre_issue.game_code = game.game_code 29 | and pre_issue.issue_num < issue.issue_num 30 | order by pre_issue.issue_num desc 31 | limit 1 32 | ) pre_issue_lottery_num, 33 | ( 34 | select 35 | next_issue.issue_num 36 | from issue next_issue 37 | where next_issue.game_code = game.game_code 38 | and next_issue.start_time > NOW() 39 | order by next_issue.lottery_time asc 40 | limit 1 41 | ) next_issue, 42 | ( 43 | select 44 | next_issue.end_time 45 | from issue next_issue 46 | where next_issue.game_code = game.game_code 47 | and next_issue.start_time > NOW() 48 | order by next_issue.lottery_time asc 49 | limit 1 50 | ) next_issue_end_time 51 | from game game 52 | left join 53 | (select 54 | game_code,order_num 55 | from( 56 | SELECT 57 | bo.game_code, count(1) order_num 58 | FROM betting_order bo 59 | where bo.betting_time >= DATE_SUB(NOW(),INTERVAL 5 DAY) 60 | GROUP BY bo.game_code) tmp 61 | order by order_num desc) b 62 | on game.game_code = b.game_code 63 | left join 64 | issue issue 65 | on game.game_code = issue.game_code 66 | and issue.start_time <= NOW() 67 | and issue.end_time > NOW() 68 | order by b.order_num desc 69 | 70 | 71 | -------------------------------------------------------------------------------- /视图/返点赔率情况.txt: -------------------------------------------------------------------------------- 1 | create view v_rebate_and_odds_situation as 2 | select 3 | CONCAT(rebate,'/',odds) id, 4 | rebate,odds, 5 | sum(associated_account_num) associated_account_num, 6 | max(create_time) create_time 7 | from( 8 | select 9 | rebate,odds,create_time,0 associated_account_num 10 | from rebate_and_odds 11 | union all 12 | select 13 | rebate,odds,null create_time,count(1) associated_account_num 14 | from user_account GROUP BY rebate,odds 15 | ) t 16 | group by rebate,odds 17 | 18 | 19 | --------------------------------------------------------------------------------