20 lines
474 B
PHP
20 lines
474 B
PHP
<?php
|
|
header('Content-type: application/json');
|
|
$user = \app\services\Auth::getUserByToken();
|
|
|
|
|
|
if($user) {
|
|
$jsonData = Yii::$app->request->getRawBody();
|
|
$data = json_decode($jsonData);
|
|
|
|
|
|
if($data->status) {
|
|
$user->club_card = $data->status == 'active' ? 1 : null;
|
|
$user->save();
|
|
}
|
|
echo json_encode(['success'=> 1, 'profile' => $user->profileData()]);
|
|
exit;
|
|
}
|
|
echo json_encode(['error' => 1, 'message' => 'Permission denied']);
|
|
exit;
|