mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 21:41:03 +08:00
fix management create user
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -95,7 +95,7 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = NexusDB::cache_get('category_content');
|
||||
$r = getLogFile();
|
||||
dd($r);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user