From 0b0922bcfafadcff37f727eff349eb621ad940f0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Aug 2016 09:27:30 +0800 Subject: [PATCH] update --- services/AdminUser.php | 2 +- services/Blog.php | 18 +++++------ services/Cart.php | 26 ++++++++-------- services/Customer.php | 12 ++++---- services/FecshopLang.php | 10 +++--- services/Order.php | 8 ++--- services/Product.php | 4 +-- services/Search.php | 4 +-- services/Store.php | 14 ++------- services/Url.php | 6 ++-- services/category/Menu.php | 4 +-- services/category/Product.php | 2 +- services/cms/Article.php | 11 +++---- services/helper/Log.php | 5 +-- services/page/Asset.php | 7 ++--- services/page/Breadcrumbs.php | 22 +++++++------ services/page/Menu.php | 2 +- services/page/Newsletter.php | 4 +-- services/page/Theme.php | 4 +-- services/page/Translate.php | 2 +- services/page/Widget.php | 58 ++++++++++++++++++----------------- services/product/BestSell.php | 4 +-- services/product/Coll.php | 2 +- services/product/Image.php | 2 +- services/product/Info.php | 6 ++-- services/url/Rewrite.php | 18 +++++------ 26 files changed, 124 insertions(+), 133 deletions(-) diff --git a/services/AdminUser.php b/services/AdminUser.php index fd87671d..9a230ec6 100644 --- a/services/AdminUser.php +++ b/services/AdminUser.php @@ -21,7 +21,7 @@ class AdminUser extends Service { #Yii::$service->adminUser->getIdAndNameArrByIds($ids) - public function getIdAndNameArrByIds($ids){ + protected function actionGetIdAndNameArrByIds($ids){ $user_coll = \fecadmin\models\AdminUser::find()->asArray()->select(['id','username'])->where([ 'in','id',$ids diff --git a/services/Blog.php b/services/Blog.php index b27b1c89..b50d0af3 100644 --- a/services/Blog.php +++ b/services/Blog.php @@ -19,51 +19,51 @@ use fec\helpers\CSession; class Blog extends Service { - public function getCategoryMenu(){ + protected function actionGetCategoryMenu(){ } - public function getArticleList(){ + protected function actionGetArticleList(){ } - public function getCategoryArticleList(){ + protected function actionGetCategoryArticleList(){ } - public function getArticleById(){ + protected function actionGetArticleById(){ } - public function saveArticle(){ + protected function actionSaveArticle(){ } - public function deleteArticle(){ + protected function actionDeleteArticle(){ } - public function saveCategory(){ + protected function actionSaveCategory(){ } - public function deleteCategory(){ + protected function actionDeleteCategory(){ } - public function getCategoryById(){ + protected function actionGetCategoryById(){ } diff --git a/services/Cart.php b/services/Cart.php index ac3907cf..b79eb6b0 100644 --- a/services/Cart.php +++ b/services/Cart.php @@ -33,24 +33,24 @@ class Cart extends Service * use session to save custom cart info, also ,you can config varibale $noLoginUserCartStorage ,save cart info to db. * */ - public function addProductToCart($item){ + protected function actionAddProductToCart($item){ } - public function getUserCartInfo(){ + protected function actionGetUserCartInfo(){ } - public function changeItemQty($sku){ + protected function actionChangeItemQty($sku){ } /** * merge cart , if current cart currency is not equals to user cart currency when user login account. */ - public function mergeCartAfterUserLogin(){ + protected function actionMergeCartAfterUserLogin(){ } @@ -59,7 +59,7 @@ class Cart extends Service * change current cart currency * 1. check if currency is allowed to change. */ - public function changeCartCurrency(){ + protected function actionChangeCartCurrency(){ } @@ -68,7 +68,7 @@ class Cart extends Service * @property $language|String * change current language , cart product language change to current language. */ - public function changeProductLanguage($language=''){ + protected function actionChangeProductLanguage($language=''){ } @@ -77,7 +77,7 @@ class Cart extends Service * @property $address|Array * save cart address.like,, customer name,tel,email,address ,,etc,,. */ - public function saveCartAddress($address){ + protected function actionSaveCartAddress($address){ } @@ -89,7 +89,7 @@ class Cart extends Service * 3.change shipping cost after change * */ - public function saveCartShipping($shippingId){ + protected function actionSaveCartShipping($shippingId){ } @@ -99,7 +99,7 @@ class Cart extends Service * 1.check if $paymentId is effective * 2.add or change payment to cart. */ - public function saveCartPayment($paymentId){ + protected function actionSaveCartPayment($paymentId){ } @@ -108,7 +108,7 @@ class Cart extends Service * $item_ids * remove cart items by $items_ids */ - public function removeItems($item_ids){ + protected function actionRemoveItems($item_ids){ } @@ -116,7 +116,7 @@ class Cart extends Service /** * clear cart product. */ - public function clearCart(){ + protected function actionClearCart(){ } @@ -124,7 +124,7 @@ class Cart extends Service /** * generate order by current Cart. */ - public function generateOrderByCart(){ + protected function actionGenerateOrderByCart(){ } @@ -135,7 +135,7 @@ class Cart extends Service * 2. get all item sku and custom option. * 3. add to cart like in product page ,click add to cart button. */ - public function addItemsByPendingOrder($order_id){ + protected function actionAddItemsByPendingOrder($order_id){ } diff --git a/services/Customer.php b/services/Customer.php index f4906da5..b8f2d4dc 100644 --- a/services/Customer.php +++ b/services/Customer.php @@ -22,7 +22,7 @@ class Customer extends Service * @property $data|Array * like :['email'=>'xxx@xxx.com','password'=>'xxxx'] */ - public function login($data){ + protected function actionLogin($data){ } @@ -33,7 +33,7 @@ class Customer extends Service * ,'sex','age', * ] */ - public function register($data){ + protected function actionRegister($data){ } @@ -43,7 +43,7 @@ class Customer extends Service * Get customer info by customerId, if customer id is empty, current customer id will be set, * if current customer id is empty , false will be return . */ - public function viewInfo($customerId = ''){ + protected function actionViewInfo($customerId = ''){ } @@ -54,7 +54,7 @@ class Customer extends Service * change customer password. * if $customer id is empty, it will be equals current customer id. */ - public function changePassword($password,$customerId=''){ + protected function actionChangePassword($password,$customerId=''){ } @@ -63,14 +63,14 @@ class Customer extends Service * @property $customerId|Array * ['firstname','lastname','password','customerId'] */ - public function changeNameAndPassword($data){ + protected function actionChangeNameAndPassword($data){ } /** * get current customer identify. */ - public function getCurrentAccount(){ + protected function actionGetCurrentAccount(){ return Yii::$app->user->identity->username; } diff --git a/services/FecshopLang.php b/services/FecshopLang.php index 2b6f347e..2d997eb0 100644 --- a/services/FecshopLang.php +++ b/services/FecshopLang.php @@ -33,11 +33,11 @@ class Fecshoplang extends Service * @property $langCode|String , language 2 code, like :en ,fr ,es, * get language child language attr, like: title_fr */ - public function getLangAttrName($attrName,$langCode){ + protected function actionGetLangAttrName($attrName,$langCode){ return $attrName.'_'.$langCode; } - public function getDefaultLangAttrName($attrName){ + protected function actionGetDefaultLangAttrName($attrName){ return $attrName.'_'.$this->defaultLangCode; } @@ -47,7 +47,7 @@ class Fecshoplang extends Service * get default language attr value. * example getDefaultLangAttrVal(['title_en'=>'xx','title_fr'=>'yy'],'title'); */ - public function getDefaultLangAttrVal($attrVal,$attrName){ + protected function actionGetDefaultLangAttrVal($attrVal,$attrName){ $defaultLangAttrName = $this->getDefaultLangAttrName($attrName); if(isset($attrVal[$defaultLangAttrName]) && !empty($attrVal[$defaultLangAttrName])){ return $attrVal[$defaultLangAttrName]; @@ -65,7 +65,7 @@ class Fecshoplang extends Service * if attribute in default language value is empty, '' will be return. * example getLangAttrVal(['title_en'=>'xx','title_fr'=>'yy'],'title','fr'); */ - public function getLangAttrVal($attrVal,$attrName,$langCode){ + protected function actionGetLangAttrVal($attrVal,$attrName,$langCode){ $langAttrName = $this->getLangAttrName($attrName,$langCode); if(isset($attrVal[$langAttrName]) && !empty($attrVal[$langAttrName])){ return $attrVal[$langAttrName]; @@ -85,7 +85,7 @@ class Fecshoplang extends Service * @return String , like en ,fr ,es , if $language is not exist in $this->allLangCode * empty will be return. */ - public function getLangCodeByLanguage($language){ + protected function actionGetLangCodeByLanguage($language){ if(isset($this->allLangCode[$language])){ return $this->allLangCode[$language]; }else{ diff --git a/services/Order.php b/services/Order.php index 7fd7337d..d9a1facd 100644 --- a/services/Order.php +++ b/services/Order.php @@ -26,7 +26,7 @@ class Order extends Service /** * get all order collection */ - public function getOrderList(){ + protected function actionGetOrderList(){ } @@ -34,14 +34,14 @@ class Order extends Service /** * get order list by customer account id. */ - public function getAccountOrderList(){ + protected function actionGetAccountOrderList(){ } /** * get order list by customer account id. */ - public function changeOrderStatus(){ + protected function actionChangeOrderStatus(){ } @@ -49,7 +49,7 @@ class Order extends Service /** * get order by Id. */ - public function getOrderById(){ + protected function actionGetOrderById(){ } diff --git a/services/Product.php b/services/Product.php index 63d0c519..1983eb8e 100644 --- a/services/Product.php +++ b/services/Product.php @@ -20,11 +20,11 @@ class Product extends Service { private $_productId; - public function setCurrentProductId($productId){ + protected function actionSetCurrentProductId($productId){ $this->_productId = $productId; } - public function getCurrentProductId(){ + protected function actionGetCurrentProductId(){ return $this->_productId; } diff --git a/services/Search.php b/services/Search.php index 4ae4e96a..030e6420 100644 --- a/services/Search.php +++ b/services/Search.php @@ -19,12 +19,12 @@ use fec\helpers\CSession; class Search extends Service { - public function getProductList($text,$filter){ + protected function actionGetProductList($text,$filter){ } - public function getHotSearchText(){ + protected function actionGetHotSearchText(){ } diff --git a/services/Store.php b/services/Store.php index 6ce321a2..38d5a6ac 100644 --- a/services/Store.php +++ b/services/Store.php @@ -43,8 +43,6 @@ class Store extends Service * current store code , this property will init value with store code. */ public $currentStore; - - /** * current language code example : fr es cn ru. */ @@ -55,13 +53,9 @@ class Store extends Service * if current store_code is not config , InvalidValueException will be throw. * class property $currentStore will be set value $store_code. */ - public function actionBootstrap($app){ - - //Yii::$service = new \fecshop\services\Service; - //Yii::createObject($service); + protected function actionBootstrap($app){ $host = explode('://' ,$app->getHomeUrl()); $stores = $this->stores; - $init_compelte = 0; if(is_array($stores) && !empty($stores)){ foreach($stores as $store_code => $store){ @@ -97,7 +91,6 @@ class Store extends Service }else{ $currency = ''; } - Yii::$service->page->currency->initCurrency($currency); /** * current domian is config is store config. @@ -110,7 +103,6 @@ class Store extends Service if(!$init_compelte){ throw new InvalidValueException('this domain is not config in store component'); } - } /** @@ -164,7 +156,7 @@ class Store extends Service * if lang attribute in current store language is empty , default language attribute will be return. * if attribute in default language value is empty, $attrVal will be return. */ - public function getStoreAttrVal($attrVal,$attrName){ + protected function actionGetStoreAttrVal($attrVal,$attrName){ $lang = $this->currentLangCode; return Yii::$service->fecshoplang->getLangAttrVal($attrVal,$attrName,$lang); } @@ -173,7 +165,7 @@ class Store extends Service * @return Array * get all store info, one item in array format is: ['storeCode' => 'store language']. */ - public function getStoresLang(){ + protected function actionGetStoresLang(){ $stores = $this->stores; $topLang = []; foreach($stores as $storeCode=> $store){ diff --git a/services/Url.php b/services/Url.php index 97a292c3..f0b705a7 100644 --- a/services/Url.php +++ b/services/Url.php @@ -136,7 +136,7 @@ class Url extends Service * Yii::$service->url->getUrlByPath('cms/article/index',['id'=>33]); * Yii::$service->url->getUrlByPath('cms/article/index',['id'=>33],true); */ - protected function getUrl($path,$params=[],$https=false){ + protected function actionGetUrl($path,$params=[],$https=false){ if($https){ $baseUrl = $this->getHttpsBaseUrl(); }else{ @@ -155,7 +155,7 @@ class Url extends Service /** * get current base url , is was generate by http(or https ).'://'.store_code */ - public function getCurrentBaseUrl(){ + protected function actionGetCurrentBaseUrl(){ if(!$this->_currentBaseUrl){ $homeUrl = $this->homeUrl(); if($this->showScriptName){ @@ -172,7 +172,7 @@ class Url extends Service /** * get current home url , is was generate by 'http://'.store_code */ - public function homeUrl(){ + protected function actionHomeUrl(){ return Yii::$app->getHomeUrl(); } diff --git a/services/category/Menu.php b/services/category/Menu.php index 3dd4d7f3..0ae0ef4d 100644 --- a/services/category/Menu.php +++ b/services/category/Menu.php @@ -26,7 +26,7 @@ class Menu extends Service * get category menu as array. array key is: _id ,name ,urlPath,childMenu * */ - public function getCategoryMenuArr($parentId=''){ + protected function actionGetCategoryMenuArr($parentId=''){ $arr = []; if(!$parentId) $parentId = $this->rootCategoryId; @@ -57,7 +57,7 @@ class Menu extends Service * @property $categoryId|Array * check if cateogry has child . */ - public function hasChild($categoryId){ + protected function hasChild($categoryId){ $one = Category::find()->asArray()->where([ 'parent_id' => $categoryId ])->one(); diff --git a/services/category/Product.php b/services/category/Product.php index e7f887ac..84339f77 100644 --- a/services/category/Product.php +++ b/services/category/Product.php @@ -41,7 +41,7 @@ class Product extends Service ] */ - public function getFilterProduct($filter){ + protected function actionGetFilterProduct($filter){ $where = isset($filter['where']) ? $filter['where'] : ''; $categoryId = isset($filter['categoryId']) ? $filter['categoryId'] : ''; if($categoryId){ diff --git a/services/cms/Article.php b/services/cms/Article.php index eeb6fea8..8273fe9c 100644 --- a/services/cms/Article.php +++ b/services/cms/Article.php @@ -25,7 +25,6 @@ class Article extends Service public $storage = 'mongodb'; protected $_article; - public function init(){ if($this->storage == 'mongodb'){ $this->_article = new ArticleMongodb; @@ -43,13 +42,13 @@ class Article extends Service /** * get artile's primary key. */ - public function getPrimaryKey(){ + protected function actionGetPrimaryKey(){ return $this->_article->getPrimaryKey(); } /** * get artile model by primary key. */ - public function getByPrimaryKey($primaryKey){ + protected function actionGetByPrimaryKey($primaryKey){ return $this->_article->getByPrimaryKey($primaryKey); } @@ -73,7 +72,7 @@ class Article extends Service * 'asArray' => true, * ] */ - public function coll($filter=''){ + protected function actionColl($filter=''){ return $this->_article->coll($filter); } @@ -82,11 +81,11 @@ class Article extends Service * @property $originUrlKey|String , article origin url key. * save $data to cms model,then,add url rewrite info to system service urlrewrite. */ - public function save($one,$originUrlKey){ + protected function actionSave($one,$originUrlKey){ return $this->_article->save($one,$originUrlKey); } - public function remove($ids){ + protected function actionRemove($ids){ return $this->_article->remove($ids); } diff --git a/services/helper/Log.php b/services/helper/Log.php index 526464da..801065de 100644 --- a/services/helper/Log.php +++ b/services/helper/Log.php @@ -22,12 +22,9 @@ use fecshop\models\mongodb\FecshopServiceLog; */ class Log extends Service { - + public $log_config; protected $_serviceContent; protected $_serviceUid; - - public $log_config; - protected $_isServiceLog; protected $_isServiceLogDbPrint; protected $_isServiceLogHtmlPrint; diff --git a/services/page/Asset.php b/services/page/Asset.php index 505d277f..c8b13e11 100644 --- a/services/page/Asset.php +++ b/services/page/Asset.php @@ -18,14 +18,13 @@ use yii\web\AssetBundle; use yii\base\Object; use yii\helpers\ArrayHelper; use yii\helpers\Url; - /** * page asset services * @author Terry Zhao <2358269014@qq.com> * @since 1.0 extends AssetBundle */ -class Asset +class Asset extends Service { public $cssOptions; public $jsOptions; @@ -38,7 +37,7 @@ class Asset /** * 文件路径默认放到模板路径下面的assets里面 */ - public function register($view){ + protected function actionRegister($view){ $assetArr = []; $themeDir = Yii::$service->page->theme->getThemeDirArr(); if( is_array($themeDir) && !empty($themeDir)){ @@ -103,7 +102,7 @@ class Asset } - public function initOptions($options){ + protected function initOptions($options){ if(isset($options['position'])){ if($options['position'] == 'POS_HEAD'){ $options['position'] = \yii\web\View::POS_HEAD; diff --git a/services/page/Breadcrumbs.php b/services/page/Breadcrumbs.php index 948b2529..cf79e672 100644 --- a/services/page/Breadcrumbs.php +++ b/services/page/Breadcrumbs.php @@ -25,15 +25,6 @@ class Breadcrumbs extends Service public $intervalSymbol = ' > '; protected $_items; - /** - * property $items|Array. add $items to $this->_items. - * $items format example. - * $items = ['name'=>'fashion handbag','url'=>'http://www.xxx.com']; - */ - public function addItems($items){ - $this->_items[] = $items; - } - public function init(){ if($this->homeName){ $items['name'] = $this->homeName; @@ -43,10 +34,21 @@ class Breadcrumbs extends Service } } + /** + * property $items|Array. add $items to $this->_items. + * $items format example. + * $items = ['name'=>'fashion handbag','url'=>'http://www.xxx.com']; + */ + protected function actionAddItems($items){ + $this->_items[] = $items; + } + + + /** * generate Breadcrumbs html ,before generate , you should use addItems function to add breadcrumbs items. */ - public function generateHtml(){ + protected function actionGenerateHtml(){ $arr = []; if($this->_items){ foreach($this->_items as $item){ diff --git a/services/page/Menu.php b/services/page/Menu.php index 7091c1ed..ba955ddf 100644 --- a/services/page/Menu.php +++ b/services/page/Menu.php @@ -55,7 +55,7 @@ class Menu extends Service ] ] */ - public function getMenuData(){ + protected function actionGetMenuData(){ $this->_homeUrl = CUrl::getHomeUrl(); $arr = []; if($displayHome = $this->displayHome){ diff --git a/services/page/Newsletter.php b/services/page/Newsletter.php index 4fca4f77..cb6bc2b4 100644 --- a/services/page/Newsletter.php +++ b/services/page/Newsletter.php @@ -25,7 +25,7 @@ class Newsletter extends Service /** * newsletter subscription */ - public function subscription($email){ + protected function actionSubscription($email){ $mongoNewsletter = new MongoNewsletter(); $mongoNewsletter->attributes = [ 'email' => $email, @@ -58,7 +58,7 @@ class Newsletter extends Service * @property $filter|array * get subscription email collection */ - public function getSubscriptionList($filter){ + protected function actionGetSubscriptionList($filter){ } diff --git a/services/page/Theme.php b/services/page/Theme.php index 0194a2e2..07465c89 100644 --- a/services/page/Theme.php +++ b/services/page/Theme.php @@ -45,7 +45,7 @@ class Theme extends Service protected $_themeDirArr; - public function getThemeDirArr(){ + protected function actionGetThemeDirArr(){ if(!$this->_themeDirArr){ $arr = []; if($localThemeDir = Yii::getAlias($this->localThemeDir)){ @@ -67,7 +67,7 @@ class Theme extends Service /** * find theme file by mutil theme ,if not find view file and $throwError=true, it will throw InvalidValueException. */ - public function getViewFile($view,$throwError=true){ + protected function actionGetViewFile($view,$throwError=true){ $view = trim($view); if(substr($view,0,1) == '@'){ return Yii::getAlias($view); diff --git a/services/page/Translate.php b/services/page/Translate.php index 3f1f11e8..5830507c 100644 --- a/services/page/Translate.php +++ b/services/page/Translate.php @@ -38,7 +38,7 @@ class Translate extends Service } } - public function setLanguage($language){ + protected function actionSetLanguage($language){ Yii::$app->language = $language; } diff --git a/services/page/Widget.php b/services/page/Widget.php index 390a7317..1f5a892a 100644 --- a/services/page/Widget.php +++ b/services/page/Widget.php @@ -43,7 +43,7 @@ class Widget extends Service ] ] */ - public function render($configKey,$parentThis=''){ + protected function actionRender($configKey,$parentThis=''){ $config = ''; if(is_array($configKey)){ $config = $configKey; @@ -59,33 +59,7 @@ class Widget extends Service return $this->renderContent($configKey,$config,$parentThis); } - - protected function renderContent($configKey,$config,$parentThis=''){ - if(isset($config['cache']['enable']) && $config['cache']['enable']){ - if(!isset($config['class']) || !$config['class']){ - throw new InvalidConfigException('in widget ['.$configKey.'],you enable cache ,you must config widget class .'); - }else if($ob = new $config['class']){ - if($ob instanceof BlockCache){ - $cacheKey = $ob->getCacheKey(); - if(!($content = CCache::get($cacheKey))){ - $cache = $config['cache']; - $timeout = isset($cache['timeout']) ? $cache['timeout'] : 0; - unset($config['cache']); - $content = $this->renderContentHtml($configKey,$config,$parentThis); - CCache::set($cacheKey,$content,$timeout); - } - return $content; - }else{ - throw new InvalidConfigException($config['class'].' must implete fecshop\interfaces\block\BlockCache when you use block cache .'); - } - } - } - $content = $this->renderContentHtml($configKey,$config,$parentThis); - return $content; - - } - - public function renderContentHtml($configKey,$config,$parentThis=''){ + protected function actionRenderContentHtml($configKey,$config,$parentThis=''){ if( !isset($config['view']) || empty($config['view']) ){ throw new InvalidConfigException('view and class must exist in array config!'); @@ -120,6 +94,34 @@ class Widget extends Service } + protected function renderContent($configKey,$config,$parentThis=''){ + if(isset($config['cache']['enable']) && $config['cache']['enable']){ + if(!isset($config['class']) || !$config['class']){ + throw new InvalidConfigException('in widget ['.$configKey.'],you enable cache ,you must config widget class .'); + }else if($ob = new $config['class']){ + if($ob instanceof BlockCache){ + $cacheKey = $ob->getCacheKey(); + if(!($content = CCache::get($cacheKey))){ + $cache = $config['cache']; + $timeout = isset($cache['timeout']) ? $cache['timeout'] : 0; + unset($config['cache']); + $content = $this->renderContentHtml($configKey,$config,$parentThis); + CCache::set($cacheKey,$content,$timeout); + } + return $content; + }else{ + throw new InvalidConfigException($config['class'].' must implete fecshop\interfaces\block\BlockCache when you use block cache .'); + } + } + } + $content = $this->renderContentHtml($configKey,$config,$parentThis); + return $content; + + } + + + + /** * find theme file by mutil theme ,if not find view file and $throwError=true, it will throw InvalidValueException. */ diff --git a/services/product/BestSell.php b/services/product/BestSell.php index 30fc9118..86c51eca 100644 --- a/services/product/BestSell.php +++ b/services/product/BestSell.php @@ -21,7 +21,7 @@ class BestSell extends Service * õȫƷIJƷ */ - public function getCategoryProduct() + protected function actionGetCategoryProduct() { return 'category best sell product'; } @@ -29,7 +29,7 @@ class BestSell extends Service /** * õȫƷIJƷ */ - public function getProduct(){ + protected function actionGetProduct(){ } diff --git a/services/product/Coll.php b/services/product/Coll.php index 1c761a38..50202400 100644 --- a/services/product/Coll.php +++ b/services/product/Coll.php @@ -56,7 +56,7 @@ class Coll extends Service * 'asArray' => true, * ] */ - public function getProducts($filter){ + protected function actionGetProducts($filter){ $numPerPage = isset($filter['numPerPage']) ? $filter['numPerPage'] : $this->numPerPage; $pageNum = isset($filter['pageNum']) ? $filter['pageNum'] : $this->pageNum; $orderBy = isset($filter['orderBy']) ? $filter['orderBy'] : $this->orderBy; diff --git a/services/product/Image.php b/services/product/Image.php index a5375f63..312e63dd 100644 --- a/services/product/Image.php +++ b/services/product/Image.php @@ -70,7 +70,7 @@ class Image extends Service * return , if success ,return image saved relative file path , like '/b/i/big.jpg' * if fail, reutrn false; */ - public function saveProductUploadImg($param_img_file){ + protected function actionSaveProductUploadImg($param_img_file){ $this->initUploadImage(); $size = $param_img_file['size']; $file = $param_img_file['tmp_name']; diff --git a/services/product/Info.php b/services/product/Info.php index 28c5143a..628e7b6e 100644 --- a/services/product/Info.php +++ b/services/product/Info.php @@ -30,7 +30,7 @@ class Info extends Service * image will return full image url * this function will be use for front product info page. */ - public function getProduct($productId='',$selectAttr=[]) + protected function actionGetProduct($productId='',$selectAttr=[]) { //echo 33;exit; if(!$this->_product){ @@ -59,7 +59,7 @@ class Info extends Service * @property $product is object. * convert product language attribute to current language value. */ - public function getCurrentLangProduct($product){ + protected function actionGetCurrentLangProduct($product){ $lang_attrs = $this->getLangAttr(); foreach($lang_attrs as $attr){ $product->$attr = Yii::$service->store->getLangVal($product->$attr,$attr); @@ -69,7 +69,7 @@ class Info extends Service /** * product language attributes array. */ - public function getLangAttr(){ + protected function actionGetLangAttr(){ return [ 'name', 'title', diff --git a/services/url/Rewrite.php b/services/url/Rewrite.php index bcf41241..1000fab8 100644 --- a/services/url/Rewrite.php +++ b/services/url/Rewrite.php @@ -34,20 +34,20 @@ class Rewrite extends Service } } - public function actionGetOriginUrl($urlKey){ + protected function actionGetOriginUrl($urlKey){ return $this->_urlRewrite->getOriginUrl($urlKey); } /** * get artile's primary key. */ - public function actionGetPrimaryKey(){ + protected function actionGetPrimaryKey(){ return $this->_urlRewrite->getPrimaryKey(); } /** * get artile model by primary key. */ - public function actionGetByPrimaryKey($primaryKey){ + protected function actionGetByPrimaryKey($primaryKey){ return $this->_urlRewrite->getByPrimaryKey($primaryKey); } @@ -73,7 +73,7 @@ class Rewrite extends Service * 'asArray' => true, * ] */ - public function actionColl($filter=''){ + protected function actionColl($filter=''){ return $this->_urlRewrite->coll($filter); } @@ -82,24 +82,24 @@ class Rewrite extends Service * @property $originUrlKey|String , article origin url key. * save $data to cms model,then,add url rewrite info to system service urlrewrite. */ - public function actionSave($one){ + protected function actionSave($one){ return $this->_urlRewrite->save($one); } - public function actionRemove($ids){ + protected function actionRemove($ids){ return $this->_urlRewrite->remove($ids); } - public function actionFind(){ + protected function actionFind(){ return $this->_urlRewrite->find(); } - public function actionFindOne($where){ + protected function actionFindOne($where){ return $this->_urlRewrite->findOne($where); } - public function actionNewModel(){ + protected function actionNewModel(){ return $this->_urlRewrite->newModel(); } -- GitLab