LhcSettlement.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Models\LhcOrder;
  5. use App\Services\LhcSettlementService;
  6. class LhcSettlement extends Command
  7. {
  8. /**
  9. * 命令名称和签名
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'lhc:settlement';
  14. /**
  15. * 命令描述
  16. *
  17. * @var string
  18. */
  19. protected $description = '六合彩结算方法';
  20. /**
  21. * 执行命令
  22. *
  23. * @return int
  24. */
  25. public function handle(LhcSettlementService $service)
  26. {
  27. $issue = $this->argument('issue');
  28. $this->info("开始结算期号: {$issue}...");
  29. $result = $service->settle($issue);
  30. $this->info($result);
  31. }
  32. public function sportOrderSettlement(){
  33. $where = [
  34. 'status' => 1,
  35. 'pay_status' => 1,
  36. 'return_status' => 0,
  37. 'settlement_status' => 0,
  38. ];
  39. $list = Order::alias('o')
  40. ->join('sport s', 'o.data_id', '=', 's.data_id')
  41. ->where('s.state', 2)
  42. ->where($where)
  43. ->select('o.*', 's.score','s.half_score')
  44. ->get()->toArray();
  45. foreach($list as $item) {
  46. $detail = json_decode($item['detail'], true);
  47. $odd_id = $detail['odds'][0]['id'];
  48. $function = SportOdds::where('id',$odd_id)->value('function_name');
  49. $params = [
  50. 'score' => $item['score'],
  51. 'half_score' => $item['half_score'],
  52. 'data_id' => $item['data_id'],
  53. 'home_team_id' => $item['home_team_id'],
  54. 'guest_team_id' => $item['guest_team_id'],
  55. ];
  56. $result = $function($item['amount'], $detail, $params);
  57. print_r($result);die;
  58. }
  59. }
  60. }