c
This commit is contained in:
42
inc/Hura8/Interfaces/APIResponse.php
Normal file
42
inc/Hura8/Interfaces/APIResponse.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2021. www.Hura.vn
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
class APIResponse
|
||||
{
|
||||
private $errCode = 0;
|
||||
private $msg = '';
|
||||
private $data;
|
||||
|
||||
public function __construct($errCode = 0, $msg = '', $data = null) {
|
||||
$this->errCode = $errCode;
|
||||
$this->msg = $msg;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCode() {
|
||||
return $this->errCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed if status = 'error'
|
||||
*/
|
||||
public function getMsg() {
|
||||
return $this->msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed if status = 'ok'
|
||||
*/
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
}
|
||||
41
inc/Hura8/Interfaces/AppResponse.php
Normal file
41
inc/Hura8/Interfaces/AppResponse.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
class AppResponse
|
||||
{
|
||||
const SUCCESS = 'ok';
|
||||
const ERROR = 'error';
|
||||
|
||||
protected $status;
|
||||
protected $msg = null;
|
||||
protected $data;
|
||||
|
||||
public function __construct($status = 'ok', $msg = null, $data = null) {
|
||||
$this->status = $status;
|
||||
$this->msg = $msg;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string which is 'ok' or 'error'
|
||||
*/
|
||||
public function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed if status = 'error'
|
||||
*/
|
||||
public function getMsg() {
|
||||
return $this->msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed if status = 'ok'
|
||||
*/
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
}
|
||||
151
inc/Hura8/Interfaces/EntityType.php
Normal file
151
inc/Hura8/Interfaces/EntityType.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
/**
|
||||
* Contain all entity types of this apps
|
||||
*
|
||||
* Dynamic Resolution Rules:
|
||||
* - Format: entity_type = [parent_type]-[sub_type]
|
||||
* Examples:
|
||||
* + product: Product Entity
|
||||
* + product-category: [Product parent-Entity]-[Product Category sub-Entity]
|
||||
* + user-comment-reply: [user parent-Entity]-[user comment sub-Entity]-[user comment reply sub-Entity]
|
||||
*
|
||||
* - Model Resolution: EntityModel is auto inferred from entity name: EntityModel = Hura8\Components\[parent_type]\Model\[entity-name-upper first char]Model
|
||||
* Examples:
|
||||
* + product: Hura8\Components\Product\Model\ProductModel
|
||||
* + product-category: Hura8\Components\Product\Model\ProductCategoryModel
|
||||
* + user-comment: Hura8\Components\User\Model\UserCommentModel
|
||||
* + user-comment-reply: Hura8\Components\User\Model\UserCommentReplyModel
|
||||
*
|
||||
* - Controller Resolution: similar to the Model
|
||||
* Examples: public controllers
|
||||
* + product: Hura8\Components\Product\PublicController\UProductController
|
||||
* + product-category: Hura8\Components\Product\PublicController\UProductCategoryController
|
||||
* + user-comment: Hura8\Components\User\PublicController\UUserCommentController
|
||||
* + user-comment-reply: Hura8\Components\User\PublicController\UUserCommentReplyController
|
||||
*
|
||||
* Examples: admin controllers
|
||||
* + product: Hura8\Components\Product\AdminController\AProductController
|
||||
* + product-category: Hura8\Components\Product\AdminController\AProductCategoryController
|
||||
* + user-comment: Hura8\Components\User\AdminController\AUserCommentController
|
||||
* + user-comment-reply: Hura8\Components\User\AdminController\AUserCommentReplyController
|
||||
*
|
||||
*/
|
||||
|
||||
final class EntityType
|
||||
{
|
||||
/**
|
||||
* - Model Resolution: EntityModel is auto inferred from entity name: EntityModel = Hura8\Components\[parent_type]\Model\[entity-name-upper first char]Model
|
||||
* Examples:
|
||||
* + product: Hura8\Components\Product\Model\ProductModel
|
||||
* + product-category: Hura8\Components\Product\Model\ProductCategoryModel
|
||||
* + user-comment: Hura8\Components\User\Model\UserCommentModel
|
||||
* + user-comment-reply: Hura8\Components\User\Model\UserCommentReplyModel
|
||||
*/
|
||||
public static function getModelClass(string $entity_type): string {
|
||||
$parts = array_map(function ($word){
|
||||
return ucfirst($word);
|
||||
}, explode("-", $entity_type));
|
||||
|
||||
$parent = $parts[0];
|
||||
|
||||
return "\\Hura8\\Components\\".$parent."\\Model\\".join("", $parts)."Model";
|
||||
}
|
||||
|
||||
|
||||
public static function getStatisticModelClass(string $entity_type): string {
|
||||
$parts = array_map(function ($word){
|
||||
return ucfirst($word);
|
||||
}, explode("-", $entity_type));
|
||||
|
||||
$parent = $parts[0];
|
||||
|
||||
return "\\Hura8\\Components\\".$parent."\\Model\\".join("", $parts)."StatisticModel";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* - Controller Resolution: similar to the Model
|
||||
* Examples: public controllers
|
||||
* + product: Hura8\Components\Product\PublicController\UProductController
|
||||
* + product-category: Hura8\Components\Product\PublicController\UProductCategoryController
|
||||
* + user-comment: Hura8\Components\User\PublicController\UUserCommentController
|
||||
* + user-comment-reply: Hura8\Components\User\PublicController\UUserCommentReplyController
|
||||
* */
|
||||
public static function getControllerClass(string $entity_type, $controller_type='public'): string {
|
||||
$parts = array_map(function ($word){
|
||||
return ucfirst($word);
|
||||
}, explode("-", $entity_type));
|
||||
|
||||
$parent = $parts[0];
|
||||
|
||||
// Hura8\Components\Product\PublicController\UProductCategoryController
|
||||
if($controller_type == 'public') {
|
||||
return "\\Hura8\\Components\\".$parent."\\PublicController\\U".join("", $parts)."Controller";
|
||||
}
|
||||
|
||||
// Hura8\Components\Product\AdminController\AProductCategoryController
|
||||
return "\\Hura8\\Components\\".$parent."\\AdminController\\A".join("", $parts)."Controller";
|
||||
}
|
||||
|
||||
|
||||
// system's entities
|
||||
const PRODUCT = 'product';
|
||||
const PRODUCT_CATEGORY = 'product-category';
|
||||
const PRODUCT_COLLECTION = 'collection';
|
||||
|
||||
const PRODUCT_ATTRIBUTE = 'attribute';
|
||||
const PRODUCT_ATTRIBUTE_VALUE = 'attribute-value';
|
||||
|
||||
const COUPON = 'coupon';
|
||||
|
||||
const ORDER = 'order';
|
||||
|
||||
const ARTICLE = 'article';
|
||||
const ARTICLE_CATEGORY = 'article-category';
|
||||
|
||||
const BANNER = 'banner';
|
||||
const BANNER_LOCATION = 'banner-location';
|
||||
|
||||
const CUSTOMER = 'customer'; // registered customers
|
||||
|
||||
const USER = 'user'; // all users, include customers
|
||||
const USER_CONTACT = 'user-contact';
|
||||
const USER_COMMENT = 'user-comment';
|
||||
const USER_COMMENT_REPLY = 'user-comment-reply';
|
||||
|
||||
const BRAND = 'brand';
|
||||
const DEAL = 'deal';
|
||||
const MEDIA = 'media';
|
||||
const TAG = 'tag';
|
||||
const URL = 'url';
|
||||
const COMBO_SET = 'combo-set';
|
||||
|
||||
const PAGE = 'page';
|
||||
const PAGE_CATEGORY = 'page-category';
|
||||
|
||||
const ALBUM = 'album';
|
||||
const ALBUM_CATEGORY = 'album-category';
|
||||
const ALBUM_PHOTO = 'album-photo';
|
||||
|
||||
const PROVINCE = 'province';
|
||||
|
||||
const PROMOTION = 'promotion';
|
||||
const PROMOTION_GROUP = 'promotion-group';
|
||||
const DISTRIBUTOR = 'distributor';
|
||||
|
||||
const WARRANTY = 'warranty';
|
||||
|
||||
const STAFF = 'staff'; // admin web
|
||||
|
||||
const VIDEO = 'video';
|
||||
const VIDEO_CATEGORY = 'video-category';
|
||||
|
||||
const JOB = 'job';
|
||||
const JOB_CATEGORY = 'job-category';
|
||||
|
||||
const DOMAIN = 'domain';
|
||||
|
||||
}
|
||||
43
inc/Hura8/Interfaces/FileHandleInfo.php
Normal file
43
inc/Hura8/Interfaces/FileHandleInfo.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
class FileHandleInfo
|
||||
{
|
||||
|
||||
public $file_name;
|
||||
public $public_path;
|
||||
public $local_path;
|
||||
public $mime_type;
|
||||
public $file_size;
|
||||
public $file_ext;
|
||||
public $width = 0;
|
||||
public $height = 0;
|
||||
|
||||
|
||||
public function __construct(array $file_info = []) {
|
||||
/*$file_info = [
|
||||
"file_name" => $clean_file_name,
|
||||
"public_path" => $this->public_dir . "/".$clean_file_name,
|
||||
"local_path" => $this->target_dir . "/" . $clean_file_name,
|
||||
"mime_type" => $mimeType,
|
||||
"file_size" => $file_size,
|
||||
"file_ext" => $file_ext,
|
||||
"width" => 0,
|
||||
"height" => 0,
|
||||
];*/
|
||||
|
||||
$this->file_name = $file_info['file_name'] ?? '' ;
|
||||
$this->public_path = $file_info['public_path'] ?? '' ;
|
||||
$this->local_path = $file_info['local_path'] ?? '' ;
|
||||
$this->mime_type = $file_info['mime_type'] ?? '' ;
|
||||
$this->file_size = $file_info['file_size'] ?? 0 ;
|
||||
$this->file_ext = $file_info['file_ext'] ?? '' ;
|
||||
$this->width = $file_info['width'] ?? 0 ;
|
||||
$this->height = $file_info['height'] ?? 0 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
19
inc/Hura8/Interfaces/FileHandleResponse.php
Normal file
19
inc/Hura8/Interfaces/FileHandleResponse.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
class FileHandleResponse extends AppResponse
|
||||
{
|
||||
public function __construct($status = 'ok', $msg = null, ?FileHandleInfo $data = null) {
|
||||
parent::__construct($status, $msg, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?FileHandleInfo
|
||||
*/
|
||||
public function getData() : ?FileHandleInfo {
|
||||
return parent::getData();
|
||||
}
|
||||
}
|
||||
11
inc/Hura8/Interfaces/PermissionRole.php
Normal file
11
inc/Hura8/Interfaces/PermissionRole.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
class PermissionRole
|
||||
{
|
||||
const OWNER = 'owner';
|
||||
const ADMIN = 'admin';
|
||||
const EDITOR = 'editor';
|
||||
const VIEWER = 'viewer';
|
||||
}
|
||||
13
inc/Hura8/Interfaces/PermissionType.php
Normal file
13
inc/Hura8/Interfaces/PermissionType.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
class PermissionType
|
||||
{
|
||||
const VIEW = 'view';
|
||||
const CREATE = 'create';
|
||||
const DELETE = 'delete';
|
||||
const UPDATE = 'update';
|
||||
const APPROVE = 'approve';
|
||||
const LOCK = 'lock';
|
||||
}
|
||||
97
inc/Hura8/Interfaces/TableName.php
Normal file
97
inc/Hura8/Interfaces/TableName.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
final class TableName
|
||||
{
|
||||
|
||||
const COLLECT_FORM = 'tb_collect_form';
|
||||
const COLLECT_FORM_FILTER = 'tb_collect_form_filter';
|
||||
|
||||
const TEMPLATE = "tb_template";
|
||||
const TEMPLATE_SET = 'tb_template_set';
|
||||
const TEMPLATE_HISTORY = "tb_template_history";
|
||||
|
||||
const MEDIA = 'tb_media_upload';
|
||||
|
||||
const COMMENT = "tb_user_comment";
|
||||
const COMMENT_REPLY = "tb_user_comment_reply";
|
||||
|
||||
const PRODUCT = 'tb_product';
|
||||
const PRODUCT_INFO = 'tb_product_info';
|
||||
const PRODUCT_CATEGORY = 'tb_product_category';
|
||||
const PRODUCT_CATEGORY_INFO = 'tb_product_category_info';
|
||||
const PRODUCT_PER_CATEGORY = 'tb_product_per_category';
|
||||
|
||||
const PRODUCT_VARIANT = 'tb_product_variant';
|
||||
const PRODUCT_IMAGE_NAME = 'tb_product_image';
|
||||
const PRODUCT_IMAGE_STOCK = 'tb_product_image_stock';
|
||||
const PRODUCT_ACCESSORY = 'tb_product_accessory';
|
||||
const PRODUCT_HOT = 'tb_product_hot';
|
||||
const PRODUCT_COLLECTION = 'tb_collection';
|
||||
const PRODUCT_PER_COLLECTION = 'tb_collection_product';
|
||||
const PRODUCT_FILTER = 'tb_product_filter';
|
||||
const PRODUCT_PER_ATTRIBUTE = 'tb_product_attribute';
|
||||
|
||||
|
||||
const ATTRIBUTE = 'tb_attribute';
|
||||
const ATTRIBUTE_INFO = 'tb_attribute_info';
|
||||
const ATTRIBUTE_CATEGORY = 'tb_attribute_category';
|
||||
const ATTRIBUTE_VALUE = 'tb_attribute_value';
|
||||
|
||||
const ARTICLE = 'tb_article';
|
||||
const ARTICLE_COMMENT = 'tb_article_comment';
|
||||
const ARTICLE_CATEGORY = 'tb_article_category';
|
||||
const ARTICLE_INFO = 'tb_article_info';
|
||||
const ARTICLE_PER_CATEGORY = 'tb_article_per_category';
|
||||
const ARTICLE_IMAGE = 'tb_article_image';
|
||||
|
||||
const BRAND = 'tb_brand';
|
||||
|
||||
const COUPON = 'tb_coupon';
|
||||
const COUPON_USE = 'tb_coupon_use';
|
||||
|
||||
const DEAL = 'tb_deal';
|
||||
const DEAL_CONTENT = 'tb_deal_content';
|
||||
|
||||
const COMBO_DEAL = 'tb_combo_deal';
|
||||
const COMBO_DEAL_DETAIL = 'tb_combo_deal_detail';
|
||||
|
||||
const ORDER = 'tb_order';
|
||||
const ORDER_ITEM = 'tb_order_detail_new';
|
||||
|
||||
const CUSTOMER_POINT = "tb_customer_point";
|
||||
const CUSTOMER = "tb_customer";
|
||||
const CUSTOMER_GROUP = "tb_customer_group";
|
||||
const CUSTOMER_PER_GROUP = 'tb_customer_group_list';
|
||||
const CUSTOMER_ADDRESS = "tb_customer_address";
|
||||
|
||||
const CUSTOMER_UPLOAD = 'tb_user_upload';
|
||||
const CUSTOMER_LIKE = 'tb_user_like';
|
||||
const CUSTOMER_PREFERENCE = "tb_user_preference";
|
||||
const CUSTOMER_CONTACT = "tb_customer_contact";
|
||||
|
||||
const WEB_USER = "tb_web_user_info";
|
||||
|
||||
const PAYGATE = 'tb_paygate';
|
||||
const PAY_METHOD = 'tb_pay_method';
|
||||
const SHIP_METHOD = 'tb_shipping_method';
|
||||
|
||||
const REPORT_VISIT_SUMMARY = 'tb_visit_summary';
|
||||
const REPORT_ERROR_PAGE = 'tb_report_error_page';
|
||||
const REPORT_REFERER_DOMAIN = 'tb_visit_referer_domain';
|
||||
const REPORT_REFERER_SUMMARY = 'tb_visit_referer_summary';
|
||||
|
||||
const PROVINCE = "tb_province_list";
|
||||
const PROVINCE_DISTRICT = "tb_province_district_list";
|
||||
const PROVINCE_WARD = "tb_province_ward_list";
|
||||
|
||||
const DOMAIN = 'tb_domain';
|
||||
const URL = 'tb_url';
|
||||
const URL_META = 'tb_url_meta';
|
||||
|
||||
const STAFF = "tb_staff";
|
||||
const DEPARTMENT = 'tb_department';
|
||||
const STAFF_LOG = "tb_staff_log";
|
||||
|
||||
}
|
||||
37
inc/Hura8/Interfaces/iClientERP.php
Normal file
37
inc/Hura8/Interfaces/iClientERP.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* Description: interface to work with our clients
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iClientERP
|
||||
{
|
||||
public function createOrder(array $order_info) ;
|
||||
|
||||
/**
|
||||
* get log data
|
||||
*/
|
||||
public function getLog($type, $limit = 50);
|
||||
|
||||
/**
|
||||
* log data
|
||||
*/
|
||||
public function log($type, array $data);
|
||||
|
||||
/**
|
||||
* @description: clean any existing data before populate new ones
|
||||
*/
|
||||
public function cleanExistingData();
|
||||
|
||||
// get summary of products in the system
|
||||
public function getProductSummary();
|
||||
|
||||
// save product from erp to tmp tables
|
||||
public function saveProductToWeb(array $erp_product_list);
|
||||
|
||||
// start sync tmp tables to actual tables
|
||||
public function syncProductToWeb(array $options = []);
|
||||
}
|
||||
10
inc/Hura8/Interfaces/iCustomUrlBuilder.php
Normal file
10
inc/Hura8/Interfaces/iCustomUrlBuilder.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iCustomUrlBuilder
|
||||
{
|
||||
public function productUrl($product_id, array $input = []);
|
||||
public function productCategoryUrl($category_id, array $input = []);
|
||||
public function articleUrl($article_id, array $input = []);
|
||||
}
|
||||
13
inc/Hura8/Interfaces/iERPProvider.php
Normal file
13
inc/Hura8/Interfaces/iERPProvider.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
/**
|
||||
* This interface must be implemented by all erp providers as in package/provider/Provider/ERPProviders
|
||||
*/
|
||||
interface iERPProvider
|
||||
{
|
||||
public function createOrder(array $order_info);
|
||||
public function getProductList(array $options = [], $debug=false);
|
||||
public function getProductSummary(array $options = [], $debug=false);
|
||||
}
|
||||
20
inc/Hura8/Interfaces/iEmail.php
Normal file
20
inc/Hura8/Interfaces/iEmail.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 14-Jul-19
|
||||
* Time: 3:21 PM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iEmail
|
||||
{
|
||||
// setup
|
||||
public function setUp(array $config);
|
||||
|
||||
// send email
|
||||
public function send(array $to_emails, $subject, $content);
|
||||
}
|
||||
9
inc/Hura8/Interfaces/iEntityAdminCategoryController.php
Normal file
9
inc/Hura8/Interfaces/iEntityAdminCategoryController.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityAdminCategoryController extends iEntityCategoryController, iEntityAdminController
|
||||
{
|
||||
public function getDropBox($selectedId, $categoryParentId, $level=1);
|
||||
public function categorySelectBox(array $array_selected, $categoryParentId, $level=1);
|
||||
}
|
||||
11
inc/Hura8/Interfaces/iEntityAdminController.php
Normal file
11
inc/Hura8/Interfaces/iEntityAdminController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityAdminController extends iEntityController
|
||||
{
|
||||
public function create(array $info) : AppResponse;
|
||||
public function update($id, array $info) : AppResponse;
|
||||
public function delete($id) : AppResponse;
|
||||
public function getEmptyInfo(array $additional_fields = []): array;
|
||||
}
|
||||
9
inc/Hura8/Interfaces/iEntityCategoryController.php
Normal file
9
inc/Hura8/Interfaces/iEntityCategoryController.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityCategoryController extends iEntityController
|
||||
{
|
||||
public function getAllParent(array $condition = []);
|
||||
public function getNestedCategories($is_public = false);
|
||||
}
|
||||
8
inc/Hura8/Interfaces/iEntityCategoryModel.php
Normal file
8
inc/Hura8/Interfaces/iEntityCategoryModel.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityCategoryModel extends iEntityModel
|
||||
{
|
||||
public function getAllByParent(array $condition = array()): array;
|
||||
}
|
||||
26
inc/Hura8/Interfaces/iEntityController.php
Normal file
26
inc/Hura8/Interfaces/iEntityController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityController
|
||||
{
|
||||
public function getListByIds(array $list_id, array $condition = array()): array;
|
||||
|
||||
/**
|
||||
* @description utility to inspect the actual filters which will be used in getList by Controller
|
||||
* @param array $raw_filter_condition
|
||||
* @return string[]
|
||||
*/
|
||||
public function getActualFilterCondition(array $raw_filter_condition) : array;
|
||||
|
||||
/**
|
||||
* @description utility to inspect the actual filters which will be used in getList by Model
|
||||
* @param array $raw_filter_condition
|
||||
* @return string[]
|
||||
*/
|
||||
public function getModelFilterCondition(array $raw_filter_condition) : array;
|
||||
|
||||
public function getList(array $condition): array;
|
||||
public function getTotal(array $condition): int;
|
||||
public function getInfo($id): ?array;
|
||||
}
|
||||
38
inc/Hura8/Interfaces/iEntityLanguageModel.php
Normal file
38
inc/Hura8/Interfaces/iEntityLanguageModel.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityLanguageModel
|
||||
{
|
||||
// create a necessary language table to hold the translated data for the language
|
||||
public function createTableLang(): AppResponse;
|
||||
|
||||
public function setLanguage(string $language): bool;
|
||||
|
||||
// any fields to have language: title, summary, description, price, etc...
|
||||
public function setLanguageFields(array $language_fields);
|
||||
|
||||
public function getLanguageFields() : array ;
|
||||
|
||||
public function getEntityType() : string ;
|
||||
|
||||
public function update($id, array $new_input_info, $search_keyword = "") : AppResponse;
|
||||
|
||||
public function deleteAll($id): AppResponse;
|
||||
|
||||
public function delete($id): AppResponse;
|
||||
|
||||
public function getListByIds(array $list_id): array;
|
||||
|
||||
// get list of ids which are in the language table. This is to filter which records have been translated and which not in the main table
|
||||
// this is limited to 50k items. Which means for item_type having more than 50k records, this checking method is not suitable
|
||||
public function getTranslatedIds() : array;
|
||||
|
||||
public function getInfo($id): ?array;
|
||||
|
||||
public function getTotal(array $condition): int;
|
||||
|
||||
// get empty/default item for form
|
||||
public function getEmptyInfo(): array;
|
||||
|
||||
}
|
||||
14
inc/Hura8/Interfaces/iEntityModel.php
Normal file
14
inc/Hura8/Interfaces/iEntityModel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityModel
|
||||
{
|
||||
public function getEntityType() : string ;
|
||||
public function getListByIds(array $list_id, array $condition = array()) : array;
|
||||
public function getList(array $condition) : array;
|
||||
public function getTotal(array $condition) : int;
|
||||
public function getQueryCondition(array $condition) : array;
|
||||
public function getInfo($id): ?array;
|
||||
public function getEmptyInfo(array $additional_fields = []): array;
|
||||
}
|
||||
12
inc/Hura8/Interfaces/iEntityPermission.php
Normal file
12
inc/Hura8/Interfaces/iEntityPermission.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityPermission
|
||||
{
|
||||
public function canCreate(): bool;
|
||||
public function canUpdate(): bool;
|
||||
public function canDelete(): bool;
|
||||
public function canView(): bool;
|
||||
public function canApprove(): bool;
|
||||
}
|
||||
22
inc/Hura8/Interfaces/iEntityStatistic.php
Normal file
22
inc/Hura8/Interfaces/iEntityStatistic.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iEntityStatistic
|
||||
{
|
||||
// get data
|
||||
public function getListComment(array $condition): array;
|
||||
public function getTotalComment(array $condition) : int;
|
||||
public function getInfoComment($id): ?array;
|
||||
|
||||
public function getListReview(array $condition): array;
|
||||
public function getTotalReview(array $condition) : int;
|
||||
public function getInfoReview($id): ?array;
|
||||
|
||||
// update from public
|
||||
public function updateCommentCount($id, int $total=0, int $avg_rate=0): AppResponse;
|
||||
public function updateReviewCount($id, int $total=0, int $avg_rate=0): AppResponse;
|
||||
public function updateVisitCount($id, int $total): AppResponse;
|
||||
public function updateLikeCount($id, int $total): AppResponse;
|
||||
public function updateSaveCount($id, int $total): AppResponse;
|
||||
}
|
||||
20
inc/Hura8/Interfaces/iExcelDownload.php
Normal file
20
inc/Hura8/Interfaces/iExcelDownload.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 25-Apr-19
|
||||
* Time: 11:16 AM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iExcelDownload
|
||||
{
|
||||
/**
|
||||
* @param array $options
|
||||
* @return mixed
|
||||
*/
|
||||
public function start(array $options);
|
||||
}
|
||||
38
inc/Hura8/Interfaces/iPayGate.php
Normal file
38
inc/Hura8/Interfaces/iPayGate.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 19-Jun-19
|
||||
* Time: 1:29 PM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iPayGate
|
||||
{
|
||||
// create an pay url to redirect users from website to the payment gateway's site
|
||||
public function createPayUrl(array $config);
|
||||
|
||||
// process the result return by paygate
|
||||
//public function processPayResult();
|
||||
|
||||
/**
|
||||
* create payid to sent to vnpay and also track in the system. One order can be paid by multiple installments
|
||||
*
|
||||
* @param $item_type string 'order', 'wait-order',
|
||||
* @param $item_id int id of order
|
||||
* @param $expected_amount int the amount to pay in this payment
|
||||
* @param $description string
|
||||
* @param $user_info array
|
||||
* @return int
|
||||
*/
|
||||
public function createPayId($item_type, $item_id, $expected_amount, $description, array $user_info);
|
||||
|
||||
// process the webhook sent by paygate's server
|
||||
public function processWebhook();
|
||||
|
||||
// get list of supported banks
|
||||
//public function getBankList();
|
||||
}
|
||||
22
inc/Hura8/Interfaces/iPricing.php
Normal file
22
inc/Hura8/Interfaces/iPricing.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 18-Jan-19
|
||||
* Time: 11:03 AM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
use Hura8\User\UProduct;
|
||||
|
||||
interface iPricing
|
||||
{
|
||||
// apply for a list of items and return modified list
|
||||
public function applyForList(array $item_list, UProduct $objUProduct);
|
||||
|
||||
// apply for a item and return modified item
|
||||
public function applyForItem(array $item_info, UProduct $objUProduct);
|
||||
}
|
||||
26
inc/Hura8/Interfaces/iProductPromotionProgram.php
Normal file
26
inc/Hura8/Interfaces/iProductPromotionProgram.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 28-Jun-19
|
||||
* Time: 3:26 PM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iProductPromotionProgram
|
||||
{
|
||||
public function activate($id, $status);
|
||||
|
||||
public function updateSetting($id, array $settings);
|
||||
|
||||
public function updateProductSetting($program_id, $product_id, array $settings);
|
||||
|
||||
public function addProduct($program_id, $product_id, array $settings);
|
||||
|
||||
public function removeProduct($program_id, $product_id);
|
||||
|
||||
public function getProductList($program_id);
|
||||
}
|
||||
12
inc/Hura8/Interfaces/iPublicEntityController.php
Normal file
12
inc/Hura8/Interfaces/iPublicEntityController.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iPublicEntityController
|
||||
{
|
||||
// get data
|
||||
public function getListByIds(array $list_id, array $condition = array()): array;
|
||||
public function getList(array $condition): array;
|
||||
public function getTotal(array $condition) : int;
|
||||
public function getInfo($id): ?array;
|
||||
}
|
||||
16
inc/Hura8/Interfaces/iSMS.php
Normal file
16
inc/Hura8/Interfaces/iSMS.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Glee Ltd.
|
||||
* User: Hieu
|
||||
* Date: 10-Oct-18
|
||||
* Time: 11:24 AM
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iSMS
|
||||
{
|
||||
public function send($mobile, $content, $debug = false);
|
||||
}
|
||||
54
inc/Hura8/Interfaces/iSearch.php
Normal file
54
inc/Hura8/Interfaces/iSearch.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iSearch
|
||||
{
|
||||
/**
|
||||
* @description get filter fields
|
||||
* @param array[string]
|
||||
*/
|
||||
public function getFilterFields(): array;
|
||||
|
||||
/**
|
||||
* @description get fulltext fields
|
||||
* @param array[string]
|
||||
*/
|
||||
public function getFulltextFields(): array;
|
||||
|
||||
/**
|
||||
* @description update or create item if not exist
|
||||
* @param $item_id
|
||||
* @param array $table_field_values
|
||||
$table_field_values = [
|
||||
"tb_product.price" => 2000000,
|
||||
"tb_product.title" => "Máy tính ABC",
|
||||
"tb_category.price" => "Máy tính",
|
||||
];
|
||||
* @return bool
|
||||
*/
|
||||
public function updateItem($item_id, array $table_field_values = []): AppResponse;
|
||||
|
||||
/**
|
||||
* @description delete item from index
|
||||
* @param $item_id
|
||||
*/
|
||||
public function deleteItem($item_id): AppResponse;
|
||||
|
||||
/**
|
||||
* @description delete items from index
|
||||
* @param $item_list_ids
|
||||
*/
|
||||
public function deleteItems(array $item_list_ids): AppResponse;
|
||||
|
||||
/**
|
||||
* @param string $keyword
|
||||
* @param array $field_filters
|
||||
* @param array $fulltext_fields
|
||||
* @param int $limit_result
|
||||
* @return array[int]
|
||||
*/
|
||||
public function find(string $keyword, array $field_filters = [], array $fulltext_fields = [], int $limit_result = 2000) : array;
|
||||
|
||||
}
|
||||
15
inc/Hura8/Interfaces/iShippingCost.php
Normal file
15
inc/Hura8/Interfaces/iShippingCost.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
|
||||
interface iShippingCost extends iShippingProvider
|
||||
{
|
||||
// get only options for a cart
|
||||
public function getShippingOptionsForCart(array $cart_item_list, $province, $district, $ward=0) : array;
|
||||
|
||||
// return array [shipping_fee, cod_fee]
|
||||
public function calculateShippingCostForOrder($selected_shipping_option, array $shipping_address, array $order_info) ;
|
||||
|
||||
}
|
||||
13
inc/Hura8/Interfaces/iShippingProvider.php
Normal file
13
inc/Hura8/Interfaces/iShippingProvider.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iShippingProvider
|
||||
{
|
||||
// get all available shipping options, which might or might not be suitable for an order
|
||||
public function getAllShippingOptions(array $args) : array;
|
||||
|
||||
// get only options for a specific order (based on order's value, shipping address ...) as suggested by the shipping provider
|
||||
public function getShippingOptions(array $args) : array;
|
||||
|
||||
}
|
||||
11
inc/Hura8/Interfaces/iSyncWebErpProduct.php
Normal file
11
inc/Hura8/Interfaces/iSyncWebErpProduct.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Interfaces;
|
||||
|
||||
interface iSyncWebErpProduct
|
||||
{
|
||||
public function erpToWebProductVariant();
|
||||
public function erpToWebProduct();
|
||||
public function webToErpProduct();
|
||||
public function getErpTotalProduct();
|
||||
}
|
||||
Reference in New Issue
Block a user