$i, 'ttl' => 80, 'game_state' => 2, 'source' => $source, 'commitment' => $commitment, 'num1' => $nums[0], 'num2' => $nums[1], 'num3' => $nums[2], 'create_time' => date('Y-m-d H:i:s'), 'update_time' => date('Y-m-d H:i:s'), ]; if (count($games) > 10) { $objGame3->replaceObjects2($games); $games = []; } } if ($games) { $objGame3->replaceObjects2($games); } function getNum($source) { $nums = []; for ($i = 0; $i < 3; $i++) { $sum = 0; for ($n = 0; $n < 6; $n++) { $index = ($i * 6 + $n) * 2; $str = $source[$index] . $source[$index + 1]; $sum += hexdec($str); } $nums[] = $sum % 6 + 1; } return $nums; }