Skip to content

Commit f3f8cac

Browse files
兼容php5的处理
1 parent 417c51f commit f3f8cac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+123
-60
lines changed

components/ServiceLog.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class ServiceLog extends Component
3030
protected $_logModelName = '\fecshop\models\mongodb\FecshopServiceLog';
3131
protected $_logModel;
3232

33-
public function __construct(){
33+
public function init(){
34+
parent::init();
3435
list($this->_logModelName,$this->_logModel) = Yii::mapGet($this->_logModelName);
3536
}
3637
/**

services/AdminUser.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class AdminUser extends Service
2323
protected $_adminUserLoginModel;
2424

2525

26-
public function __construct(){
26+
public function init(){
27+
parent::init();
2728
list($this->_adminUserLoginModelName,$this->_adminUserLoginModel) = \Yii::mapGet($this->_adminUserLoginModelName);
2829

2930
}

services/Category.php

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Category extends Service
3939
*/
4040
public function init()
4141
{
42+
parent::init();
4243
$currentService = $this->getStorageService($this);
4344
$this->_category = new $currentService();
4445
/*

services/Customer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class Customer extends Service
3232
protected $_customerRegisterModelName = '\fecshop\models\mysqldb\customer\CustomerRegister';
3333
protected $_customerRegisterModel;
3434

35-
public function __construct(){
35+
public function init(){
36+
parent::init();
3637
list($this->_customerModelName,$this->_customerModel) = \Yii::mapGet($this->_customerModelName);
3738
list($this->_customerLoginModelName,$this->_customerLoginModel) = \Yii::mapGet($this->_customerLoginModelName);
3839
list($this->_customerRegisterModelName,$this->_customerRegisterModel) = \Yii::mapGet($this->_customerRegisterModelName);

services/Order.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class Order extends Service
6565
protected $_orderModelName = '\fecshop\models\mysqldb\Order';
6666
protected $_orderModel;
6767

68-
public function __construct(){
68+
public function init(){
69+
parent::init();
6970
list($this->_orderModelName,$this->_orderModel) = \Yii::mapGet($this->_orderModelName);
7071
}
7172

@@ -753,7 +754,7 @@ protected function actionReturnPendingStock()
753754
$logMessage[] = 'cancel order[begin] increment_id: '.$one['increment_id'];
754755
$order_id = $one['order_id'];
755756

756-
$updateComules = $one::updateAll(
757+
$updateComules = $one->updateAll(
757758
[
758759
'if_is_return_stock' => 1,
759760
'order_status' => $this->payment_status_canceled,

services/Product.php

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Product extends Service
4040

4141
public function init()
4242
{
43+
parent::init();
4344
$currentService = $this->getStorageService($this);
4445
$this->_product = new $currentService();
4546
/*

services/Request.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class Request extends \yii\web\Request
2727
protected $_urlRewriteModelName = '\fecshop\models\mongodb\UrlRewrite';
2828
protected $_urlRewriteModel;
2929

30-
public function __construct(){
30+
public function init(){
31+
parent::init();
3132
list($this->_urlRewriteModelName,$this->_urlRewriteModel) = \Yii::mapGet($this->_urlRewriteModelName);
3233
}
3334
/**

services/Session.php

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Session extends Service
5252
*/
5353
public function init()
5454
{
55+
parent::init();
5556
if(\Yii::$app->user->enableSession == true){
5657
$this->_session = new SessionPhp; // phpsession
5758
}else {

services/cart/Coupon.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class Coupon extends Service
3232
protected $_couponUsageModelName = '\fecshop\models\mysqldb\cart\CouponUsage';
3333
protected $_couponUsageModel;
3434

35-
public function __construct(){
35+
public function init(){
36+
parent::init();
3637
list($this->_couponModelName,$this->_couponModel) = Yii::mapGet($this->_couponModelName);
3738
list($this->_couponUsageModelName,$this->_couponUsageModel) = Yii::mapGet($this->_couponUsageModelName);
3839
}

services/cart/Quote.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class Quote extends Service
3232
*/
3333
protected $cartInfo;
3434

35-
public function __construct(){
35+
public function init(){
36+
parent::init();
3637
list($this->_cartModelName,$this->_cartModel) = Yii::mapGet($this->_cartModelName);
3738
}
3839
/**

services/cart/QuoteItem.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class QuoteItem extends Service
2626
protected $_itemModelName = '\fecshop\models\mysqldb\cart\Item';
2727
protected $_itemModel;
2828

29-
public function __construct(){
29+
public function init(){
30+
parent::init();
3031
list($this->_itemModelName,$this->_itemModel) = Yii::mapGet($this->_itemModelName);
3132
}
3233

services/category/CategoryMongodb.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@
99

1010
namespace fecshop\services\category;
1111

12-
//use fecshop\models\mongodb\Category;
12+
use fecshop\services\Service;
1313
use Yii;
1414

1515
/**
1616
* @author Terry Zhao <2358269014@qq.com>
1717
* @since 1.0
1818
*/
19-
class CategoryMongodb implements CategoryInterface
19+
class CategoryMongodb extends Service implements CategoryInterface
2020
{
2121
public $numPerPage = 20;
2222

2323
protected $_categoryModelName = '\fecshop\models\mongodb\Category';
2424
protected $_categoryModel;
2525

26-
public function __construct(){
26+
public function init(){
27+
parent::init();
2728
list($this->_categoryModelName,$this->_categoryModel) = Yii::mapGet($this->_categoryModelName);
2829
}
2930

services/category/CategoryMysqldb.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@
1010
namespace fecshop\services\category;
1111

1212
use fecshop\models\mongodb\Category;
13+
use fecshop\services\Service;
1314
use Yii;
1415

1516
/**
1617
* @author Terry Zhao <2358269014@qq.com>
1718
* @since 1.0
1819
*/
19-
class CategoryMysqldb implements CategoryInterface
20+
class CategoryMysqldb extends Service implements CategoryInterface
2021
{
22+
public $numPerPage = 20;
23+
24+
protected $_categoryModelName = '\fecshop\models\mysqldb\Category';
25+
protected $_categoryModel;
26+
27+
public function init(){
28+
parent::init();
29+
list($this->_categoryModelName,$this->_categoryModel) = Yii::mapGet($this->_categoryModelName);
30+
}
2131

2232
public function getByPrimaryKey($primaryKey){
2333

services/category/Menu.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Menu extends Service
2323
protected $_categoryModelName = '\fecshop\models\mongodb\Category';
2424
protected $_categoryModel;
2525

26-
public function __construct(){
26+
public function init(){
27+
parent::init();
2728
list($this->_categoryModelName,$this->_categoryModel) = Yii::mapGet($this->_categoryModelName);
2829
}
2930
/**

services/cms/Article.php

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Article extends Service
3636

3737
public function init()
3838
{
39+
parent::init();
3940
$currentService = $this->getStorageService($this);
4041
$this->_article = new $currentService();
4142
/*

services/cms/StaticBlock.php

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Staticblock extends Service
3939
*/
4040
public function init()
4141
{
42+
parent::init();
4243
$currentService = $this->getStorageService($this);
4344
$this->_static_block = new $currentService();
4445
/*

services/cms/article/ArticleMongodb.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@
1212
//use fecshop\models\mongodb\cms\Article;
1313
use Yii;
1414
use yii\base\InvalidValueException;
15+
use fecshop\services\Service;
1516

1617
/**
1718
* @author Terry Zhao <2358269014@qq.com>
1819
* @since 1.0
1920
*/
20-
class ArticleMongodb implements ArticleInterface
21+
class ArticleMongodb extends Service implements ArticleInterface
2122
{
2223
public $numPerPage = 20;
2324
protected $_articleModelName = '\fecshop\models\mongodb\cms\Article';
2425
protected $_articleModel;
2526

26-
public function __construct(){
27+
public function init(){
28+
parent::init();
2729
list($this->_articleModelName,$this->_articleModel) = Yii::mapGet($this->_articleModelName);
2830
}
2931

services/cms/article/ArticleMysqldb.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@
1212
//use fecshop\models\mysqldb\cms\Article;
1313
use Yii;
1414
use yii\base\InvalidValueException;
15+
use fecshop\services\Service;
1516

1617
/**
1718
* @author Terry Zhao <2358269014@qq.com>
1819
* @since 1.0
1920
*/
20-
class ArticleMysqldb implements ArticleInterface
21+
class ArticleMysqldb extends Service implements ArticleInterface
2122
{
2223
public $numPerPage = 20;
2324
protected $_articleModelName = '\fecshop\models\mysqldb\cms\Article';
2425
protected $_articleModel;
2526

26-
public function __construct(){
27+
public function init(){
28+
parent::init();
2729
list($this->_articleModelName,$this->_articleModel) = Yii::mapGet($this->_articleModelName);
2830
}
2931
/**

services/cms/staticblock/StaticBlockMongodb.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@
1111

1212
//use fecshop\models\mongodb\cms\StaticBlock;
1313
use Yii;
14+
use fecshop\services\Service;
1415

1516
/**
1617
* staticBlock部分,mongodb的实现部分。
1718
* @author Terry Zhao <2358269014@qq.com>
1819
* @since 1.0
1920
*/
20-
class StaticBlockMongodb implements StaticBlockInterface
21+
class StaticBlockMongodb extends Service implements StaticBlockInterface
2122
{
2223
public $numPerPage = 20;
2324
protected $_staticBlockModelName = '\fecshop\models\mongodb\cms\StaticBlock';
2425
protected $_staticBlockModel;
2526

26-
public function __construct(){
27+
public function init(){
28+
parent::init();
2729
list($this->_staticBlockModelName,$this->_staticBlockModel) = Yii::mapGet($this->_staticBlockModelName);
2830
}
2931
public function getPrimaryKey()

services/cms/staticblock/StaticBlockMysqldb.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212
//use fecshop\models\mysqldb\cms\StaticBlock;
1313
use Yii;
14+
use fecshop\services\Service;
1415

1516
/**
1617
* @author Terry Zhao <2358269014@qq.com>
1718
* @since 1.0
1819
*/
19-
class StaticBlockMysqldb implements StaticBlockInterface
20+
class StaticBlockMysqldb extends Service implements StaticBlockInterface
2021
{
2122
public $numPerPage = 20;
2223
protected $_staticBlockModelName = '\fecshop\models\mysqldb\cms\StaticBlock';
@@ -29,7 +30,8 @@ class StaticBlockMysqldb implements StaticBlockInterface
2930
'content',
3031
];
3132

32-
public function __construct(){
33+
public function init(){
34+
parent::init();
3335
list($this->_staticBlockModelName,$this->_staticBlockModel) = Yii::mapGet($this->_staticBlockModelName);
3436
}
3537

services/customer/Address.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class Address extends Service
2525
protected $_addressModelName = '\fecshop\models\mysqldb\customer\Address';
2626
protected $_addressModel;
2727

28-
public function __construct(){
28+
public function init(){
29+
parent::init();
2930
list($this->_addressModelName,$this->_addressModel) = \Yii::mapGet($this->_addressModelName);
3031
}
3132

services/customer/Newsletter.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Newsletter extends Service
2323
protected $_newsletterModelName = '\fecshop\models\mongodb\customer\Newsletter';
2424
protected $_newsletterModel;
2525

26-
public function __construct(){
26+
public function init(){
27+
parent::init();
2728
list($this->_newsletterModelName,$this->_newsletterModel) = Yii::mapGet($this->_newsletterModelName);
2829
}
2930
/**

services/email/Customer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
namespace fecshop\services\email;
1111

1212
use Yii;
13-
13+
use fecshop\services\Service;
1414
/**
1515
* customer email services
1616
* @author Terry Zhao <2358269014@qq.com>
1717
* @since 1.0
1818
*/
19-
class Customer
19+
class Customer extends Service
2020
{
2121
/**
2222
* 邮件模板部分配置.

services/email/Order.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
namespace fecshop\services\email;
1111

1212
use Yii;
13+
use fecshop\services\Service;
1314

1415
/**
1516
* @author Terry Zhao <2358269014@qq.com>
1617
* @since 1.0
1718
*/
18-
class Order
19+
class Order extends Service
1920
{
2021
/**
2122
* 邮件模板部分配置.

services/helper/Captcha.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class Captcha extends Service
3434
* 1. 生成图片,.
3535
*/
3636
//构造方法初始化
37-
public function __construct()
37+
public function init()
3838
{
39+
parent::init();
3940
$this->font = dirname(__FILE__).'/captcha/Elephant.ttf'; //注意字体路径要写对,否则显示不了图片
4041
}
4142

services/helper/ErrorHandler.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class ErrorHandler extends Service
2222
protected $_errorHandlerModelName = '\fecshop\models\mongodb\ErrorHandlerLog';
2323
protected $_errorHandlerModel;
2424

25-
public function __construct(){
25+
public function init(){
26+
parent::init();
2627
list($this->_errorHandlerModelName,$this->_errorHandlerModel) = \Yii::mapGet($this->_errorHandlerModelName);
2728
}
2829

services/helper/MobileDetect.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
namespace fecshop\services\helper;
2929

30-
class MobileDetect
30+
use fecshop\services\Service;
31+
32+
class MobileDetect extends Service
3133
{
3234
/**
3335
* Mobile detection type.

services/order/Item.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Item extends Service
2323
protected $_itemModelName = '\fecshop\models\mysqldb\order\Item';
2424
protected $_itemModel;
2525

26-
public function __construct(){
26+
public function init(){
27+
parent::init();
2728
list($this->_itemModelName,$this->_itemModel) = \Yii::mapGet($this->_itemModelName);
2829
}
2930
/**

services/page/Breadcrumbs.php

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Breadcrumbs extends Service
2727

2828
public function init()
2929
{
30+
parent::init();
3031
if ($this->active) {
3132
if ($this->homeName) {
3233
$items['name'] = $this->homeName;

services/page/Newsletter.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class Newsletter extends Service
2222
protected $_newsletterModelName = '\fecshop\models\mongodb\customer\Newsletter';
2323
protected $_newsletterModel;
2424

25-
public function __construct(){
25+
public function init(){
26+
parent::init();
2627
list($this->_newsletterModelName,$this->_newsletterModel) = \Yii::mapGet($this->_newsletterModelName);
2728
}
2829
/**

0 commit comments

Comments
 (0)