mirror of
https://github.com/slawkens/myaac.git
synced 2026-02-06 13:16:22 +01:00
Migration: 49 - Fix get proper account id for samples
This commit is contained in:
@@ -3,11 +3,21 @@
|
|||||||
* @var OTS_DB_MySQL $db
|
* @var OTS_DB_MySQL $db
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use MyAAC\Models\Account as AccountModel;
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
|
$accountId = getSession('account') ?? 1;
|
||||||
|
if (!defined('MYAAC_INSTALL')) {
|
||||||
|
$accountModel = AccountModel::where('web_flags', 3)->first();
|
||||||
|
if ($accountModel) {
|
||||||
|
$accountId = $accountModel->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function insert_sample_if_not_exist($p): void
|
function insert_sample_if_not_exist($p): void
|
||||||
{
|
{
|
||||||
global $time;
|
global $time, $accountId;
|
||||||
|
|
||||||
$player = new OTS_Player();
|
$player = new OTS_Player();
|
||||||
$player->find($p['name']);
|
$player->find($p['name']);
|
||||||
@@ -17,7 +27,7 @@ function insert_sample_if_not_exist($p): void
|
|||||||
$player->setData([
|
$player->setData([
|
||||||
'name' => $p['name'],
|
'name' => $p['name'],
|
||||||
'group_id' => 1,
|
'group_id' => 1,
|
||||||
'account_id' => getSession('account') ?? 1,
|
'account_id' => $accountId,
|
||||||
'level' => $p['level'],
|
'level' => $p['level'],
|
||||||
'vocation' => $p['vocation_id'],
|
'vocation' => $p['vocation_id'],
|
||||||
'health' => $p['health'],
|
'health' => $p['health'],
|
||||||
|
|||||||
Reference in New Issue
Block a user