fix management create user

This commit is contained in:
xiaomlove
2023-01-07 16:27:27 +08:00
parent ad6e66ce56
commit 3cc0d364a8
8 changed files with 40 additions and 24 deletions

View File

@@ -157,6 +157,11 @@ class NexusUpdate extends Command
$this->update->runExtraMigrate();
$this->doLog("runExtraMigrate done!");
$logFile = getLogFile();
$command = "chmod 777 $logFile";
$this->doLog("$command...");
executeCommand($command);
$this->doLog("All done!");
return 0;

View File

@@ -95,7 +95,7 @@ class Test extends Command
*/
public function handle()
{
$r = NexusDB::cache_get('category_content');
$r = getLogFile();
dd($r);
}

View File

@@ -57,18 +57,7 @@ class BaseRepository
protected function executeCommand($command, $format = 'string'): string|array
{
$append = " 2>&1";
if (!str_ends_with($command, $append)) {
$command .= $append;
}
do_log("command: $command");
$result = exec($command, $output, $result_code);
$outputString = implode("\n", $output);
do_log(sprintf('result_code: %s, result: %s, output: %s', $result_code, $result, $outputString));
if ($result_code != 0) {
throw new \RuntimeException($outputString);
}
return $format == 'string' ? $outputString : $output;
return executeCommand($command, $format);
}
}

View File

@@ -101,8 +101,11 @@ class BonusRepository extends BaseRepository
public function consumeToBuyTemporaryInvite($uid, $count = 1): bool
{
$user = User::query()->findOrFail($uid);
$requireBonus = BonusLogs::getBonusForBuyTemporaryInvite();
if ($requireBonus <= 0) {
throw new \RuntimeException("Temporary invite require bonus <= 0 !");
}
$user = User::query()->findOrFail($uid);
$toolRep = new ToolRepository();
$hashArr = $toolRep->generateUniqueInviteHash([], $count, $count);
NexusDB::transaction(function () use ($user, $requireBonus, $hashArr) {