| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use App\Models\LhcOrder;
- use App\Services\LhcSettlementService;
- class LhcSettlement extends Command
- {
- /**
- * 命令名称和签名
- *
- * @var string
- */
- protected $signature = 'lhc:settlement';
-
- /**
- * 命令描述
- *
- * @var string
- */
- protected $description = '六合彩结算方法';
- /**
- * 执行命令
- *
- * @return int
- */
- public function handle(LhcSettlementService $service)
- {
- $issue = $this->argument('issue');
- $this->info("开始结算期号: {$issue}...");
-
- $result = $service->settle($issue);
-
- $this->info($result);
- }
- public function sportOrderSettlement(){
- $where = [
- 'status' => 1,
- 'pay_status' => 1,
- 'return_status' => 0,
- 'settlement_status' => 0,
- ];
- $list = Order::alias('o')
- ->join('sport s', 'o.data_id', '=', 's.data_id')
- ->where('s.state', 2)
- ->where($where)
- ->select('o.*', 's.score','s.half_score')
- ->get()->toArray();
- foreach($list as $item) {
- $detail = json_decode($item['detail'], true);
- $odd_id = $detail['odds'][0]['id'];
- $function = SportOdds::where('id',$odd_id)->value('function_name');
- $params = [
- 'score' => $item['score'],
- 'half_score' => $item['half_score'],
- 'data_id' => $item['data_id'],
- 'home_team_id' => $item['home_team_id'],
- 'guest_team_id' => $item['guest_team_id'],
- ];
- $result = $function($item['amount'], $detail, $params);
- print_r($result);die;
- }
- }
- }
|