| 
														
															@@ -4,9 +4,11 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 namespace App\Services; 
														 | 
														
														 | 
														
															 namespace App\Services; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Http\Controllers\admin\GameplayRule; 
														 | 
														
														 | 
														
															 use App\Http\Controllers\admin\GameplayRule; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+use App\Models\Rebate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Services\BaseService; 
														 | 
														
														 | 
														
															 use App\Services\BaseService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Models\Bet; 
														 | 
														
														 | 
														
															 use App\Models\Bet; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Models\Config; 
														 | 
														
														 | 
														
															 use App\Models\Config; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+use Carbon\Carbon; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Illuminate\Support\Facades\DB; 
														 | 
														
														 | 
														
															 use Illuminate\Support\Facades\DB; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Illuminate\Support\Collection; 
														 | 
														
														 | 
														
															 use Illuminate\Support\Collection; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Illuminate\Support\Facades\Cache; 
														 | 
														
														 | 
														
															 use Illuminate\Support\Facades\Cache; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -20,14 +22,14 @@ use App\Services\BalanceLogService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 /** 
														 | 
														
														 | 
														
															 /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * 投注 
														 | 
														
														 | 
														
															  * 投注 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-*/ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-class BetService extends BaseService  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 { 
														 | 
														
														 | 
														
															 { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 模型 
														 | 
														
														 | 
														
															      * @description: 模型 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {string} 
														 | 
														
														 | 
														
															      * @return {string} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function model() :string 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function model(): string 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return Bet::class; 
														 | 
														
														 | 
														
															         return Bet::class; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -35,8 +37,8 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 枚举 
														 | 
														
														 | 
														
															      * @description: 枚举 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function enum() :string 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function enum(): string 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return ''; 
														 | 
														
														 | 
														
															         return ''; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -45,35 +47,35 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 获取查询条件 
														 | 
														
														 | 
														
															      * @description: 获取查询条件 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {array} $search 查询内容 
														 | 
														
														 | 
														
															      * @param {array} $search 查询内容 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {array} 
														 | 
														
														 | 
														
															      * @return {array} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function getWhere(array $search = []) :array 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function getWhere(array $search = []): array 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $where = []; 
														 | 
														
														 | 
														
															         $where = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['issue_no']) && !empty($search['issue_no'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['issue_no']) && !empty($search['issue_no'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['issue_no', '=', $search['issue_no']]; 
														 | 
														
														 | 
														
															             $where[] = ['issue_no', '=', $search['issue_no']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['member_id']) && !empty($search['member_id'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['member_id']) && !empty($search['member_id'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['member_id', '=', $search['member_id']]; 
														 | 
														
														 | 
														
															             $where[] = ['member_id', '=', $search['member_id']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['keywords']) && !empty($search['keywords'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['keywords']) && !empty($search['keywords'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['keywords', '=', $search['keywords']]; 
														 | 
														
														 | 
														
															             $where[] = ['keywords', '=', $search['keywords']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['issue_id']) && !empty($search['issue_id'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['issue_id']) && !empty($search['issue_id'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['issue_id', '=', $search['issue_id']]; 
														 | 
														
														 | 
														
															             $where[] = ['issue_id', '=', $search['issue_id']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['id']) && !empty($search['id'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['id']) && !empty($search['id'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['id', '=', $search['id']]; 
														 | 
														
														 | 
														
															             $where[] = ['id', '=', $search['id']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['user_id']) && !empty($search['user_id'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['user_id']) && !empty($search['user_id'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['user_id', '=', $search['user_id']]; 
														 | 
														
														 | 
														
															             $where[] = ['user_id', '=', $search['user_id']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(isset($search['status']) && !empty($search['status'])){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (isset($search['status']) && !empty($search['status'])) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $where[] = ['status', '=', $search['status']]; 
														 | 
														
														 | 
														
															             $where[] = ['status', '=', $search['status']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return $where; 
														 | 
														
														 | 
														
															         return $where; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     /** 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 查询单条数据 
														 | 
														
														 | 
														
															      * @description: 查询单条数据 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param array $search 
														 | 
														
														 | 
														
															      * @param array $search 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return \App\Models\Coin|null 
														 | 
														
														 | 
														
															      * @return \App\Models\Coin|null 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -100,7 +102,7 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      */ 
														 | 
														
														 | 
														
															      */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public static function paginate(array $search = []) 
														 | 
														
														 | 
														
															     public static function paginate(array $search = []) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $limit = isset($search['limit'])?$search['limit']:15; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $limit = isset($search['limit']) ? $search['limit'] : 15; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $paginator = self::model()::where(self::getWhere($search))->paginate($limit); 
														 | 
														
														 | 
														
															         $paginator = self::model()::where(self::getWhere($search))->paginate($limit); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return ['total' => $paginator->total(), 'data' => $paginator->items()]; 
														 | 
														
														 | 
														
															         return ['total' => $paginator->total(), 'data' => $paginator->items()]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -110,25 +112,25 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {string} $memberId 
														 | 
														
														 | 
														
															      * @param {string} $memberId 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {string} $input 
														 | 
														
														 | 
														
															      * @param {string} $input 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function bet(string $memberId,string $input ,$messageId = 0) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function bet(string $memberId, string $input, $messageId = 0) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $msg = []; 
														 | 
														
														 | 
														
															         $msg = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
														
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 钱包生成 
														 | 
														
														 | 
														
															         // 钱包生成 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // $walletInfo = WalletService::getUserWallet($memberId); 
														 | 
														
														 | 
														
															         // $walletInfo = WalletService::getUserWallet($memberId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 分解投注的内容 
														 | 
														
														 | 
														
															         // 分解投注的内容 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $betResult = GameplayRuleService::bettingRuleVerify($input); 
														 | 
														
														 | 
														
															         $betResult = GameplayRuleService::bettingRuleVerify($input); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $serviceAccount = Config::where('field', 'service_account')->first()->val; 
														 | 
														
														 | 
														
															         $serviceAccount = Config::where('field', 'service_account')->first()->val; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($betResult == null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($betResult == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "消息格式错误!\n"; 
														 | 
														
														 | 
														
															             $text = "消息格式错误!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
														
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -138,21 +140,21 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $amount = $betResult['amount'];    // 投注金额 
														 | 
														
														 | 
														
															         $amount = $betResult['amount'];    // 投注金额 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $gameplayRuleInfo = GameplayRuleService::getGameplayRules($keywords); 
														 | 
														
														 | 
														
															         $gameplayRuleInfo = GameplayRuleService::getGameplayRules($keywords); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($gameplayRuleInfo == null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($gameplayRuleInfo == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "玩法未配置!\n"; 
														 | 
														
														 | 
														
															             $text = "玩法未配置!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
														
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($gameplayRuleInfo['odds'] <= 0){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($gameplayRuleInfo['odds'] <= 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "赔率为0 庄家通吃 禁止投注!\n"; 
														 | 
														
														 | 
														
															             $text = "赔率为0 庄家通吃 禁止投注!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
														
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -160,22 +162,22 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 期数验证 
														 | 
														
														 | 
														
															         // 期数验证 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $issueInfo = IssueService::model()::where('status',IssueService::model()::STATUS_BETTING)->orderBy('id','desc')->first(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(empty($issueInfo)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $issueCloseInfo = IssueService::model()::where('status',IssueService::model()::STATUS_CLOSE)->orderBy('id','desc')->first(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if(empty($issueCloseInfo)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (empty($issueInfo)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $issueCloseInfo = IssueService::model()::where('status', IssueService::model()::STATUS_CLOSE)->orderBy('id', 'desc')->first(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (empty($issueCloseInfo)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $text = "暂无可下注期数,本次下注无效!\n"; 
														 | 
														
														 | 
														
															                 $text = "暂无可下注期数,本次下注无效!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['text'] = $text; 
														 | 
														
														 | 
														
															                 $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                     $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return $msg; 
														 | 
														
														 | 
														
															                 return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $text = "封盘中,本次下注无效!\n"; 
														 | 
														
														 | 
														
															                 $text = "封盘中,本次下注无效!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['text'] = $text; 
														 | 
														
														 | 
														
															                 $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                     $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return $msg; 
														 | 
														
														 | 
														
															                 return $msg; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -183,31 +185,31 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(!is_numeric($amount) || $amount <= 0){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (!is_numeric($amount) || $amount <= 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "投注金额格式不正确!\n"; 
														 | 
														
														 | 
														
															             $text = "投注金额格式不正确!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
														
														 | 
														
															             $text .= "任何疑问都可以联系唯一财务:@{$serviceAccount}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 投注限制校验 
														 | 
														
														 | 
														
															         // 投注限制校验 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($amount < $gameplayRuleInfo['mininum']){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($amount < $gameplayRuleInfo['mininum']) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "下注失败,最小金额限制{$gameplayRuleInfo['mininum']}\n"; 
														 | 
														
														 | 
														
															             $text = "下注失败,最小金额限制{$gameplayRuleInfo['mininum']}\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 投注限制校验 
														 | 
														
														 | 
														
															         // 投注限制校验 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($amount > $gameplayRuleInfo['maxinum']){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($amount > $gameplayRuleInfo['maxinum']) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "下注失败,最大金额限制{$gameplayRuleInfo['maxinum']}\n"; 
														 | 
														
														 | 
														
															             $text = "下注失败,最大金额限制{$gameplayRuleInfo['maxinum']}\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -215,47 +217,52 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 获取用户余额 
														 | 
														
														 | 
														
															         // 获取用户余额 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $walletInfo = WalletService::findOne(['member_id' => $memberId]); 
														 | 
														
														 | 
														
															         $walletInfo = WalletService::findOne(['member_id' => $memberId]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $balance = $walletInfo['available_balance'];  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $balance = $walletInfo['available_balance']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 余额计算 
														 | 
														
														 | 
														
															         // 余额计算 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($balance < $amount){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($balance < $amount) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "余额不足,本次下注无效!\n"; 
														 | 
														
														 | 
														
															             $text = "余额不足,本次下注无效!\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
														
														 | 
														
															                 $msg['reply_to_message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return $msg; 
														 | 
														
														 | 
														
															             return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $userInfo = UserService::findOne(['member_id' => $memberId]); 
														 | 
														
														 | 
														
															         $userInfo = UserService::findOne(['member_id' => $memberId]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $betInfo = self::findOne(['member_id' => $memberId,'issue_no' => $issueInfo->issue_no,'keywords' => $keywords]); // 相同下注 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $betInfo = self::findOne(['member_id' => $memberId, 'issue_no' => $issueInfo->issue_no, 'keywords' => $keywords]); // 相同下注 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($betInfo){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($betInfo) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $betInfo->amount = $betInfo->amount + $amount; 
														 | 
														
														 | 
														
															             $betInfo->amount = $betInfo->amount + $amount; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $bet_id = $betInfo->id; 
														 | 
														
														 | 
														
															             $bet_id = $betInfo->id; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $betInfo->save(); 
														 | 
														
														 | 
														
															             $betInfo->save(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $data = []; 
														 | 
														
														 | 
														
															             $data = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $data['amount'] = $amount; // 分数 
														 | 
														
														 | 
														
															             $data['amount'] = $amount; // 分数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $data['keywords'] = $keywords;  // 玩法 
														 | 
														
														 | 
														
															             $data['keywords'] = $keywords;  // 玩法 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $data['member_id'] = $memberId;  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $data['user_id'] = $userInfo->id;  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $data['issue_no'] = $issueInfo->issue_no;  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $data['issue_id'] = $issueInfo->id;  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $data['member_id'] = $memberId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $data['user_id'] = $userInfo->id; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $data['issue_no'] = $issueInfo->issue_no; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $data['issue_id'] = $issueInfo->id; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $data['odds'] = $gameplayRuleInfo['odds']; 
														 | 
														
														 | 
														
															             $data['odds'] = $gameplayRuleInfo['odds']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $newBet = self::model()::create($data); 
														 | 
														
														 | 
														
															             $newBet = self::model()::create($data); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $bet_id = $newBet->id; 
														 | 
														
														 | 
														
															             $bet_id = $newBet->id; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        WalletService::updateBalance($memberId,-$amount); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        BalanceLogService::addLog($memberId,-$amount,$balance,($balance-$amount),'投注',$bet_id,''); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        WalletService::updateBalance($memberId, -$amount); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        BalanceLogService::addLog($memberId, -$amount, $balance, ($balance - $amount), '投注', $bet_id, ''); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $now = Carbon::now('America/New_York')->format('Y-m-d'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Rebate::addOrUpdate([ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            'date' => $now, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            'member_id' => $memberId, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            'betting_amount'=>$amount, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // // 返利 
														 | 
														
														 | 
														
															         // // 返利 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // $rebate = Config::where('field', 'rebate')->first()->val; 
														 | 
														
														 | 
														
															         // $rebate = Config::where('field', 'rebate')->first()->val; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // if($rebate > 0){ 
														 | 
														
														 | 
														
															         // if($rebate > 0){ 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -279,21 +286,21 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $text .= "下注成功\n"; 
														 | 
														
														 | 
														
															         $text .= "下注成功\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $msg['text'] = $text; 
														 | 
														
														 | 
														
															         $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $lastStr = self::getLastChar($userInfo->first_name,1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $lastStr = self::getLastChar($userInfo->first_name, 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText = ""; 
														 | 
														
														 | 
														
															         $groupText = ""; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $groupText .= "私聊下注 【xxxxxx".$lastStr."】 \n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $groupText .= "私聊下注 【xxxxxx" . $lastStr . "】 \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText .= "下注期数:{$issueInfo->issue_no} \n"; 
														 | 
														
														 | 
														
															         $groupText .= "下注期数:{$issueInfo->issue_no} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText .= "下注内容: \n"; 
														 | 
														
														 | 
														
															         $groupText .= "下注内容: \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText .= "----------- \n"; 
														 | 
														
														 | 
														
															         $groupText .= "----------- \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText .= "{$input} \n"; 
														 | 
														
														 | 
														
															         $groupText .= "{$input} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $groupText .= "----------- \n"; 
														 | 
														
														 | 
														
															         $groupText .= "----------- \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $inlineButton = self::getOperateButton(); 
														 | 
														
														 | 
														
															         $inlineButton = self::getOperateButton(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         // 群通知 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        self::bettingGroupNotice($groupText,$inlineButton);   // 群通知 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 群通知 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        self::bettingGroupNotice($groupText, $inlineButton);   // 群通知 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return $msg; 
														 | 
														
														 | 
														
															         return $msg; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -302,49 +309,48 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 模拟下注 
														 | 
														
														 | 
														
															     // 模拟下注 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public static function fakeBet() 
														 | 
														
														 | 
														
															     public static function fakeBet() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 期数验证 
														 | 
														
														 | 
														
															         // 期数验证 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $issueInfo = IssueService::model()::where('status',IssueService::model()::STATUS_BETTING)->orderBy('id','desc')->first(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($issueInfo){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $fake_bet_list = Cache::get('fake_bet_'.$issueInfo->issue_no,[]); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($issueInfo) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $fake_bet_list = Cache::get('fake_bet_' . $issueInfo->issue_no, []); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $gameplayRuleList = GameplayRuleService::model()::where('odds','>',0)->get(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $gameplayRuleList = GameplayRuleService::model()::where('odds', '>', 0)->get(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $gameplayRuleList = $gameplayRuleList->toArray(); 
														 | 
														
														 | 
														
															             $gameplayRuleList = $gameplayRuleList->toArray(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $randKey = array_rand($gameplayRuleList,1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $gameplayRuleInfo = $gameplayRuleList[$randKey]??[]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if($gameplayRuleInfo){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $randKey = array_rand($gameplayRuleList, 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if ($gameplayRuleInfo) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item = []; 
														 | 
														
														 | 
														
															                 $item = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item['keywords'] = $gameplayRuleInfo['keywords']; 
														 | 
														
														 | 
														
															                 $item['keywords'] = $gameplayRuleInfo['keywords']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item['odds'] = $gameplayRuleInfo['odds']; 
														 | 
														
														 | 
														
															                 $item['odds'] = $gameplayRuleInfo['odds']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                $item['amount'] = rand($gameplayRuleInfo['mininum'],$gameplayRuleInfo['maxinum']); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $item['amount'] = rand($gameplayRuleInfo['mininum'], $gameplayRuleInfo['maxinum']); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item['first_name'] = self::generateRandomString(6); 
														 | 
														
														 | 
														
															                 $item['first_name'] = self::generateRandomString(6); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item['profit'] = 0; 
														 | 
														
														 | 
														
															                 $item['profit'] = 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                $input = $item['keywords'].$item['amount']; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $input = $item['keywords'] . $item['amount']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $fake_bet_list[] = $item; 
														 | 
														
														 | 
														
															                 $fake_bet_list[] = $item; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                $lastStr = self::getLastChar($item['first_name'],1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $lastStr = self::getLastChar($item['first_name'], 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText = ""; 
														 | 
														
														 | 
														
															                 $groupText = ""; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                $groupText .= "私聊下注 【xxxxxx".$lastStr."】 \n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $groupText .= "私聊下注 【xxxxxx" . $lastStr . "】 \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText .= "下注期数:{$issueInfo->issue_no} \n"; 
														 | 
														
														 | 
														
															                 $groupText .= "下注期数:{$issueInfo->issue_no} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText .= "下注内容: \n"; 
														 | 
														
														 | 
														
															                 $groupText .= "下注内容: \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText .= "----------- \n"; 
														 | 
														
														 | 
														
															                 $groupText .= "----------- \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText .= "{$input} \n"; 
														 | 
														
														 | 
														
															                 $groupText .= "{$input} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $groupText .= "----------- \n"; 
														 | 
														
														 | 
														
															                 $groupText .= "----------- \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $inlineButton = self::getOperateButton(); 
														 | 
														
														 | 
														
															                 $inlineButton = self::getOperateButton(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // 群通知 
														 | 
														
														 | 
														
															                 // 群通知 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                self::bettingGroupNotice($groupText,$inlineButton);   // 群通知 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                self::bettingGroupNotice($groupText, $inlineButton);   // 群通知 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Cache::put('fake_bet_'.$issueInfo->issue_no,$fake_bet_list,500); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Cache::put('fake_bet_' . $issueInfo->issue_no, $fake_bet_list, 500); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-             
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -353,35 +359,35 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 当期下注 
														 | 
														
														 | 
														
															      * @description: 当期下注 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $memberId 
														 | 
														
														 | 
														
															      * @param {*} $memberId 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public static function currentBet($memberId) 
														 | 
														
														 | 
														
															     public static function currentBet($memberId) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
														
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         // 期数验证 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $issueInfo = IssueService::model()::where('status',IssueService::model()::STATUS_BETTING)->orderBy('id','desc')->first(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 期数验证 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $issue_no = ''; 
														 | 
														
														 | 
														
															         $issue_no = ''; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(!empty($issueInfo)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (!empty($issueInfo)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $issue_no = $issueInfo->issue_no; 
														 | 
														
														 | 
														
															             $issue_no = $issueInfo->issue_no; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $issueCloseInfo = IssueService::model()::where('status',IssueService::model()::STATUS_CLOSE)->orderBy('id','desc')->first(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if(empty($issueCloseInfo)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $issueCloseInfo = IssueService::model()::where('status', IssueService::model()::STATUS_CLOSE)->orderBy('id', 'desc')->first(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (empty($issueCloseInfo)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $issue_no = $issueCloseInfo->issue_no; 
														 | 
														
														 | 
														
															                 $issue_no = $issueCloseInfo->issue_no; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($issue_no){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($issue_no) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text = "当前期号:{$issue_no} \n"; 
														 | 
														
														 | 
														
															             $text = "当前期号:{$issue_no} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "\n"; 
														 | 
														
														 | 
														
															             $text .= "\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "----------\n"; 
														 | 
														
														 | 
														
															             $text .= "----------\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $list = self::findAll(['member_id' => $memberId ,'issue_no' => $issue_no]); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            foreach($list->toArray() as $k => $v){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $list = self::findAll(['member_id' => $memberId, 'issue_no' => $issue_no]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            foreach ($list->toArray() as $k => $v) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $text .= "{$v['keywords']}{$v['amount']} \n"; 
														 | 
														
														 | 
														
															                 $text .= "{$v['keywords']}{$v['amount']} \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "\n"; 
														 | 
														
														 | 
														
															             $text .= "\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "----------\n"; 
														 | 
														
														 | 
														
															             $text .= "----------\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = $text; 
														 | 
														
														 | 
														
															             $msg['text'] = $text; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['text'] = "当前没有开放的投注期数! \n"; 
														 | 
														
														 | 
														
															             $msg['text'] = "当前没有开放的投注期数! \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -392,18 +398,18 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @description: 近期投注 
														 | 
														
														 | 
														
															      * @description: 近期投注 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $memberId 
														 | 
														
														 | 
														
															      * @param {*} $memberId 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function recentlyRecord($memberId ,$page = 1 ,$limit = 5) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function recentlyRecord($memberId, $page = 1, $limit = 5) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $list = self::model()::where('member_id',$memberId)->whereIn('status',[self::model()::STATUS_STAY,self::model()::STATUS_SETTLED])->orderBy('id','desc')->forPage($page, $limit)->get(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $list = self::model()::where('member_id', $memberId)->whereIn('status', [self::model()::STATUS_STAY, self::model()::STATUS_SETTLED])->orderBy('id', 'desc')->forPage($page, $limit)->get(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // $text = "```\n"; 
														 | 
														
														 | 
														
															         // $text = "```\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $text = ""; 
														 | 
														
														 | 
														
															         $text = ""; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $text .= "期数--内容--盈亏 \n"; 
														 | 
														
														 | 
														
															         $text .= "期数--内容--盈亏 \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        foreach($list->toArray() as $k => $v){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        foreach ($list->toArray() as $k => $v) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $profit = $v['profit'] - $v['amount']; 
														 | 
														
														 | 
														
															             $profit = $v['profit'] - $v['amount']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // $text .= $v['issue_no']." ".$v['keywords']." ".$v['amount']." ".$v['profit']."\n"; 
														 | 
														
														 | 
														
															             // $text .= $v['issue_no']." ".$v['keywords']." ".$v['amount']." ".$v['profit']."\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $item = $v['issue_no']."==".$v['keywords'].rtrim(rtrim(number_format($v['amount'], 2, '.', ''), '0'), '.')."==".rtrim(rtrim(number_format($profit, 2, '.', ''), '0'), '.')."\n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $item = $v['issue_no'] . "==" . $v['keywords'] . rtrim(rtrim(number_format($v['amount'], 2, '.', ''), '0'), '.') . "==" . rtrim(rtrim(number_format($profit, 2, '.', ''), '0'), '.') . "\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= $item; 
														 | 
														
														 | 
														
															             $text .= $item; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // $text .= "```\n"; 
														 | 
														
														 | 
														
															         // $text .= "```\n"; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -418,18 +424,18 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $page 
														 | 
														
														 | 
														
															      * @param {*} $page 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $limit 
														 | 
														
														 | 
														
															      * @param {*} $limit 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function record($memberId ,$messageId = null ,$page = 1 ,$limit = 5) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function record($memberId, $messageId = null, $page = 1, $limit = 5) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
														
														 | 
														
															         $msg['chat_id'] = $memberId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $list = self::model()::where('member_id',$memberId)->whereIn('status',[self::model()::STATUS_STAY,self::model()::STATUS_SETTLED])->orderBy('id','desc')->forPage($page, $limit)->get(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $count = self::model()::where('member_id',$memberId)->whereIn('status',[self::model()::STATUS_STAY,self::model()::STATUS_SETTLED])->count(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $list = self::model()::where('member_id', $memberId)->whereIn('status', [self::model()::STATUS_STAY, self::model()::STATUS_SETTLED])->orderBy('id', 'desc')->forPage($page, $limit)->get(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $count = self::model()::where('member_id', $memberId)->whereIn('status', [self::model()::STATUS_STAY, self::model()::STATUS_SETTLED])->count(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $keyboard = []; 
														 | 
														
														 | 
														
															         $keyboard = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $text = "历史注单 \n"; 
														 | 
														
														 | 
														
															         $text = "历史注单 \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        foreach($list as $k => $v){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        foreach ($list as $k => $v) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $phase = $v->profit - $v->amount; 
														 | 
														
														 | 
														
															             $phase = $v->profit - $v->amount; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "-------------------------------------\n"; 
														 | 
														
														 | 
														
															             $text .= "-------------------------------------\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "期数:{$v->issue_no} \n"; 
														 | 
														
														 | 
														
															             $text .= "期数:{$v->issue_no} \n"; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -455,10 +461,10 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 ]; 
														 | 
														
														 | 
														
															                 ]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($messageId){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($messageId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['message_id'] = $messageId; 
														 | 
														
														 | 
														
															             $msg['message_id'] = $messageId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if($keyboard){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if ($keyboard) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $msg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]); 
														 | 
														
														 | 
														
															             $msg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return $msg; 
														 | 
														
														 | 
														
															         return $msg; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -469,56 +475,56 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $issue_no 
														 | 
														
														 | 
														
															      * @param {*} $issue_no 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param {*} $awards 
														 | 
														
														 | 
														
															      * @param {*} $awards 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return {*} 
														 | 
														
														 | 
														
															      * @return {*} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-     */     
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static function betSettled($issue_no,$awards) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static function betSettled($issue_no, $awards) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $list = self::findAll(['issue_no' => $issue_no ,'status' => self::model()::STATUS_STAY]); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $list = self::findAll(['issue_no' => $issue_no, 'status' => self::model()::STATUS_STAY]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $data = []; 
														 | 
														
														 | 
														
															         $data = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        $text = $issue_no."期开奖结果 \n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $text = $issue_no . "期开奖结果 \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $text .= "-----本期开奖账单----- \n"; 
														 | 
														
														 | 
														
															         $text .= "-----本期开奖账单----- \n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $bet_num = 0; 
														 | 
														
														 | 
														
															         $bet_num = 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        foreach($list->toArray() as $k => $v){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        foreach ($list->toArray() as $k => $v) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $userInfo = UserService::findAll(['member_id' => $v['member_id']]); 
														 | 
														
														 | 
														
															             $userInfo = UserService::findAll(['member_id' => $v['member_id']]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $lastStr = self::getLastChar($userInfo->first_name,1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $lastStr = self::getLastChar($userInfo->first_name, 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $item = []; 
														 | 
														
														 | 
														
															             $item = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $item['id'] = $v['id']; 
														 | 
														
														 | 
														
															             $item['id'] = $v['id']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            $item['status'] =  self::model()::STATUS_SETTLED; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            $item['status'] = self::model()::STATUS_SETTLED; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if(in_array($v['keywords'],$awards)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (in_array($v['keywords'], $awards)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $profit = $v['amount'] * $v['odds']; 
														 | 
														
														 | 
														
															                 $profit = $v['amount'] * $v['odds']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if($profit > 880000){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($profit > 880000) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     $profit = 880000; // 单注最高奖金880000 
														 | 
														
														 | 
														
															                     $profit = 880000; // 单注最高奖金880000 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $item['profit'] = $profit; 
														 | 
														
														 | 
														
															                 $item['profit'] = $profit; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $yl = $profit - $v['amount']; 
														 | 
														
														 | 
														
															                 $yl = $profit - $v['amount']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if($k+1 <= 15){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($k + 1 <= 15) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    $text .= "私聊下注 【******".$lastStr."】 {$yl}\n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    $text .= "私聊下注 【******" . $lastStr . "】 {$yl}\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     $bet_num++; 
														 | 
														
														 | 
														
															                     $bet_num++; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // 结算 
														 | 
														
														 | 
														
															                 // 结算 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                WalletService::updateBalance($v['member_id'],$profit); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                WalletService::updateBalance($v['member_id'], $profit); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $walletInfo = WalletService::findOne(['member_id' => $v['member_id']]); 
														 | 
														
														 | 
														
															                 $walletInfo = WalletService::findOne(['member_id' => $v['member_id']]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                $balance = $walletInfo['available_balance'];  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $balance = $walletInfo['available_balance']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                BalanceLogService::addLog($v['member_id'],$profit,$balance,($balance+$profit),'中奖',$v['id'],''); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if($k+1 <= 15){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    $text .= "私聊下注 【******".$lastStr."】 -{$v['amount']}\n"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                BalanceLogService::addLog($v['member_id'], $profit, $balance, ($balance + $profit), '中奖', $v['id'], ''); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($k + 1 <= 15) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    $text .= "私聊下注 【******" . $lastStr . "】 -{$v['amount']}\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     $bet_num++; 
														 | 
														
														 | 
														
															                     $bet_num++; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            self::model()::where('id',$v['id'])->update($item); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            self::model()::where('id', $v['id'])->update($item); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $inlineButton = self::getOperateButton(); 
														 | 
														
														 | 
														
															         $inlineButton = self::getOperateButton(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $rand_num = 30 - $bet_num; 
														 | 
														
														 | 
														
															         $rand_num = 30 - $bet_num; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        for($i=0;$i<$rand_num;$i++){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        for ($i = 0; $i < $rand_num; $i++) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 生成 -100000 到 100000 的随机数,但排除 -10 到 10 的范围 
														 | 
														
														 | 
														
															             // 生成 -100000 到 100000 的随机数,但排除 -10 到 10 的范围 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $randomNumber = random_int(-1000000, 1000000) / 100; 
														 | 
														
														 | 
														
															             $randomNumber = random_int(-1000000, 1000000) / 100; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if ($randomNumber >= -10 && $randomNumber <= 10) { 
														 | 
														
														 | 
														
															             if ($randomNumber >= -10 && $randomNumber <= 10) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -528,7 +534,7 @@ class BetService extends BaseService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             $text .= "私聊下注 【******】 {$randomNumber}\n"; 
														 | 
														
														 | 
														
															             $text .= "私聊下注 【******】 {$randomNumber}\n"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         // 群通知 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 群通知 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         self::bettingGroupNotice($text, $inlineButton, ''); 
														 | 
														
														 | 
														
															         self::bettingGroupNotice($text, $inlineButton, ''); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |