43 lines
950 B
PHP
43 lines
950 B
PHP
<?php
|
|
|
|
class CreateStoreApi extends Api {
|
|
|
|
protected $methods = [
|
|
"POST" => [
|
|
[
|
|
"name" => "space_id",
|
|
"keyword" => "space_id",
|
|
"type" => VERIFY_STRING
|
|
],
|
|
[
|
|
"name" => "name",
|
|
"keyword" => "name",
|
|
"type" => VERIFY_STRING
|
|
]
|
|
]
|
|
];
|
|
|
|
/**
|
|
* @throws DatabaseException
|
|
*/
|
|
function execute(){
|
|
try {
|
|
$store = new PlanStore();
|
|
$store->space_id = $this->data['space_id'];
|
|
$store->name = $this->data['name'];
|
|
|
|
$this->result = $store->save();
|
|
|
|
$this->success = true;
|
|
$this->message = "OK";
|
|
}
|
|
catch (DatabaseException $e){
|
|
$this->success = false;
|
|
$this->message = "Error: " . $e;
|
|
}
|
|
}
|
|
}
|
|
|
|
$request = new CreateStoreApi();
|
|
|