shoppingmallv2 init...
This commit is contained in:
parent
333e70fd1b
commit
a2e52037bc
@ -161,7 +161,7 @@ define('CATEGORY_ROLE_FIELDS', [
|
|||||||
'WRITE' => 'iswrite',
|
'WRITE' => 'iswrite',
|
||||||
'REPLY' => 'isreply',
|
'REPLY' => 'isreply',
|
||||||
'UPLOAD' => 'isupload',
|
'UPLOAD' => 'isupload',
|
||||||
'DOWNLOAD' => 'isdownload',
|
'DONWLOAD' => 'isdownload',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//인증 관련
|
//인증 관련
|
||||||
@ -183,7 +183,7 @@ define('AUTH_ADAPTERS', [
|
|||||||
define('PATHS', [
|
define('PATHS', [
|
||||||
'EXCEL' => WRITEPATH . "excel/",
|
'EXCEL' => WRITEPATH . "excel/",
|
||||||
'UPLOAD' => WRITEPATH . "uploads/",
|
'UPLOAD' => WRITEPATH . "uploads/",
|
||||||
'UPLOAD_PHOTO' => FCPATH . 'upload_images/',
|
'UPLOAD_IMAGE' => FCPATH . 'upload_images/',
|
||||||
'DOWNLOAD' => WRITEPATH . "download/",
|
'DOWNLOAD' => WRITEPATH . "download/",
|
||||||
'API' => WRITEPATH . "api/",
|
'API' => WRITEPATH . "api/",
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -42,8 +42,8 @@ $routes->get('/logout', 'AuthController::logout');
|
|||||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||||
});
|
});
|
||||||
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) {
|
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||||
$routes->post('/addCart', 'EcommerceController::addCart');
|
$routes->post('addCart', 'EcommerceController::addCart');
|
||||||
$routes->get('/cancelCart', 'EcommerceController::cancelCart');
|
$routes->get('cancelCart', 'EcommerceController::cancelCart');
|
||||||
});
|
});
|
||||||
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
||||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
||||||
|
|||||||
@ -42,8 +42,8 @@ $routes->get('/logout', 'AuthController::logout');
|
|||||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||||
});
|
});
|
||||||
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) {
|
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||||
$routes->post('/addCart', 'EcommerceController::addCart');
|
$routes->post('addCart', 'EcommerceController::addCart');
|
||||||
$routes->get('/cancelCart', 'EcommerceController::cancelCart');
|
$routes->get('cancelCart', 'EcommerceController::cancelCart');
|
||||||
});
|
});
|
||||||
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
||||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
||||||
@ -141,7 +141,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
|
|||||||
$routes->get('', 'ProductController::index');
|
$routes->get('', 'ProductController::index');
|
||||||
$routes->get('excel', 'ProductController::excel/$1');
|
$routes->get('excel', 'ProductController::excel/$1');
|
||||||
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
||||||
$routes->get('download/(:any)/(:uuid)', 'ProductController::download/$1/$2');
|
|
||||||
});
|
});
|
||||||
$routes->group('order', static function ($routes) {
|
$routes->group('order', static function ($routes) {
|
||||||
$routes->get('', 'OrderController::index');
|
$routes->get('', 'OrderController::index');
|
||||||
|
|||||||
@ -6,11 +6,11 @@ use App\Models\BoardModel;
|
|||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use App\Controllers\Trait\UploadTrait;
|
use App\Controllers\Trait\UpDownloadTrait;
|
||||||
|
|
||||||
class BoardController extends AdminController
|
class BoardController extends AdminController
|
||||||
{
|
{
|
||||||
use UploadTrait;
|
use UpDownloadTrait;
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->_model = new BoardModel();
|
$this->_model = new BoardModel();
|
||||||
|
|||||||
@ -6,11 +6,11 @@ use App\Models\ProductModel;
|
|||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use App\Controllers\Trait\UploadTrait;
|
use App\Controllers\Trait\UpDownloadTrait;
|
||||||
|
|
||||||
class ProductController extends AdminController
|
class ProductController extends AdminController
|
||||||
{
|
{
|
||||||
use UploadTrait;
|
use UpDownloadTrait;
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->_model = new ProductModel();
|
$this->_model = new ProductModel();
|
||||||
@ -20,11 +20,11 @@ class ProductController extends AdminController
|
|||||||
|
|
||||||
public function getFields(string $action = ""): array
|
public function getFields(string $action = ""): array
|
||||||
{
|
{
|
||||||
$fields = ["category_uid", 'name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "content",];
|
$fields = ["category_uid", 'name', "photo", "cost", "sale", "stock", "view_cnt", "status", "content",];
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case "index":
|
case "index":
|
||||||
case "excel":
|
case "excel":
|
||||||
return ["category_uid", "user_uid", 'name', "photo", "cost", "price", "sale", "stock", "view_cnt", "status", "created_at"];
|
return ["category_uid", "user_uid", 'name', "photo", "cost", "sale", "price", "stock", "view_cnt", "status", "created_at"];
|
||||||
break;
|
break;
|
||||||
case "view":
|
case "view":
|
||||||
return [...$fields, "created_at"];
|
return [...$fields, "created_at"];
|
||||||
@ -55,4 +55,19 @@ class ProductController extends AdminController
|
|||||||
}
|
}
|
||||||
return $this->_viewDatas['fieldDatas'];
|
return $this->_viewDatas['fieldDatas'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function insert_process()
|
||||||
|
{
|
||||||
|
if ($this->_viewDatas['fieldDatas']['cost'] < $this->_viewDatas['fieldDatas']['sale']) {
|
||||||
|
throw new \Exception(sprintf(
|
||||||
|
"%s가[%s] %s[%s]보다 작습니다.",
|
||||||
|
lang($this->_model->getClassName() . '.label.cost'),
|
||||||
|
number_format($this->_viewDatas['fieldDatas']['cost']),
|
||||||
|
lang($this->_model->getClassName() . '.label.sale'),
|
||||||
|
number_format($this->_viewDatas['fieldDatas']['sale']),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$this->_viewDatas['fieldDatas']['price'] = $this->_viewDatas['fieldDatas']['cost'] - $this->_viewDatas['fieldDatas']['sale'];
|
||||||
|
return parent::insert_process();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -582,11 +582,11 @@ abstract class BaseController extends Controller
|
|||||||
throw new \Exception("첨부파일이 확인되지 않습니다.");
|
throw new \Exception("첨부파일이 확인되지 않습니다.");
|
||||||
}
|
}
|
||||||
$entity = $this->download_process($entity);
|
$entity = $this->download_process($entity);
|
||||||
list($origin_filename, $filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
|
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
|
||||||
if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) {
|
if (!is_file(PATHS['UPLOAD'] . "/" . $uploaded_filename)) {
|
||||||
throw new \Exception("파일이 확인되지 않습니다.");
|
throw new \Exception("파일이 확인되지 않습니다.\n" . PATHS['UPLOAD'] . "/" . $uploaded_filename);
|
||||||
}
|
}
|
||||||
return $this->response->download(WRITEPATH . PATHS['UPLOAD'] . "/" . $filename, null)->setFileName(date("YmdHms") . '_' . $origin_filename);
|
return $this->response->download(PATHS['UPLOAD'] . "/" . $uploaded_filename, null)->setFileName(date("Ymd") . '_' . $filename);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
|
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class EcommerceController extends Controller
|
|||||||
throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->getStock()}개");
|
throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->getStock()}개");
|
||||||
}
|
}
|
||||||
//구매 금액 비교
|
//구매 금액 비교
|
||||||
$price = ($product->getPrice() - $product->getSale()) * $this->_viewDatas['fieldDatas']['quantity'];
|
$price = $product->getPrice() * $this->_viewDatas['fieldDatas']['quantity'];
|
||||||
if ($price != $this->_viewDatas['fieldDatas']['price']) {
|
if ($price != $this->_viewDatas['fieldDatas']['price']) {
|
||||||
throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다.");
|
throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class BoardController extends FrontController
|
|||||||
public function download_process($entity)
|
public function download_process($entity)
|
||||||
{
|
{
|
||||||
//권한체크
|
//권한체크
|
||||||
$this->isRole('download');
|
$this->isRole('download', $entity);
|
||||||
return $entity;
|
return parent::download_process($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class ProductController extends FrontController
|
|||||||
public function download_process($entity)
|
public function download_process($entity)
|
||||||
{
|
{
|
||||||
//권한체크
|
//권한체크
|
||||||
$this->isRole('download');
|
$this->isRole('download', $entity);
|
||||||
return $entity;
|
return parent::download_process($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,21 +4,21 @@ namespace App\Controllers\Trait;
|
|||||||
|
|
||||||
use CodeIgniter\HTTP\Files\UploadedFile;
|
use CodeIgniter\HTTP\Files\UploadedFile;
|
||||||
|
|
||||||
trait UploadTrait
|
trait UpDownloadTrait
|
||||||
{
|
{
|
||||||
//Upload FIle관련
|
//Upload FIle관련
|
||||||
private function upload_file_process(UploadedFile $upfile): string
|
private function upDownload_file_process(UploadedFile $upfile): string
|
||||||
{
|
{
|
||||||
$name = null;
|
|
||||||
$filename = null;
|
$filename = null;
|
||||||
|
$uploaded_filename = null;
|
||||||
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||||
$name = $upfile->getName();
|
|
||||||
$filename = $upfile->getRandomName();
|
|
||||||
$upfile->move(PATHS['UPLOAD'], $filename);
|
|
||||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
|
||||||
$filename = $upfile->getName();
|
$filename = $upfile->getName();
|
||||||
|
$uploaded_filename = $upfile->getRandomName();
|
||||||
|
$upfile->move(PATHS['UPLOAD'], $uploaded_filename);
|
||||||
|
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||||
|
$uploaded_filename = $upfile->getName();
|
||||||
}
|
}
|
||||||
return $name . DEFAULTS['DELIMITER_FILE'] . $filename;
|
return $filename . DEFAULTS['DELIMITER_FILE'] . $uploaded_filename;
|
||||||
}
|
}
|
||||||
public function upload_file_procedure(string $field): string
|
public function upload_file_procedure(string $field): string
|
||||||
{
|
{
|
||||||
@ -39,29 +39,29 @@ trait UploadTrait
|
|||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function image_resize_process(UploadedFile $upfile, $filename, $x = 25, $y = 25)
|
private function image_resize_process(UploadedFile $upfile, $uploaded_filename, $x = 25, $y = 25)
|
||||||
{
|
{
|
||||||
$image = \Config\Services::image();
|
$image = \Config\Services::image();
|
||||||
$image->withFile($upfile)
|
$image->withFile($upfile)
|
||||||
->resize($x, $y, true, 'height')
|
->resize($x, $y, true, 'height')
|
||||||
->save(PATHS['UPLOAD_PHOTO'] . $filename);
|
->save(PATHS['UPLOAD_IMAGE'] . $uploaded_filename);
|
||||||
}
|
}
|
||||||
private function upload_image_process(UploadedFile $upfile): string
|
private function upload_image_process(UploadedFile $upfile): string
|
||||||
{
|
{
|
||||||
//참고:https://www.positronx.io/codeigniter-resize-image-with-image-manipulation-tutorial/
|
//참고:https://www.positronx.io/codeigniter-resize-image-with-image-manipulation-tutorial/
|
||||||
$name = null;
|
|
||||||
$filename = null;
|
$filename = null;
|
||||||
|
$uploaded_filename = null;
|
||||||
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||||
$name = $upfile->getName();
|
|
||||||
$filename = $upfile->getRandomName();
|
|
||||||
$this->image_resize_process($upfile, "small_" . $filename);
|
|
||||||
$this->image_resize_process($upfile, "middle_" . $filename, 50, 50);
|
|
||||||
$this->image_resize_process($upfile, "large_" . $filename, 100, 100);
|
|
||||||
$upfile->move(PATHS['UPLOAD_PHOTO'], $filename);
|
|
||||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
|
||||||
$filename = $upfile->getName();
|
$filename = $upfile->getName();
|
||||||
|
$uploaded_filename = $upfile->getRandomName();
|
||||||
|
$this->image_resize_process($upfile, "small_" . $uploaded_filename);
|
||||||
|
$this->image_resize_process($upfile, "middle_" . $uploaded_filename, 50, 50);
|
||||||
|
$this->image_resize_process($upfile, "large_" . $uploaded_filename, 100, 100);
|
||||||
|
$upfile->move(PATHS['UPLOAD_IMAGE'], $uploaded_filename);
|
||||||
|
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||||
|
$uploaded_filename = $upfile->getName();
|
||||||
}
|
}
|
||||||
return $name . DEFAULTS['DELIMITER_FILE'] . $filename;
|
return $filename . DEFAULTS['DELIMITER_FILE'] . $uploaded_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upload_image_procedure(string $field): string
|
public function upload_image_procedure(string $field): string
|
||||||
@ -72,7 +72,7 @@ trait UploadTrait
|
|||||||
{
|
{
|
||||||
//Multiple파일의경우 html에서는 필드명[]를 넣어야하며
|
//Multiple파일의경우 html에서는 필드명[]를 넣어야하며
|
||||||
//rule에서 "uploaded[필드명.0]|is_image[필드명]~~" 이런식으로 넣어야함
|
//rule에서 "uploaded[필드명.0]|is_image[필드명]~~" 이런식으로 넣어야함
|
||||||
$names = array();
|
$filenames = array();
|
||||||
if ($upfiles = $this->request->getFiles()) {
|
if ($upfiles = $this->request->getFiles()) {
|
||||||
foreach ($upfiles[$field] as $upfile) {
|
foreach ($upfiles[$field] as $upfile) {
|
||||||
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||||
@ -80,6 +80,6 @@ trait UploadTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $names;
|
return $filenames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,4 +39,12 @@ class BoardEntity extends BaseHierarchyEntity
|
|||||||
{
|
{
|
||||||
return $this->attributes['view_cnt'];
|
return $this->attributes['view_cnt'];
|
||||||
}
|
}
|
||||||
|
public function getBoardFile()
|
||||||
|
{
|
||||||
|
return $this->attributes['board_file'];
|
||||||
|
}
|
||||||
|
public function getBoardFileName()
|
||||||
|
{
|
||||||
|
return explode(DEFAULTS['DELIMITER_FILE'], $this->getBoardFile())[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Entities;
|
namespace App\Entities;
|
||||||
|
|
||||||
|
use App\Entities\Trait\HierarchyTrait;
|
||||||
|
|
||||||
class CategoryEntity extends BaseHierarchyEntity
|
class CategoryEntity extends BaseHierarchyEntity
|
||||||
{
|
{
|
||||||
protected $datamap = [];
|
protected $datamap = [];
|
||||||
|
|||||||
@ -49,9 +49,8 @@ class ProductEntity extends BaseEntity
|
|||||||
}
|
}
|
||||||
public function getPhotoFileName($size = 'small')
|
public function getPhotoFileName($size = 'small')
|
||||||
{
|
{
|
||||||
return $size . '_' . explode(DEFAULTS['DELIMITER_FILE'], $this->attributes['photo'])[1];
|
return $size . '_' . explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
return $this->attributes['content'];
|
return $this->attributes['content'];
|
||||||
|
|||||||
@ -64,13 +64,14 @@ function getFieldView_BoardHelper($field, $entity, array $viewDatas)
|
|||||||
$value = $entity->$field ?: DEFAULTS['EMPTY'];
|
$value = $entity->$field ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'category_uid':
|
case 'category_uid':
|
||||||
$categorys = array();
|
foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depths) {
|
||||||
foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depth) {
|
foreach ($category_2depths as $key => $label) {
|
||||||
foreach ($category_2depth as $key => $label) {
|
if ($key == $value) {
|
||||||
$categorys[$key] = $label;
|
return $label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $categorys[$value];
|
return $value;
|
||||||
break;
|
break;
|
||||||
case 'title':
|
case 'title':
|
||||||
case 'name':
|
case 'name':
|
||||||
|
|||||||
@ -69,6 +69,16 @@ function getFieldView_ProductHelper($field, $entity, array $viewDatas)
|
|||||||
{
|
{
|
||||||
$value = $entity->$field ?: DEFAULTS['EMPTY'];
|
$value = $entity->$field ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
|
case 'category_uid':
|
||||||
|
foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depths) {
|
||||||
|
foreach ($category_2depths as $key => $label) {
|
||||||
|
if ($key == $value) {
|
||||||
|
return $label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
break;
|
||||||
case 'title':
|
case 'title':
|
||||||
case 'name':
|
case 'name':
|
||||||
return anchor(
|
return anchor(
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class BoardModel extends BaseHierarchyModel
|
|||||||
$rules[$field] = "required|string";
|
$rules[$field] = "required|string";
|
||||||
break;
|
break;
|
||||||
case "board_file": //uploaded[{$field}] == requried와 같은의미
|
case "board_file": //uploaded[{$field}] == requried와 같은의미
|
||||||
$rules[$field] = !$action ? "if_exist|string" : "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},100]|max_dims[{$field},1024,768]";
|
$rules[$field] = "if_exist|string";
|
||||||
break;
|
break;
|
||||||
case "view_cnt":
|
case "view_cnt":
|
||||||
$rules[$field] = "if_exist|numeric";
|
$rules[$field] = "if_exist|numeric";
|
||||||
|
|||||||
@ -41,15 +41,13 @@ class ProductModel extends BaseModel
|
|||||||
$rules[$field] = "required|trim|string";
|
$rules[$field] = "required|trim|string";
|
||||||
break;
|
break;
|
||||||
case 'photo':
|
case 'photo':
|
||||||
$rules[$field] = !$action ? "if_exist|string" : "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},100]|max_dims[{$field},1024,768]";
|
$rules[$field] = !$action ? "if_exist|string" : "uploaded[$field]|is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},100]|max_dims[{$field},1024,768]";
|
||||||
break;
|
break;
|
||||||
case 'cost':
|
case 'cost':
|
||||||
case 'price':
|
case 'price':
|
||||||
$rules[$field] = "required|numeric";
|
|
||||||
break;
|
|
||||||
case 'sale':
|
case 'sale':
|
||||||
case 'stock':
|
case 'stock':
|
||||||
$rules[$field] = "if_exist|numeric";
|
$rules[$field] = "required|numeric";
|
||||||
break;
|
break;
|
||||||
case "content":
|
case "content":
|
||||||
$rules[$field] = "required|string";
|
$rules[$field] = "required|string";
|
||||||
|
|||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<table class="form table table-bordered table-hover table-striped">
|
<table class="form table table-bordered table-hover table-striped">
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||||
@ -16,6 +16,6 @@
|
|||||||
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?= form_close(); ?>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?= $this->extend('layouts/admin') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<table class="form table table-bordered table-hover table-striped">
|
<table class="form table table-bordered table-hover table-striped">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user