提交 0b0922bc 编写于 作者: R root

update

上级 73a617fe
...@@ -21,7 +21,7 @@ class AdminUser extends Service ...@@ -21,7 +21,7 @@ class AdminUser extends Service
{ {
#Yii::$service->adminUser->getIdAndNameArrByIds($ids) #Yii::$service->adminUser->getIdAndNameArrByIds($ids)
public function getIdAndNameArrByIds($ids){ protected function actionGetIdAndNameArrByIds($ids){
$user_coll = \fecadmin\models\AdminUser::find()->asArray()->select(['id','username'])->where([ $user_coll = \fecadmin\models\AdminUser::find()->asArray()->select(['id','username'])->where([
'in','id',$ids 'in','id',$ids
......
...@@ -19,51 +19,51 @@ use fec\helpers\CSession; ...@@ -19,51 +19,51 @@ use fec\helpers\CSession;
class Blog extends Service 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(){
} }
......
...@@ -33,24 +33,24 @@ class Cart extends Service ...@@ -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. * 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. * 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 ...@@ -59,7 +59,7 @@ class Cart extends Service
* change current cart currency * change current cart currency
* 1. check if currency is allowed to change. * 1. check if currency is allowed to change.
*/ */
public function changeCartCurrency(){ protected function actionChangeCartCurrency(){
} }
...@@ -68,7 +68,7 @@ class Cart extends Service ...@@ -68,7 +68,7 @@ class Cart extends Service
* @property $language|String * @property $language|String
* change current language , cart product language change to current language. * 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 ...@@ -77,7 +77,7 @@ class Cart extends Service
* @property $address|Array * @property $address|Array
* save cart address.like,, customer name,tel,email,address ,,etc,,. * 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 ...@@ -89,7 +89,7 @@ class Cart extends Service
* 3.change shipping cost after change * 3.change shipping cost after change
* *
*/ */
public function saveCartShipping($shippingId){ protected function actionSaveCartShipping($shippingId){
} }
...@@ -99,7 +99,7 @@ class Cart extends Service ...@@ -99,7 +99,7 @@ class Cart extends Service
* 1.check if $paymentId is effective * 1.check if $paymentId is effective
* 2.add or change payment to cart. * 2.add or change payment to cart.
*/ */
public function saveCartPayment($paymentId){ protected function actionSaveCartPayment($paymentId){
} }
...@@ -108,7 +108,7 @@ class Cart extends Service ...@@ -108,7 +108,7 @@ class Cart extends Service
* $item_ids * $item_ids
* remove cart items by $items_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 ...@@ -116,7 +116,7 @@ class Cart extends Service
/** /**
* clear cart product. * clear cart product.
*/ */
public function clearCart(){ protected function actionClearCart(){
} }
...@@ -124,7 +124,7 @@ class Cart extends Service ...@@ -124,7 +124,7 @@ class Cart extends Service
/** /**
* generate order by current Cart. * generate order by current Cart.
*/ */
public function generateOrderByCart(){ protected function actionGenerateOrderByCart(){
} }
...@@ -135,7 +135,7 @@ class Cart extends Service ...@@ -135,7 +135,7 @@ class Cart extends Service
* 2. get all item sku and custom option. * 2. get all item sku and custom option.
* 3. add to cart like in product page ,click add to cart button. * 3. add to cart like in product page ,click add to cart button.
*/ */
public function addItemsByPendingOrder($order_id){ protected function actionAddItemsByPendingOrder($order_id){
} }
......
...@@ -22,7 +22,7 @@ class Customer extends Service ...@@ -22,7 +22,7 @@ class Customer extends Service
* @property $data|Array * @property $data|Array
* like :['email'=>'xxx@xxx.com','password'=>'xxxx'] * like :['email'=>'xxx@xxx.com','password'=>'xxxx']
*/ */
public function login($data){ protected function actionLogin($data){
} }
...@@ -33,7 +33,7 @@ class Customer extends Service ...@@ -33,7 +33,7 @@ class Customer extends Service
* ,'sex','age', * ,'sex','age',
* ] * ]
*/ */
public function register($data){ protected function actionRegister($data){
} }
...@@ -43,7 +43,7 @@ class Customer extends Service ...@@ -43,7 +43,7 @@ class Customer extends Service
* Get customer info by customerId, if customer id is empty, current customer id will be set, * 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 . * 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 ...@@ -54,7 +54,7 @@ class Customer extends Service
* change customer password. * change customer password.
* if $customer id is empty, it will be equals current customer id. * 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 ...@@ -63,14 +63,14 @@ class Customer extends Service
* @property $customerId|Array * @property $customerId|Array
* ['firstname','lastname','password','customerId'] * ['firstname','lastname','password','customerId']
*/ */
public function changeNameAndPassword($data){ protected function actionChangeNameAndPassword($data){
} }
/** /**
* get current customer identify. * get current customer identify.
*/ */
public function getCurrentAccount(){ protected function actionGetCurrentAccount(){
return Yii::$app->user->identity->username; return Yii::$app->user->identity->username;
} }
......
...@@ -33,11 +33,11 @@ class Fecshoplang extends Service ...@@ -33,11 +33,11 @@ class Fecshoplang extends Service
* @property $langCode|String , language 2 code, like :en ,fr ,es, * @property $langCode|String , language 2 code, like :en ,fr ,es,
* get language child language attr, like: title_fr * get language child language attr, like: title_fr
*/ */
public function getLangAttrName($attrName,$langCode){ protected function actionGetLangAttrName($attrName,$langCode){
return $attrName.'_'.$langCode; return $attrName.'_'.$langCode;
} }
public function getDefaultLangAttrName($attrName){ protected function actionGetDefaultLangAttrName($attrName){
return $attrName.'_'.$this->defaultLangCode; return $attrName.'_'.$this->defaultLangCode;
} }
...@@ -47,7 +47,7 @@ class Fecshoplang extends Service ...@@ -47,7 +47,7 @@ class Fecshoplang extends Service
* get default language attr value. * get default language attr value.
* example getDefaultLangAttrVal(['title_en'=>'xx','title_fr'=>'yy'],'title'); * example getDefaultLangAttrVal(['title_en'=>'xx','title_fr'=>'yy'],'title');
*/ */
public function getDefaultLangAttrVal($attrVal,$attrName){ protected function actionGetDefaultLangAttrVal($attrVal,$attrName){
$defaultLangAttrName = $this->getDefaultLangAttrName($attrName); $defaultLangAttrName = $this->getDefaultLangAttrName($attrName);
if(isset($attrVal[$defaultLangAttrName]) && !empty($attrVal[$defaultLangAttrName])){ if(isset($attrVal[$defaultLangAttrName]) && !empty($attrVal[$defaultLangAttrName])){
return $attrVal[$defaultLangAttrName]; return $attrVal[$defaultLangAttrName];
...@@ -65,7 +65,7 @@ class Fecshoplang extends Service ...@@ -65,7 +65,7 @@ class Fecshoplang extends Service
* if attribute in default language value is empty, '' will be return. * if attribute in default language value is empty, '' will be return.
* example getLangAttrVal(['title_en'=>'xx','title_fr'=>'yy'],'title','fr'); * 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); $langAttrName = $this->getLangAttrName($attrName,$langCode);
if(isset($attrVal[$langAttrName]) && !empty($attrVal[$langAttrName])){ if(isset($attrVal[$langAttrName]) && !empty($attrVal[$langAttrName])){
return $attrVal[$langAttrName]; return $attrVal[$langAttrName];
...@@ -85,7 +85,7 @@ class Fecshoplang extends Service ...@@ -85,7 +85,7 @@ class Fecshoplang extends Service
* @return String , like en ,fr ,es , if $language is not exist in $this->allLangCode * @return String , like en ,fr ,es , if $language is not exist in $this->allLangCode
* empty will be return. * empty will be return.
*/ */
public function getLangCodeByLanguage($language){ protected function actionGetLangCodeByLanguage($language){
if(isset($this->allLangCode[$language])){ if(isset($this->allLangCode[$language])){
return $this->allLangCode[$language]; return $this->allLangCode[$language];
}else{ }else{
......
...@@ -26,7 +26,7 @@ class Order extends Service ...@@ -26,7 +26,7 @@ class Order extends Service
/** /**
* get all order collection * get all order collection
*/ */
public function getOrderList(){ protected function actionGetOrderList(){
} }
...@@ -34,14 +34,14 @@ class Order extends Service ...@@ -34,14 +34,14 @@ class Order extends Service
/** /**
* get order list by customer account id. * get order list by customer account id.
*/ */
public function getAccountOrderList(){ protected function actionGetAccountOrderList(){
} }
/** /**
* get order list by customer account id. * get order list by customer account id.
*/ */
public function changeOrderStatus(){ protected function actionChangeOrderStatus(){
} }
...@@ -49,7 +49,7 @@ class Order extends Service ...@@ -49,7 +49,7 @@ class Order extends Service
/** /**
* get order by Id. * get order by Id.
*/ */
public function getOrderById(){ protected function actionGetOrderById(){
} }
......
...@@ -20,11 +20,11 @@ class Product extends Service ...@@ -20,11 +20,11 @@ class Product extends Service
{ {
private $_productId; private $_productId;
public function setCurrentProductId($productId){ protected function actionSetCurrentProductId($productId){
$this->_productId = $productId; $this->_productId = $productId;
} }
public function getCurrentProductId(){ protected function actionGetCurrentProductId(){
return $this->_productId; return $this->_productId;
} }
......
...@@ -19,12 +19,12 @@ use fec\helpers\CSession; ...@@ -19,12 +19,12 @@ use fec\helpers\CSession;
class Search extends Service class Search extends Service
{ {
public function getProductList($text,$filter){ protected function actionGetProductList($text,$filter){
} }
public function getHotSearchText(){ protected function actionGetHotSearchText(){
} }
......
...@@ -43,8 +43,6 @@ class Store extends Service ...@@ -43,8 +43,6 @@ class Store extends Service
* current store code , this property will init value with store code. * current store code , this property will init value with store code.
*/ */
public $currentStore; public $currentStore;
/** /**
* current language code example : fr es cn ru. * current language code example : fr es cn ru.
*/ */
...@@ -55,13 +53,9 @@ class Store extends Service ...@@ -55,13 +53,9 @@ class Store extends Service
* if current store_code is not config , InvalidValueException will be throw. * if current store_code is not config , InvalidValueException will be throw.
* class property $currentStore will be set value $store_code. * class property $currentStore will be set value $store_code.
*/ */
public function actionBootstrap($app){ protected function actionBootstrap($app){
//Yii::$service = new \fecshop\services\Service;
//Yii::createObject($service);
$host = explode('://' ,$app->getHomeUrl()); $host = explode('://' ,$app->getHomeUrl());
$stores = $this->stores; $stores = $this->stores;
$init_compelte = 0; $init_compelte = 0;
if(is_array($stores) && !empty($stores)){ if(is_array($stores) && !empty($stores)){
foreach($stores as $store_code => $store){ foreach($stores as $store_code => $store){
...@@ -97,7 +91,6 @@ class Store extends Service ...@@ -97,7 +91,6 @@ class Store extends Service
}else{ }else{
$currency = ''; $currency = '';
} }
Yii::$service->page->currency->initCurrency($currency); Yii::$service->page->currency->initCurrency($currency);
/** /**
* current domian is config is store config. * current domian is config is store config.
...@@ -110,7 +103,6 @@ class Store extends Service ...@@ -110,7 +103,6 @@ class Store extends Service
if(!$init_compelte){ if(!$init_compelte){
throw new InvalidValueException('this domain is not config in store component'); throw new InvalidValueException('this domain is not config in store component');
} }
} }
/** /**
...@@ -164,7 +156,7 @@ class Store extends Service ...@@ -164,7 +156,7 @@ class Store extends Service
* if lang attribute in current store language is empty , default language attribute will be return. * 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. * 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; $lang = $this->currentLangCode;
return Yii::$service->fecshoplang->getLangAttrVal($attrVal,$attrName,$lang); return Yii::$service->fecshoplang->getLangAttrVal($attrVal,$attrName,$lang);
} }
...@@ -173,7 +165,7 @@ class Store extends Service ...@@ -173,7 +165,7 @@ class Store extends Service
* @return Array * @return Array
* get all store info, one item in array format is: ['storeCode' => 'store language']. * get all store info, one item in array format is: ['storeCode' => 'store language'].
*/ */
public function getStoresLang(){ protected function actionGetStoresLang(){
$stores = $this->stores; $stores = $this->stores;
$topLang = []; $topLang = [];
foreach($stores as $storeCode=> $store){ foreach($stores as $storeCode=> $store){
......
...@@ -136,7 +136,7 @@ class Url extends Service ...@@ -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]);
* Yii::$service->url->getUrlByPath('cms/article/index',['id'=>33],true); * 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){ if($https){
$baseUrl = $this->getHttpsBaseUrl(); $baseUrl = $this->getHttpsBaseUrl();
}else{ }else{
...@@ -155,7 +155,7 @@ class Url extends Service ...@@ -155,7 +155,7 @@ class Url extends Service
/** /**
* get current base url , is was generate by http(or https ).'://'.store_code * get current base url , is was generate by http(or https ).'://'.store_code
*/ */
public function getCurrentBaseUrl(){ protected function actionGetCurrentBaseUrl(){
if(!$this->_currentBaseUrl){ if(!$this->_currentBaseUrl){
$homeUrl = $this->homeUrl(); $homeUrl = $this->homeUrl();
if($this->showScriptName){ if($this->showScriptName){
...@@ -172,7 +172,7 @@ class Url extends Service ...@@ -172,7 +172,7 @@ class Url extends Service
/** /**
* get current home url , is was generate by 'http://'.store_code * get current home url , is was generate by 'http://'.store_code
*/ */
public function homeUrl(){ protected function actionHomeUrl(){
return Yii::$app->getHomeUrl(); return Yii::$app->getHomeUrl();
} }
......
...@@ -26,7 +26,7 @@ class Menu extends Service ...@@ -26,7 +26,7 @@ class Menu extends Service
* get category menu as array. array key is: _id ,name ,urlPath,childMenu * get category menu as array. array key is: _id ,name ,urlPath,childMenu
* *
*/ */
public function getCategoryMenuArr($parentId=''){ protected function actionGetCategoryMenuArr($parentId=''){
$arr = []; $arr = [];
if(!$parentId) if(!$parentId)
$parentId = $this->rootCategoryId; $parentId = $this->rootCategoryId;
...@@ -57,7 +57,7 @@ class Menu extends Service ...@@ -57,7 +57,7 @@ class Menu extends Service
* @property $categoryId|Array * @property $categoryId|Array
* check if cateogry has child . * check if cateogry has child .
*/ */
public function hasChild($categoryId){ protected function hasChild($categoryId){
$one = Category::find()->asArray()->where([ $one = Category::find()->asArray()->where([
'parent_id' => $categoryId 'parent_id' => $categoryId
])->one(); ])->one();
......
...@@ -41,7 +41,7 @@ class Product extends Service ...@@ -41,7 +41,7 @@ class Product extends Service
] ]
*/ */
public function getFilterProduct($filter){ protected function actionGetFilterProduct($filter){
$where = isset($filter['where']) ? $filter['where'] : ''; $where = isset($filter['where']) ? $filter['where'] : '';
$categoryId = isset($filter['categoryId']) ? $filter['categoryId'] : ''; $categoryId = isset($filter['categoryId']) ? $filter['categoryId'] : '';
if($categoryId){ if($categoryId){
......
...@@ -25,7 +25,6 @@ class Article extends Service ...@@ -25,7 +25,6 @@ class Article extends Service
public $storage = 'mongodb'; public $storage = 'mongodb';
protected $_article; protected $_article;
public function init(){ public function init(){
if($this->storage == 'mongodb'){ if($this->storage == 'mongodb'){
$this->_article = new ArticleMongodb; $this->_article = new ArticleMongodb;
...@@ -43,13 +42,13 @@ class Article extends Service ...@@ -43,13 +42,13 @@ class Article extends Service
/** /**
* get artile's primary key. * get artile's primary key.
*/ */
public function getPrimaryKey(){ protected function actionGetPrimaryKey(){
return $this->_article->getPrimaryKey(); return $this->_article->getPrimaryKey();
} }
/** /**
* get artile model by primary key. * get artile model by primary key.
*/ */
public function getByPrimaryKey($primaryKey){ protected function actionGetByPrimaryKey($primaryKey){
return $this->_article->getByPrimaryKey($primaryKey); return $this->_article->getByPrimaryKey($primaryKey);
} }
...@@ -73,7 +72,7 @@ class Article extends Service ...@@ -73,7 +72,7 @@ class Article extends Service
* 'asArray' => true, * 'asArray' => true,
* ] * ]
*/ */
public function coll($filter=''){ protected function actionColl($filter=''){
return $this->_article->coll($filter); return $this->_article->coll($filter);
} }
...@@ -82,11 +81,11 @@ class Article extends Service ...@@ -82,11 +81,11 @@ class Article extends Service
* @property $originUrlKey|String , article origin url key. * @property $originUrlKey|String , article origin url key.
* save $data to cms model,then,add url rewrite info to system service urlrewrite. * 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); return $this->_article->save($one,$originUrlKey);
} }
public function remove($ids){ protected function actionRemove($ids){
return $this->_article->remove($ids); return $this->_article->remove($ids);
} }
......
...@@ -22,12 +22,9 @@ use fecshop\models\mongodb\FecshopServiceLog; ...@@ -22,12 +22,9 @@ use fecshop\models\mongodb\FecshopServiceLog;
*/ */
class Log extends Service class Log extends Service
{ {
public $log_config;
protected $_serviceContent; protected $_serviceContent;
protected $_serviceUid; protected $_serviceUid;
public $log_config;
protected $_isServiceLog; protected $_isServiceLog;
protected $_isServiceLogDbPrint; protected $_isServiceLogDbPrint;
protected $_isServiceLogHtmlPrint; protected $_isServiceLogHtmlPrint;
......
...@@ -18,14 +18,13 @@ use yii\web\AssetBundle; ...@@ -18,14 +18,13 @@ use yii\web\AssetBundle;
use yii\base\Object; use yii\base\Object;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\helpers\Url; use yii\helpers\Url;
/** /**
* page asset services * page asset services
* @author Terry Zhao <2358269014@qq.com> * @author Terry Zhao <2358269014@qq.com>
* @since 1.0 * @since 1.0
extends AssetBundle extends AssetBundle
*/ */
class Asset class Asset extends Service
{ {
public $cssOptions; public $cssOptions;
public $jsOptions; public $jsOptions;
...@@ -38,7 +37,7 @@ class Asset ...@@ -38,7 +37,7 @@ class Asset
/** /**
* 文件路径默认放到模板路径下面的assets里面 * 文件路径默认放到模板路径下面的assets里面
*/ */
public function register($view){ protected function actionRegister($view){
$assetArr = []; $assetArr = [];
$themeDir = Yii::$service->page->theme->getThemeDirArr(); $themeDir = Yii::$service->page->theme->getThemeDirArr();
if( is_array($themeDir) && !empty($themeDir)){ if( is_array($themeDir) && !empty($themeDir)){
...@@ -103,7 +102,7 @@ class Asset ...@@ -103,7 +102,7 @@ class Asset
} }
public function initOptions($options){ protected function initOptions($options){
if(isset($options['position'])){ if(isset($options['position'])){
if($options['position'] == 'POS_HEAD'){ if($options['position'] == 'POS_HEAD'){
$options['position'] = \yii\web\View::POS_HEAD; $options['position'] = \yii\web\View::POS_HEAD;
......
...@@ -25,15 +25,6 @@ class Breadcrumbs extends Service ...@@ -25,15 +25,6 @@ class Breadcrumbs extends Service
public $intervalSymbol = ' > '; public $intervalSymbol = ' > ';
protected $_items; 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(){ public function init(){
if($this->homeName){ if($this->homeName){
$items['name'] = $this->homeName; $items['name'] = $this->homeName;
...@@ -43,10 +34,21 @@ class Breadcrumbs extends Service ...@@ -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. * generate Breadcrumbs html ,before generate , you should use addItems function to add breadcrumbs items.
*/ */
public function generateHtml(){ protected function actionGenerateHtml(){
$arr = []; $arr = [];
if($this->_items){ if($this->_items){
foreach($this->_items as $item){ foreach($this->_items as $item){
......
...@@ -55,7 +55,7 @@ class Menu extends Service ...@@ -55,7 +55,7 @@ class Menu extends Service
] ]
] ]
*/ */
public function getMenuData(){ protected function actionGetMenuData(){
$this->_homeUrl = CUrl::getHomeUrl(); $this->_homeUrl = CUrl::getHomeUrl();
$arr = []; $arr = [];
if($displayHome = $this->displayHome){ if($displayHome = $this->displayHome){
......
...@@ -25,7 +25,7 @@ class Newsletter extends Service ...@@ -25,7 +25,7 @@ class Newsletter extends Service
/** /**
* newsletter subscription * newsletter subscription
*/ */
public function subscription($email){ protected function actionSubscription($email){
$mongoNewsletter = new MongoNewsletter(); $mongoNewsletter = new MongoNewsletter();
$mongoNewsletter->attributes = [ $mongoNewsletter->attributes = [
'email' => $email, 'email' => $email,
...@@ -58,7 +58,7 @@ class Newsletter extends Service ...@@ -58,7 +58,7 @@ class Newsletter extends Service
* @property $filter|array * @property $filter|array
* get subscription email collection * get subscription email collection
*/ */
public function getSubscriptionList($filter){ protected function actionGetSubscriptionList($filter){
} }
......
...@@ -45,7 +45,7 @@ class Theme extends Service ...@@ -45,7 +45,7 @@ class Theme extends Service
protected $_themeDirArr; protected $_themeDirArr;
public function getThemeDirArr(){ protected function actionGetThemeDirArr(){
if(!$this->_themeDirArr){ if(!$this->_themeDirArr){
$arr = []; $arr = [];
if($localThemeDir = Yii::getAlias($this->localThemeDir)){ if($localThemeDir = Yii::getAlias($this->localThemeDir)){
...@@ -67,7 +67,7 @@ class Theme extends Service ...@@ -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. * 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); $view = trim($view);
if(substr($view,0,1) == '@'){ if(substr($view,0,1) == '@'){
return Yii::getAlias($view); return Yii::getAlias($view);
......
...@@ -38,7 +38,7 @@ class Translate extends Service ...@@ -38,7 +38,7 @@ class Translate extends Service
} }
} }
public function setLanguage($language){ protected function actionSetLanguage($language){
Yii::$app->language = $language; Yii::$app->language = $language;
} }
......
...@@ -43,7 +43,7 @@ class Widget extends Service ...@@ -43,7 +43,7 @@ class Widget extends Service
] ]
] ]
*/ */
public function render($configKey,$parentThis=''){ protected function actionRender($configKey,$parentThis=''){
$config = ''; $config = '';
if(is_array($configKey)){ if(is_array($configKey)){
$config = $configKey; $config = $configKey;
...@@ -59,33 +59,7 @@ class Widget extends Service ...@@ -59,33 +59,7 @@ class Widget extends Service
return $this->renderContent($configKey,$config,$parentThis); return $this->renderContent($configKey,$config,$parentThis);
} }
protected function actionRenderContentHtml($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=''){
if( !isset($config['view']) || empty($config['view']) if( !isset($config['view']) || empty($config['view'])
){ ){
throw new InvalidConfigException('view and class must exist in array config!'); throw new InvalidConfigException('view and class must exist in array config!');
...@@ -120,6 +94,34 @@ class Widget extends Service ...@@ -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. * find theme file by mutil theme ,if not find view file and $throwError=true, it will throw InvalidValueException.
*/ */
......
...@@ -21,7 +21,7 @@ class BestSell extends Service ...@@ -21,7 +21,7 @@ class BestSell extends Service
* 得到全部产品中热销的产品 * 得到全部产品中热销的产品
*/ */
public function getCategoryProduct() protected function actionGetCategoryProduct()
{ {
return 'category best sell product'; return 'category best sell product';
} }
...@@ -29,7 +29,7 @@ class BestSell extends Service ...@@ -29,7 +29,7 @@ class BestSell extends Service
/** /**
* 得到全部产品中热销的产品 * 得到全部产品中热销的产品
*/ */
public function getProduct(){ protected function actionGetProduct(){
} }
......
...@@ -56,7 +56,7 @@ class Coll extends Service ...@@ -56,7 +56,7 @@ class Coll extends Service
* 'asArray' => true, * 'asArray' => true,
* ] * ]
*/ */
public function getProducts($filter){ protected function actionGetProducts($filter){
$numPerPage = isset($filter['numPerPage']) ? $filter['numPerPage'] : $this->numPerPage; $numPerPage = isset($filter['numPerPage']) ? $filter['numPerPage'] : $this->numPerPage;
$pageNum = isset($filter['pageNum']) ? $filter['pageNum'] : $this->pageNum; $pageNum = isset($filter['pageNum']) ? $filter['pageNum'] : $this->pageNum;
$orderBy = isset($filter['orderBy']) ? $filter['orderBy'] : $this->orderBy; $orderBy = isset($filter['orderBy']) ? $filter['orderBy'] : $this->orderBy;
......
...@@ -70,7 +70,7 @@ class Image extends Service ...@@ -70,7 +70,7 @@ class Image extends Service
* return , if success ,return image saved relative file path , like '/b/i/big.jpg' * return , if success ,return image saved relative file path , like '/b/i/big.jpg'
* if fail, reutrn false; * if fail, reutrn false;
*/ */
public function saveProductUploadImg($param_img_file){ protected function actionSaveProductUploadImg($param_img_file){
$this->initUploadImage(); $this->initUploadImage();
$size = $param_img_file['size']; $size = $param_img_file['size'];
$file = $param_img_file['tmp_name']; $file = $param_img_file['tmp_name'];
......
...@@ -30,7 +30,7 @@ class Info extends Service ...@@ -30,7 +30,7 @@ class Info extends Service
* image will return full image url * image will return full image url
* this function will be use for front product info page. * this function will be use for front product info page.
*/ */
public function getProduct($productId='',$selectAttr=[]) protected function actionGetProduct($productId='',$selectAttr=[])
{ {
//echo 33;exit; //echo 33;exit;
if(!$this->_product){ if(!$this->_product){
...@@ -59,7 +59,7 @@ class Info extends Service ...@@ -59,7 +59,7 @@ class Info extends Service
* @property $product is object. * @property $product is object.
* convert product language attribute to current language value. * convert product language attribute to current language value.
*/ */
public function getCurrentLangProduct($product){ protected function actionGetCurrentLangProduct($product){
$lang_attrs = $this->getLangAttr(); $lang_attrs = $this->getLangAttr();
foreach($lang_attrs as $attr){ foreach($lang_attrs as $attr){
$product->$attr = Yii::$service->store->getLangVal($product->$attr,$attr); $product->$attr = Yii::$service->store->getLangVal($product->$attr,$attr);
...@@ -69,7 +69,7 @@ class Info extends Service ...@@ -69,7 +69,7 @@ class Info extends Service
/** /**
* product language attributes array. * product language attributes array.
*/ */
public function getLangAttr(){ protected function actionGetLangAttr(){
return [ return [
'name', 'name',
'title', 'title',
......
...@@ -34,20 +34,20 @@ class Rewrite extends Service ...@@ -34,20 +34,20 @@ class Rewrite extends Service
} }
} }
public function actionGetOriginUrl($urlKey){ protected function actionGetOriginUrl($urlKey){
return $this->_urlRewrite->getOriginUrl($urlKey); return $this->_urlRewrite->getOriginUrl($urlKey);
} }
/** /**
* get artile's primary key. * get artile's primary key.
*/ */
public function actionGetPrimaryKey(){ protected function actionGetPrimaryKey(){
return $this->_urlRewrite->getPrimaryKey(); return $this->_urlRewrite->getPrimaryKey();
} }
/** /**
* get artile model by primary key. * get artile model by primary key.
*/ */
public function actionGetByPrimaryKey($primaryKey){ protected function actionGetByPrimaryKey($primaryKey){
return $this->_urlRewrite->getByPrimaryKey($primaryKey); return $this->_urlRewrite->getByPrimaryKey($primaryKey);
} }
...@@ -73,7 +73,7 @@ class Rewrite extends Service ...@@ -73,7 +73,7 @@ class Rewrite extends Service
* 'asArray' => true, * 'asArray' => true,
* ] * ]
*/ */
public function actionColl($filter=''){ protected function actionColl($filter=''){
return $this->_urlRewrite->coll($filter); return $this->_urlRewrite->coll($filter);
} }
...@@ -82,24 +82,24 @@ class Rewrite extends Service ...@@ -82,24 +82,24 @@ class Rewrite extends Service
* @property $originUrlKey|String , article origin url key. * @property $originUrlKey|String , article origin url key.
* save $data to cms model,then,add url rewrite info to system service urlrewrite. * 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); return $this->_urlRewrite->save($one);
} }
public function actionRemove($ids){ protected function actionRemove($ids){
return $this->_urlRewrite->remove($ids); return $this->_urlRewrite->remove($ids);
} }
public function actionFind(){ protected function actionFind(){
return $this->_urlRewrite->find(); return $this->_urlRewrite->find();
} }
public function actionFindOne($where){ protected function actionFindOne($where){
return $this->_urlRewrite->findOne($where); return $this->_urlRewrite->findOne($where);
} }
public function actionNewModel(){ protected function actionNewModel(){
return $this->_urlRewrite->newModel(); return $this->_urlRewrite->newModel();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册