Added Resources Starter
This commit is contained in:
@@ -59,8 +59,14 @@ $routes->post('/en/desktop/api/v2/myfituser/account', 'Myfitauth::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/profile', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/myfeed', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/tracking', 'Myfituser::users');
|
||||
|
||||
|
||||
// REMINDERS -------------------------------------------------------------
|
||||
$routes->get('/en/desktop/api/v2/myfituser/reminders', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/remcategory', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/remmode', 'Myfituser::users');
|
||||
$routes->post('/en/desktop/api/v2/myfituser/editreminder', 'Myfituser::users'); // save create a reminder item
|
||||
|
||||
$routes->get('/en/desktop/api/v2/myfituser/calendar', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/loginhx', 'Myfituser::users');
|
||||
$routes->get('/en/desktop/api/v2/myfituser/stats', 'Myfituser::users');
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class Myfituser extends BaseController
|
||||
{
|
||||
@@ -12,7 +13,7 @@ class Myfituser extends BaseController
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->request = $request = \Config\Services::request();
|
||||
$this->request = \Config\Services::request(); // Services::request();
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -21,6 +22,7 @@ class Myfituser extends BaseController
|
||||
|
||||
public function users()
|
||||
{
|
||||
//$request = service('request');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
|
||||
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
|
||||
@@ -40,17 +42,23 @@ class Myfituser extends BaseController
|
||||
'account' => ['POST'],
|
||||
'login' => ['POST'],
|
||||
'reminders' => ['GET'],
|
||||
'editreminder' => ['POST'],
|
||||
'myfeed' => ['GET'],
|
||||
'calendar' => ['GET'],
|
||||
'profile' => ['GET'],
|
||||
'loginhx' => ['GET'],
|
||||
'stats' => ['GET'],
|
||||
'remcategory' => ['GET'],
|
||||
'remmode' => ['GET'],
|
||||
];
|
||||
|
||||
// Retrieve an HTTP Request header, with case-insensitive names
|
||||
$this->request->getHeader('host');
|
||||
$this->request->getHeader('Content-Type');
|
||||
// $header_host = $this->request->getHeader('host');
|
||||
$content_type = $this->request->getHeader('Content-Type');
|
||||
// Retrieve JSON from AJAX calls
|
||||
$hhost = $this->request->getServer('Host');
|
||||
// Retrieve an HTTP Request header, with case-insensitive names
|
||||
// $request->getHeader('host');
|
||||
//$au = $this->request->getHeader('Authorization');
|
||||
|
||||
$res1 = [];
|
||||
@@ -64,6 +72,28 @@ class Myfituser extends BaseController
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$raw_array = json_decode($raw_json, true);
|
||||
//$raw_array['au'] =$au;
|
||||
// $raw_array['host'] = $header_host;
|
||||
|
||||
$raw_array['getitem'] = $this->request->getJSON();
|
||||
$raw_array['content_type'] = $content_type;
|
||||
$raw_array['hhost'] = $hhost;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
$opts = [
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
],
|
||||
];
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
|
||||
// Open the file using the HTTP headers set above
|
||||
$raw_json = file_get_contents('php://input', false, $context);
|
||||
$raw_array = json_decode($raw_json, true);
|
||||
// $raw_array = ['abcdef'];
|
||||
}
|
||||
|
||||
// $raw_array = json_decode($this->request->getJSON(), true);
|
||||
|
||||
switch ($endpoint) {
|
||||
case 'login':
|
||||
@@ -81,17 +111,29 @@ class Myfituser extends BaseController
|
||||
$myfitUserReminders = new \App\Models\myfitUserReminders();
|
||||
$res1 = $myfitUserReminders->reminderCategory();
|
||||
break;
|
||||
case 'remmode':
|
||||
$myfitUserReminders = new \App\Models\myfitUserReminders();
|
||||
$res1 = $myfitUserReminders->reminderMode();
|
||||
break;
|
||||
case 'editreminder':
|
||||
$myfitUserReminders = new \App\Models\myfitUserReminders();
|
||||
$res1 = $myfitUserReminders->reminderAddEdit($raw_array);
|
||||
break;
|
||||
case 'resources':
|
||||
$myfiResources = new \App\Models\myfiResources();
|
||||
$res1 = $myfiResources->getSiteResources($raw_array);
|
||||
break;
|
||||
case 'myfeed':
|
||||
$res = $this->dummyData($raw_array);
|
||||
$res1 = $this->dummyData($raw_array);
|
||||
break;
|
||||
case 'calendar':
|
||||
$res = $this->dummyData($raw_array);
|
||||
$res1 = $this->dummyData($raw_array);
|
||||
break;
|
||||
case 'profile':
|
||||
$res = $this->dummyData($raw_array);
|
||||
$res1 = $this->dummyData($raw_array);
|
||||
break;
|
||||
case 'stats':
|
||||
$res = $this->dummyData($raw_array);
|
||||
$res1 = $this->dummyData($raw_array);
|
||||
break;
|
||||
case 'loginhx':
|
||||
$myfitHx = new \App\Models\myfitHx();
|
||||
|
||||
@@ -16,8 +16,14 @@ class myfitHx extends Model
|
||||
|
||||
public function readLoginHx($in)
|
||||
{
|
||||
// $in['member_id'] = 16;
|
||||
$member_id =
|
||||
( isset($in['member_id']) && $in['member_id'] > 0 && is_int($in['member_id']) )
|
||||
? $in['member_id']
|
||||
: 0;
|
||||
$sqlQ =
|
||||
'SELECT * FROM members_login_hx WHERE member_id='.$in['member_id'];
|
||||
'SELECT * FROM members_login_hx WHERE member_id=' .
|
||||
$member_id;
|
||||
$query = $this->db->query($sqlQ);
|
||||
$data['loginhx_data'] = $query->getResultArray();
|
||||
return $inx = [
|
||||
@@ -25,7 +31,5 @@ class myfitHx extends Model
|
||||
'status' => 1,
|
||||
'raw_data' => $in,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+47
-32
@@ -5,44 +5,59 @@ use CodeIgniter\Model;
|
||||
|
||||
class myfitPricing extends Model
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function getSitePricing($in)
|
||||
{
|
||||
|
||||
return array
|
||||
(
|
||||
[
|
||||
'icon' => '/static/media/standard.png',
|
||||
'title' => 'Standard',
|
||||
'text' => 'For the basics.',
|
||||
'price' => 'Free',
|
||||
'price_anual' => 'Free',
|
||||
'features' =>['Reminders', 'Health Tracking', 'Feature 3', 'Feature 4','Feature 5']
|
||||
return [
|
||||
'pricing_text_02' => 'This will be the test header test 001',
|
||||
'pricing' => [
|
||||
[
|
||||
'icon' => '/static/media/standard.png',
|
||||
'title' => 'Standard',
|
||||
'text' => 'For the basics.',
|
||||
'price' => 'Free',
|
||||
'price_anual' => 'Free',
|
||||
'features' => [
|
||||
'Reminders',
|
||||
'Health Tracking',
|
||||
'Analytics',
|
||||
'Notifications',
|
||||
'Health Resources',
|
||||
],
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/unlimited.png',
|
||||
'title' => 'Unlimited',
|
||||
'text' => 'Professionals here.',
|
||||
'price' => '$7.99/m',
|
||||
'price_anual' => '$55/y',
|
||||
'features' => [
|
||||
'Everyting Premium',
|
||||
'Feature 22',
|
||||
'Feature 33',
|
||||
'Integrations',
|
||||
'Custom Page',
|
||||
],
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/premium.png',
|
||||
'title' => 'Premium',
|
||||
'text' => 'For small team.',
|
||||
'price' => '$5/m',
|
||||
'price_anual' => '$45/y',
|
||||
'features' => [
|
||||
'Everything Standard',
|
||||
'Group/Family Tracking',
|
||||
'Custom Dashboard',
|
||||
'Recomendations',
|
||||
'Storage',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/unlimited.png',
|
||||
'title' => 'Unlimited',
|
||||
'text' => 'Professionals here.',
|
||||
'price' => '$7.99/m',
|
||||
'price_anual' => '$55/y',
|
||||
'features' =>['Everyting Premium', 'Feature 22', 'Feature 33', 'Feature 44','Custom Page']
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/premium.png',
|
||||
'title' => 'Premium',
|
||||
'text' => 'For small team.',
|
||||
'price' => '$5/m',
|
||||
'price_anual' => '$45/y',
|
||||
'features' =>['Everything Standard', 'Group/Family Tracking', 'Feature 88', 'Feature 99','Feature 100']
|
||||
]
|
||||
);
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class myfitResources extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getSiteResources($in)
|
||||
{
|
||||
return [
|
||||
'pricing_text_02' => 'This will be the test header test 001',
|
||||
'pricing' => [
|
||||
[
|
||||
'icon' => '/static/media/standard.png',
|
||||
'title' => 'Standard',
|
||||
'text' => 'For the basics.',
|
||||
'price' => 'Free',
|
||||
'price_anual' => 'Free',
|
||||
'features' => [
|
||||
'Reminders',
|
||||
'Health Tracking',
|
||||
'Analytics',
|
||||
'Notifications',
|
||||
'Health Resources',
|
||||
],
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/unlimited.png',
|
||||
'title' => 'Unlimited',
|
||||
'text' => 'Professionals here.',
|
||||
'price' => '$7.99/m',
|
||||
'price_anual' => '$55/y',
|
||||
'features' => [
|
||||
'Everyting Premium',
|
||||
'Feature 22',
|
||||
'Feature 33',
|
||||
'Integrations',
|
||||
'Custom Page',
|
||||
],
|
||||
],
|
||||
[
|
||||
'icon' => '/static/media/premium.png',
|
||||
'title' => 'Premium',
|
||||
'text' => 'For small team.',
|
||||
'price' => '$5/m',
|
||||
'price_anual' => '$45/y',
|
||||
'features' => [
|
||||
'Everything Standard',
|
||||
'Group/Family Tracking',
|
||||
'Custom Dashboard',
|
||||
'Recomendations',
|
||||
'Storage',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -11,17 +11,17 @@ class myfitUserReminders extends Model
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
//$db = \Config\Database::connect('mermsemr');
|
||||
$this->db = \Config\Database::connect($this->con_name);
|
||||
}
|
||||
|
||||
public function readReminders($in)
|
||||
{
|
||||
$member_id =
|
||||
isset($in['member_id']) && $in['member_id'] > 0
|
||||
? $in['member_id']
|
||||
: 0;
|
||||
$reminder_category = $this->reminderCategory(); // [];
|
||||
$sqlQ =
|
||||
'SELECT * FROM members_reminders';
|
||||
|
||||
|
||||
$sqlQ = "SELECT * FROM members_reminders WHERE member_id = $member_id";
|
||||
$query = $this->db->query($sqlQ);
|
||||
$data['reminders_data'] = $query->getResultArray();
|
||||
return $inx = [
|
||||
@@ -30,16 +30,107 @@ class myfitUserReminders extends Model
|
||||
'status' => 1,
|
||||
'raw_data' => $in,
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function reminderCategory(){
|
||||
|
||||
$sqlQ ="SELECT uuid,category,code FROM reminder_category ORDER BY category";
|
||||
public function reminderCategory()
|
||||
{
|
||||
$sqlQ =
|
||||
'SELECT uuid,category,code FROM reminder_category ORDER BY category';
|
||||
$query = $this->db->query($sqlQ);
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function reminderMode()
|
||||
{
|
||||
$sqlQ = 'SELECT uuid,mode,code FROM reminder_modes';
|
||||
$query = $this->db->query($sqlQ);
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function reminderAddEdit($in)
|
||||
{
|
||||
/*
|
||||
{
|
||||
'member_id': 1,
|
||||
'description': 'This is a test',
|
||||
'category': 'APPT',
|
||||
'mode' : 'SMS',
|
||||
'start_date':'2022-01-01',
|
||||
'end_date': '2022-01-01',
|
||||
'notes':'This is te notes for the page '
|
||||
}
|
||||
|
||||
*/
|
||||
$in_test = [
|
||||
'member_id' => 1,
|
||||
'description' => 'This is a test',
|
||||
'category' => 'APPT',
|
||||
'mode' => 'SMS',
|
||||
'start_date' => '2022-01-01',
|
||||
'end_date' => '2022-01-01',
|
||||
'notes' => 'This is te notes for the page ',
|
||||
];
|
||||
|
||||
if (isset($in['member_id']) && $in['member_id'] > 0) {
|
||||
if (isset($in['uuid']) && trim($in['uuid']) != '') {
|
||||
return $this->editReminder($in);
|
||||
} else {
|
||||
return $this->addReminder($in);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'error' => 'Invalid call to reminder',
|
||||
'reason' => 'details commin in version 3',
|
||||
];
|
||||
}
|
||||
|
||||
private function addReminder($in)
|
||||
{
|
||||
$member_id = $in['member_id'];
|
||||
$description = $in['description'];
|
||||
$category = $in['category'];
|
||||
$mode = $in['mode'];
|
||||
$start_date = $in['start_date'];
|
||||
$end_date = $in['end_date'];
|
||||
$notes = $in['notes'];
|
||||
|
||||
// Create Rem
|
||||
$sqlQ = "INSERT INTO members_reminders ( member_id,
|
||||
description, category, mode, start_date, end_date,notes )
|
||||
VALUES ($member_id,'$description','$category', '$mode','$start_date', '$end_date','$notes')";
|
||||
if ($this->db->query($sqlQ)) {
|
||||
$insert_id = $this->db->insertID();
|
||||
|
||||
$sqlQ = "SELECT * FROM members_reminders WHERE id = $insert_id ";
|
||||
$query = $this->db->query($sqlQ);
|
||||
$rem_data = $query->getResultArray();
|
||||
} else {
|
||||
$insert_id = 0;
|
||||
$rem_data = [];
|
||||
}
|
||||
|
||||
return ['insert_id' => $insert_id, 'new_data' => $rem_data];
|
||||
}
|
||||
|
||||
private function editReminder($in)
|
||||
{
|
||||
$uuid = trim($in['uuid']);
|
||||
$member_id = $in['member_id'];
|
||||
$description = $in['description'];
|
||||
$category = $in['category'];
|
||||
$mode = $in['mode'];
|
||||
$start_date = $in['start_date'];
|
||||
$end_date = $in['end_date'];
|
||||
$notes = $in['notes'];
|
||||
|
||||
$sqlQ = "SELECT * FROM members_reminders WHERE member_id = $member_id AND uuid ='$uuid' ";
|
||||
$query = $this->db->query($sqlQ);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$sql = "INSERT INTO table (title) VALUES('" . $db->escapeString($title) . "')";
|
||||
|
||||
*/
|
||||
|
||||
@@ -17,12 +17,12 @@ class userAccess extends Model
|
||||
|
||||
public function startLogin($in)
|
||||
{
|
||||
$sqlQ =
|
||||
'SELECT m.id as member_id, m.*,mp.* FROM members m LEFT JOIN members_profile mp ON m.id=mp.member_id WHERE m.id =12';
|
||||
// $sqlQ =
|
||||
// 'SELECT m.id as member_id, m.*,mp.* FROM members m LEFT JOIN members_profile mp ON m.id=mp.member_id WHERE m.id =12';
|
||||
|
||||
$username = $in['username'];
|
||||
$password = $in['password'];
|
||||
$sqlQ = "SELECT m.id as member_id, m.*,mp.*
|
||||
$username = trim($in['username']);
|
||||
$password = trim($in['password']);
|
||||
$sqlQ = "SELECT m.id as mid, m.*,mp.*
|
||||
FROM members m LEFT
|
||||
JOIN members_profile mp ON m.id=mp.member_id
|
||||
WHERE LOWER(m.username) = LOWER('$username')
|
||||
@@ -33,8 +33,10 @@ class userAccess extends Model
|
||||
|
||||
if (count($data['profile_data']) == 1) {
|
||||
$data['profile_data'][0]['password'] = '**REMOVED**';
|
||||
$member_id = $data['profile_data'][0]['member_id'];
|
||||
$member_id = $data['profile_data'][0]['mid'];
|
||||
$member_uid = $data['profile_data'][0]['uuid'];
|
||||
$data['profile_data'][0]['member_id'] = $member_id; // fixing issue of member id used in profile
|
||||
|
||||
return $inx = [
|
||||
'session_token' => $this->generateSession($member_id),
|
||||
'member_id' => $member_id,
|
||||
|
||||
Reference in New Issue
Block a user