-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from leon-mbs/dev
4.8.2
- Loading branch information
Showing
205 changed files
with
8,764 additions
and
4,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ www/cron.cmd | |
www/.idea/ | ||
|
||
|
||
www/logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Òîâàðíî-òðàíñïîðòíàÿ íàêëàäíàÿ', 'TTN', 'Ïðîäàæè', 0); | ||
|
||
CREATE TABLE `shop_images` ( | ||
`image_id` int(11) NOT NULL AUTO_INCREMENT, | ||
`content` longblob NOT NULL, | ||
`mime` varchar(16) DEFAULT NULL, | ||
`thumb` longblob, | ||
PRIMARY KEY (`image_id`) | ||
) DEFAULT CHARSET=utf8; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\API; | ||
|
||
class common extends JsonRPC | ||
{ | ||
|
||
public function login($user, $password) { | ||
|
||
|
||
$api = \App\System::getOptions('api'); | ||
|
||
$user = \App\Helper::login($user, $password); | ||
|
||
if ($user instanceof \App\Entity\User) { | ||
$key = strlen($api['key']) > 0 ? $api['key'] : "defkey"; | ||
$exp = strlen($api['exp']) > 0 ? $api['exp'] : 60; | ||
|
||
$token = array( | ||
"user_id" => $user->user_id, | ||
"iat" => time(), | ||
"exp" => time() + $exp * 60 | ||
); | ||
|
||
$jwt = \Firebase\JWT\JWT::encode($token, $key); | ||
|
||
|
||
} else { | ||
throw new \Exception('Неверный логин', 1000); | ||
} | ||
|
||
return $jwt; | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\API; | ||
/** | ||
* возвращает описание API | ||
*/ | ||
class help | ||
{ | ||
function __construct() { | ||
|
||
global $_config; | ||
|
||
|
||
$path = ''; | ||
$name = ltrim($name, '\\'); | ||
|
||
$lang = $_config['common']['lang']; | ||
|
||
if (strlen($_GET['lang']) > 0) { | ||
$lang = $_GET['lang']; | ||
} | ||
|
||
$templatepath = 'templates/'; | ||
|
||
if (strlen($lang) > 0 && $lang != 'ru') { | ||
$templatepath = 'templates_' . $lang . '/'; | ||
} | ||
$path = _ROOT . strtolower($templatepath) . "apihelp.html"; | ||
|
||
|
||
$template = @file_get_contents($path); | ||
echo $template; | ||
die; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\API; | ||
|
||
class items extends JsonRPC | ||
{ | ||
/** | ||
* список категорий | ||
* | ||
*/ | ||
public function catlist($args) { | ||
|
||
|
||
$list = array(); | ||
foreach (\App\Entity\Category::find('', 'cat_name') as $cat) { | ||
$list[] = array('id' => $cat->cat_id, 'name' => $cat->cat_name); | ||
|
||
} | ||
return $list; | ||
} | ||
|
||
public function itemlist($args) { | ||
|
||
$list = array(); | ||
$w = ''; | ||
|
||
if ($args['cat'] > 0) { | ||
$w = "cat_id=" . $args['cat']; | ||
} | ||
\App\Helper::log($w); | ||
foreach (\App\Entity\Item::find($w, 'itemname') as $item) { | ||
$list[] = array('code' => $item->item_code, 'name' => $item->itemame); | ||
|
||
} | ||
return $list; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace App; | ||
namespace App\API; | ||
|
||
/** | ||
* Base class for RESTFul | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\API; | ||
|
||
/** | ||
* Пример использования произвольного кастомного класса в API | ||
* пример вызова /api/TestClass/Hello/1 | ||
*/ | ||
class TestClass | ||
{ | ||
|
||
public function Hello($p) { | ||
|
||
//если POST | ||
$request = file_get_contents('php://input'); | ||
|
||
echo "Hi"; | ||
} | ||
|
||
} |
Oops, something went wrong.