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
+5
View File
@@ -157,6 +157,11 @@ class NexusUpdate extends Command
$this->update->runExtraMigrate(); $this->update->runExtraMigrate();
$this->doLog("runExtraMigrate done!"); $this->doLog("runExtraMigrate done!");
$logFile = getLogFile();
$command = "chmod 777 $logFile";
$this->doLog("$command...");
executeCommand($command);
$this->doLog("All done!"); $this->doLog("All done!");
return 0; return 0;
+1 -1
View File
@@ -95,7 +95,7 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$r = NexusDB::cache_get('category_content'); $r = getLogFile();
dd($r); dd($r);
} }
+1 -12
View File
@@ -57,18 +57,7 @@ class BaseRepository
protected function executeCommand($command, $format = 'string'): string|array protected function executeCommand($command, $format = 'string'): string|array
{ {
$append = " 2>&1"; return executeCommand($command, $format);
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;
} }
} }
+4 -1
View File
@@ -101,8 +101,11 @@ class BonusRepository extends BaseRepository
public function consumeToBuyTemporaryInvite($uid, $count = 1): bool public function consumeToBuyTemporaryInvite($uid, $count = 1): bool
{ {
$user = User::query()->findOrFail($uid);
$requireBonus = BonusLogs::getBonusForBuyTemporaryInvite(); $requireBonus = BonusLogs::getBonusForBuyTemporaryInvite();
if ($requireBonus <= 0) {
throw new \RuntimeException("Temporary invite require bonus <= 0 !");
}
$user = User::query()->findOrFail($uid);
$toolRep = new ToolRepository(); $toolRep = new ToolRepository();
$hashArr = $toolRep->generateUniqueInviteHash([], $count, $count); $hashArr = $toolRep->generateUniqueInviteHash([], $count, $count);
NexusDB::transaction(function () use ($user, $requireBonus, $hashArr) { NexusDB::transaction(function () use ($user, $requireBonus, $hashArr) {
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0'); 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('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+2 -2
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)) { 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; return false;
} }
$bannedEmails = mysql_fetch_assoc(sql_query('select * from bannedemails')); $bannedEmails = \Nexus\Database\NexusDB::select('select * from bannedemails');
$bannedEmailsArr = preg_split('/[\s]+/', $bannedEmails['value'] ?? ''); $bannedEmailsArr = preg_split('/[\s]+/', $bannedEmails[0]['value'] ?? '');
if (empty($bannedEmailsArr)) { if (empty($bannedEmailsArr)) {
return true; return true;
} }
+16
View File
@@ -1112,3 +1112,19 @@ function get_passkey_by_authkey($authkey)
return $userInfo->passkey; 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;
}
+10 -7
View File
@@ -76,13 +76,16 @@ function bonusarray($option = 0){
$results[] = $bonus; $results[] = $bonus;
//Tmp Invite //Tmp Invite
$bonus = array(); $tmpInviteBonus = \App\Models\BonusLogs::getBonusForBuyTemporaryInvite();
$bonus['points'] = \App\Models\BonusLogs::getBonusForBuyTemporaryInvite(); if ($tmpInviteBonus > 0) {
$bonus['art'] = 'tmp_invite'; $bonus = array();
$bonus['menge'] = 1; $bonus['points'] = $tmpInviteBonus;
$bonus['name'] = $lang_mybonus['text_buy_tmp_invite']; $bonus['art'] = 'tmp_invite';
$bonus['description'] = $lang_mybonus['text_buy_tmp_invite_note']; $bonus['menge'] = 1;
$results[] = $bonus; $bonus['name'] = $lang_mybonus['text_buy_tmp_invite'];
$bonus['description'] = $lang_mybonus['text_buy_tmp_invite_note'];
$results[] = $bonus;
}
//Custom Title //Custom Title
$bonus = array(); $bonus = array();