Initial import

This commit is contained in:
Admin Nasledstvo
2026-05-01 20:52:04 +03:00
commit ac168868ee
10028 changed files with 2337954 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php
header('Content-type: application/json');
use app\models\UserPublic;
use app\services\JWT;
$post = \Yii::$app->request->getRawBody();
$postDecode = json_decode($post);
if (!empty($postDecode->device_id) && !empty($postDecode->uid)) {
$device_id = $postDecode->device_id;
$uid = $postDecode->uid;
$user = UserPublic::find()->where(['device_id' => $device_id])->one();
if ($user) {
$decode = JWT::decode($user->device_id, JWT::SECRET_KEY);
if($decode->uid == $uid) {
$user->is_mobile_user = 1;
$user->save();
echo json_encode(['userToken' => JWT::encode(['id' => $user->id], JWT::SECRET_KEY), 'profile'=> $user->profileData()]);
exit;
}
} else {
echo json_encode(['error' => 'wrong_user']);
exit;
}
} else {
echo json_encode(['error' => 'wrong_user']);
exit;
}