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) {

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-06');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-07');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -1485,8 +1485,8 @@ function check_email ($email) {
if(!preg_match('/^[A-Za-z0-9][A-Za-z0-9_.+\-]*@[A-Za-z0-9][A-Za-z0-9_+\-]*(\.[A-Za-z0-9][A-Za-z0-9_+\-]*)+$/', $email)) {
return false;
}
$bannedEmails = mysql_fetch_assoc(sql_query('select * from bannedemails'));
$bannedEmailsArr = preg_split('/[\s]+/', $bannedEmails['value'] ?? '');
$bannedEmails = \Nexus\Database\NexusDB::select('select * from bannedemails');
$bannedEmailsArr = preg_split('/[\s]+/', $bannedEmails[0]['value'] ?? '');
if (empty($bannedEmailsArr)) {
return true;
}

View File

@@ -1112,3 +1112,19 @@ function get_passkey_by_authkey($authkey)
return $userInfo->passkey;
});
}
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;
}

View File

@@ -76,13 +76,16 @@ function bonusarray($option = 0){
$results[] = $bonus;
//Tmp Invite
$bonus = array();
$bonus['points'] = \App\Models\BonusLogs::getBonusForBuyTemporaryInvite();
$bonus['art'] = 'tmp_invite';
$bonus['menge'] = 1;
$bonus['name'] = $lang_mybonus['text_buy_tmp_invite'];
$bonus['description'] = $lang_mybonus['text_buy_tmp_invite_note'];
$results[] = $bonus;
$tmpInviteBonus = \App\Models\BonusLogs::getBonusForBuyTemporaryInvite();
if ($tmpInviteBonus > 0) {
$bonus = array();
$bonus['points'] = $tmpInviteBonus;
$bonus['art'] = 'tmp_invite';
$bonus['menge'] = 1;
$bonus['name'] = $lang_mybonus['text_buy_tmp_invite'];
$bonus['description'] = $lang_mybonus['text_buy_tmp_invite_note'];
$results[] = $bonus;
}
//Custom Title
$bonus = array();