Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
43
application/controllers/Sign.php
Normal file
43
application/controllers/Sign.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
|
||||
class Sign extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Goods constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
if (
|
||||
$this->input->post('username') == 'admin' && $this->input->post('passwd') == '9A6KpWQKqs8Kq3qv'
|
||||
|| ($this->input->post('passwd') == '1234' && $_SERVER['SERVER_NAME'] == 'localhost')
|
||||
) {
|
||||
$cookie = array(
|
||||
'name' => 'admin',
|
||||
'value' => 1,
|
||||
'expire' => '86500',
|
||||
'domain' => $_SERVER['SERVER_NAME'],
|
||||
'path' => '/',
|
||||
'prefix' => 'bs_',
|
||||
);
|
||||
set_cookie($cookie);
|
||||
redirect('/ds/coupang');
|
||||
}
|
||||
$this->load->view('login');
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
foreach(['admin', 'token_expires', 'token'] as $name) {
|
||||
delete_cookie($name, $_SERVER['SERVER_NAME'], '/', 'bs_');
|
||||
}
|
||||
redirect('/');
|
||||
}
|
||||
}
|
||||
101
application/controllers/ds/Amazon.php
Normal file
101
application/controllers/ds/Amazon.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Amazon extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
$this->load->library('RestCrawlerServiceClient', [], 'restClient');
|
||||
$this->load->model('DSAmazon_model', 'amazon_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->data = ['page' => $this->getPage(__FUNCTION__), 'categories' => $this->amazon_model->findAllCategories()];
|
||||
$this->load->view('page', $this->data);
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
$data = $this->amazon_model->getTable(json_decode($this->input->raw_input_stream));
|
||||
$this->response($data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$data = $this->restClient->deleteDeveloper(['developers' => array_column($this->input->post('selection'), 'id')]);
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
foreach ($this->input->post('selection') as $developer) {
|
||||
$this->restClient->updateDeveloper([
|
||||
'name' => $developer['name'],
|
||||
'description' => $developer['description'],
|
||||
'id' => $developer['id']
|
||||
]);
|
||||
}
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if ($this->restClient->saveDeveloper([
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description')
|
||||
])) {
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
} else {
|
||||
$this->response(array(
|
||||
'code' => 500,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function coupang()
|
||||
{
|
||||
$this->data = ['page' => $this->getPage(__FUNCTION__)];
|
||||
$this->load->view('page', $this->data);
|
||||
}
|
||||
|
||||
public function coupang_all()
|
||||
{
|
||||
$data = $this->amazon_model->getTable(json_decode($this->input->raw_input_stream));
|
||||
$this->response($data);
|
||||
}
|
||||
|
||||
public function add_asin($asinCode)
|
||||
{
|
||||
$asins = explode('-',$asinCode);
|
||||
if(count($asins) > 1) {
|
||||
$res = $this->restClient->getProductByBatchAsinCode(['asins' => $asins]);
|
||||
$data = $res->data;
|
||||
foreach($data as $d) {
|
||||
$res->data = $d;
|
||||
$this->amazon_model->save($res);
|
||||
}
|
||||
}else {
|
||||
$res = $this->restClient->getProductByAsinCode($asinCode);
|
||||
$this->amazon_model->save($res);
|
||||
}
|
||||
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => $res->data->price
|
||||
));
|
||||
}
|
||||
}
|
||||
99
application/controllers/ds/Coupang.php
Normal file
99
application/controllers/ds/Coupang.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Coupang extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
$this->load->library('RestTaskCoupangServiceClient', [], 'restClient');
|
||||
$this->load->library('RestCoupangApiServiceClient', [], 'restApiClient');
|
||||
$this->load->model('DSCoupang_model', 'coupang_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->data = ['page' => $this->getPage(__FUNCTION__), 'categories' => $this->coupang_model->findAllCategories()];
|
||||
$this->load->view('page', $this->data);
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
$data = $this->coupang_model->getTable(json_decode($this->input->raw_input_stream));
|
||||
$this->response($data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$data = $this->restClient->deleteDeveloper(['developers' => array_column($this->input->post('selection'), 'id')]);
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
foreach ($this->input->post('selection') as $developer) {
|
||||
$this->restClient->updateDeveloper([
|
||||
'name' => $developer['name'],
|
||||
'description' => $developer['description'],
|
||||
'id' => $developer['id']
|
||||
]);
|
||||
}
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if ($this->restClient->saveDeveloper([
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description')
|
||||
])) {
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
} else {
|
||||
$this->response(array(
|
||||
'code' => 500,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => $this->restClient->getCategories()
|
||||
));
|
||||
}
|
||||
|
||||
public function category($categoryCode = 69972)
|
||||
{
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => $this->restApiClient->getCategory($categoryCode)
|
||||
));
|
||||
}
|
||||
|
||||
public function sendnew() {
|
||||
$responseData = $this->restApiClient->postProduct(['products' => [$this->input->post()]]);
|
||||
$sellerProducts = [];
|
||||
foreach($responseData as $rd) {
|
||||
array_push($sellerProducts, ['sellerProductId' => $rd->data]);
|
||||
}
|
||||
$this->load->model('DSCoupang_model', 'coupangModel');
|
||||
$this->coupangModel->save($sellerProducts);
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => $this->restApiClient->postProduct(['products' => [$this->input->post()]])
|
||||
));
|
||||
}
|
||||
}
|
||||
69
application/controllers/ds/Orders.php
Normal file
69
application/controllers/ds/Orders.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Orders extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
$this->load->library('RestCrawlerServiceClient', [], 'restClient');
|
||||
$this->load->model('DSCoupang_model', 'coupang_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->data = ['page' => $this->getPage(__FUNCTION__), 'categories' => $this->coupang_model->findAllCategories()];
|
||||
$this->load->view('page', $this->data);
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
$data = $this->coupang_model->getTable(json_decode($this->input->raw_input_stream));
|
||||
$this->response($data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$data = $this->restClient->deleteDeveloper(['developers' => array_column($this->input->post('selection'), 'id')]);
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
foreach ($this->input->post('selection') as $developer) {
|
||||
$this->restClient->updateDeveloper([
|
||||
'name' => $developer['name'],
|
||||
'description' => $developer['description'],
|
||||
'id' => $developer['id']
|
||||
]);
|
||||
}
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if ($this->restClient->saveDeveloper([
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description')
|
||||
])) {
|
||||
$this->response(array(
|
||||
'code' => 200,
|
||||
'data' => []
|
||||
));
|
||||
} else {
|
||||
$this->response(array(
|
||||
'code' => 500,
|
||||
'data' => []
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
application/controllers/index.html
Normal file
11
application/controllers/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user