save
This commit is contained in:
parent
e435d32588
commit
662394d7c3
6 changed files with 70 additions and 16 deletions
|
@ -3,6 +3,8 @@ namespace app\models;
|
|||
|
||||
use app\app;
|
||||
use app\models\addresses;
|
||||
use app\models\emails;
|
||||
use app\models\user_settings;
|
||||
use swentel\nostr\Key\Key;
|
||||
|
||||
class users
|
||||
|
@ -14,13 +16,9 @@ class users
|
|||
email TEXT UNIQUE,
|
||||
shipping_address_id INTEGER,
|
||||
billing_address_id INTEGER,
|
||||
opt_in_promotional BOOLEAN NOT NULL,
|
||||
opt_in_subscription BOOLEAN DEFAULT TRUE,
|
||||
opt_in_orders BOOLEAN DEFAULT TRUE,
|
||||
lifetime_spend INTEGER DEFAULT 0,
|
||||
lifetime_orders INTEGER DEFAULT 0,
|
||||
verified BOOLEAN NOT NULL,
|
||||
dark_theme BOOLEAN NOT NULL,
|
||||
nsec TEXT,
|
||||
npub TEXT NOT NULL,
|
||||
attached_lightning_address TEXT,
|
||||
|
@ -89,18 +87,14 @@ class users
|
|||
email,
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
opt_in_promotional,
|
||||
verified,
|
||||
dark_theme,
|
||||
nsec,
|
||||
npub
|
||||
) VALUES (
|
||||
:email,
|
||||
:shipping_address_id,
|
||||
:billing_address_id,
|
||||
:opt_in_promotional,
|
||||
:verified,
|
||||
:dark_theme,
|
||||
:nsec,
|
||||
:npub
|
||||
)";
|
||||
|
@ -108,17 +102,17 @@ class users
|
|||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':shipping_address_id', $ship_id);
|
||||
$stmt->bindParam(':billing_address_id', $bill_id);
|
||||
$stmt->bindParam(':opt_in_promotional', $opt_in_promotional);
|
||||
$stmt->bindParam(':verified', $verified);
|
||||
$stmt->bindParam(':dark_theme', $dark_theme);
|
||||
$stmt->bindParam(':nsec', $nsec);
|
||||
$stmt->bindParam(':npub', $npub);
|
||||
$stmt->execute();
|
||||
$user_id = app::$db->lastInsertId();
|
||||
user_settings::add($user_id, $opt_in_promotional, $dark_theme);
|
||||
addresses::updateUserIdById($ship_id, $user_id);
|
||||
if ($ship_id != $bill_id) {
|
||||
addresses::updateUserIdById($bill_id, $user_id);
|
||||
}
|
||||
emails::updateUserIdByEmail($email, $user_id);
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue