From f7839d10a0f47e4c6f06427b5f7aced7e53725cb Mon Sep 17 00:00:00 2001
From: Terry <2358269014@qq.com>
Date: Wed, 26 Jul 2017 11:12:26 +0800
Subject: [PATCH] =?UTF-8?q?php5=E5=92=8Cphp7=E7=9A=84=E5=8D=87=E7=BA=A7?=
=?UTF-8?q?=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/Catalog/block/product/Index.php | 5 +-
.../modules/Catalog/block/product/Review.php | 4 +-
.../Catalog/block/reviewproduct/Add.php | 4 +-
.../Catalog/block/reviewproduct/Lists.php | 7 +-
.../modules/Catalog/block/product/Index.php | 5 +-
.../modules/Catalog/block/product/Review.php | 3 +-
.../Catalog/block/reviewproduct/Add.php | 3 +-
.../Catalog/block/reviewproduct/Lists.php | 6 +-
services/Customer.php | 26 +++----
services/Order.php | 22 +++---
services/Request.php | 2 +-
services/cart/Coupon.php | 34 ++++-----
services/cart/Quote.php | 10 +--
services/cart/QuoteItem.php | 18 ++---
services/category/CategoryMongodb.php | 37 +++++-----
services/category/Menu.php | 10 +--
services/cms/article/ArticleMongodb.php | 10 +--
services/cms/article/ArticleMysqldb.php | 10 +--
.../cms/staticblock/StaticBlockMongodb.php | 14 ++--
.../cms/staticblock/StaticBlockMysqldb.php | 14 ++--
services/customer/Address.php | 22 +++---
services/customer/Newsletter.php | 7 +-
services/helper/Log.php | 2 +-
services/order/Item.php | 4 +-
services/page/Newsletter.php | 2 +-
services/product/Favorite.php | 14 ++--
services/product/ProductMongodb.php | 51 +++++++-------
services/product/Review.php | 70 +++++++++++--------
services/product/Stock.php | 46 ++++++------
services/product/viewLog/Db.php | 4 +-
services/product/viewLog/Mongodb.php | 6 +-
services/search/MongoSearch.php | 43 +++++++-----
services/search/XunSearch.php | 14 ++--
services/session/MysqlDbSession.php | 8 +--
services/url/rewrite/RewriteMongodb.php | 18 ++---
services/url/rewrite/RewriteMysqldb.php | 18 ++---
36 files changed, 301 insertions(+), 272 deletions(-)
diff --git a/app/appfront/modules/Catalog/block/product/Index.php b/app/appfront/modules/Catalog/block/product/Index.php
index 1d986371f..0d5e7b6b6 100644
--- a/app/appfront/modules/Catalog/block/product/Index.php
+++ b/app/appfront/modules/Catalog/block/product/Index.php
@@ -50,14 +50,15 @@ public function __construct()
public function getLastData()
{
+ $reviewHelper = $this->_reviewHelper;
$productImgSize = Yii::$app->controller->module->params['productImgSize'];
$productImgMagnifier = Yii::$app->controller->module->params['productImgMagnifier'];
if(!$this->initProduct()){
Yii::$service->url->redirect404();
return;
}
- $this->_reviewHelper::initReviewConfig();
- $ReviewAndStarCount = $this->_reviewHelper::getReviewAndStarCount($this->_product);
+ $reviewHelper::initReviewConfig();
+ $ReviewAndStarCount = $reviewHelper::getReviewAndStarCount($this->_product);
list($review_count, $reviw_rate_star_average) = $ReviewAndStarCount;
$this->filterProductImg($this->_product['image']);
$groupAttr = Yii::$service->product->getGroupAttr($this->_product['attr_group']);
diff --git a/app/appfront/modules/Catalog/block/product/Review.php b/app/appfront/modules/Catalog/block/product/Review.php
index 27a76e15b..9f1590029 100644
--- a/app/appfront/modules/Catalog/block/product/Review.php
+++ b/app/appfront/modules/Catalog/block/product/Review.php
@@ -35,9 +35,9 @@ public function __construct()
* 通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
-
+ $reviewHelper = $this->_reviewHelper;
// 初始化当前appfront的设置,覆盖service的初始设置。
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper::initReviewConfig();
}
/**
* 得到当前spu下面的所有评论信息。
diff --git a/app/appfront/modules/Catalog/block/reviewproduct/Add.php b/app/appfront/modules/Catalog/block/reviewproduct/Add.php
index 58f18507c..8885a9b57 100644
--- a/app/appfront/modules/Catalog/block/reviewproduct/Add.php
+++ b/app/appfront/modules/Catalog/block/reviewproduct/Add.php
@@ -31,8 +31,8 @@ public function __construct()
* 通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
-
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
}
/**
* @return boolean , review页面是否开启验证码验证。
diff --git a/app/appfront/modules/Catalog/block/reviewproduct/Lists.php b/app/appfront/modules/Catalog/block/reviewproduct/Lists.php
index b999f47b3..9cf0f3e39 100644
--- a/app/appfront/modules/Catalog/block/reviewproduct/Lists.php
+++ b/app/appfront/modules/Catalog/block/reviewproduct/Lists.php
@@ -37,8 +37,8 @@ public function __construct()
* 通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
-
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
}
/**
* @property $countTotal | Int
@@ -97,7 +97,8 @@ public function getLastData()
$pageToolBar = $this->getProductPage($count);
$coll = $data['coll'];
- $ReviewAndStarCount = $this->_reviewHelper::getReviewAndStarCount($product);
+ $reviewHelper = $this->_reviewHelper;
+ $ReviewAndStarCount = $reviewHelper::getReviewAndStarCount($product);
list($review_count, $reviw_rate_star_average) = $ReviewAndStarCount;
return [
diff --git a/app/apphtml5/modules/Catalog/block/product/Index.php b/app/apphtml5/modules/Catalog/block/product/Index.php
index d6c96db41..3664b5157 100644
--- a/app/apphtml5/modules/Catalog/block/product/Index.php
+++ b/app/apphtml5/modules/Catalog/block/product/Index.php
@@ -54,8 +54,9 @@ public function getLastData()
Yii::$service->url->redirect404();
return;
}
- $this->_reviewHelper::initReviewConfig();
- $ReviewAndStarCount = $this->_reviewHelper::getReviewAndStarCount($this->_product);
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
+ $ReviewAndStarCount = $reviewHelper::getReviewAndStarCount($this->_product);
list($review_count, $reviw_rate_star_average) = $ReviewAndStarCount;
$this->filterProductImg($this->_product['image']);
$groupAttr = Yii::$service->product->getGroupAttr($this->_product['attr_group']);
diff --git a/app/apphtml5/modules/Catalog/block/product/Review.php b/app/apphtml5/modules/Catalog/block/product/Review.php
index 65b6c4f32..8cf92a0b4 100644
--- a/app/apphtml5/modules/Catalog/block/product/Review.php
+++ b/app/apphtml5/modules/Catalog/block/product/Review.php
@@ -35,7 +35,8 @@ public function __construct()
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
// 初始化当前apphtml5的设置,覆盖service的初始设置。
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
}
/**
diff --git a/app/apphtml5/modules/Catalog/block/reviewproduct/Add.php b/app/apphtml5/modules/Catalog/block/reviewproduct/Add.php
index 7b13a624a..9926ceb2a 100644
--- a/app/apphtml5/modules/Catalog/block/reviewproduct/Add.php
+++ b/app/apphtml5/modules/Catalog/block/reviewproduct/Add.php
@@ -31,7 +31,8 @@ public function __construct()
* 通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
}
/**
diff --git a/app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php b/app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
index 5690177d7..ed8d7ff20 100644
--- a/app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
+++ b/app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
@@ -38,7 +38,8 @@ public function __construct()
*/
list($this->_reviewHelperName,$this->_reviewHelper) = Yii::mapGet($this->_reviewHelperName);
// 初始化服务
- $this->_reviewHelper::initReviewConfig();
+ $reviewHelper = $this->_reviewHelper;
+ $reviewHelper::initReviewConfig();
}
/**
* @property $countTotal | Int
@@ -97,7 +98,8 @@ public function getLastData()
$pageToolBar = $this->getProductPage($count);
$coll = $data['coll'];
- $ReviewAndStarCount = $this->_reviewHelper::getReviewAndStarCount($product);
+ $reviewHelper = $this->_reviewHelper;
+ $ReviewAndStarCount = $reviewHelper::getReviewAndStarCount($product);
list($review_count, $reviw_rate_star_average) = $ReviewAndStarCount;
return [
diff --git a/services/Customer.php b/services/Customer.php
index 7f6f27174..dd802d415 100644
--- a/services/Customer.php
+++ b/services/Customer.php
@@ -132,7 +132,7 @@ protected function actionRegister($param)
*/
protected function actionIsRegistered($email)
{
- $customer = $this->_customerModel::findOne(['email' => $email]);
+ $customer = $this->_customerModel->findOne(['email' => $email]);
if ($customer['email']) {
return true;
} else {
@@ -190,10 +190,10 @@ protected function actionChangePassword($password, $identity)
{
if (is_int($identity)) {
$customer_id = $identity;
- $customerModel = $this->_customerModel::findIdentity($customer_id);
+ $customerModel = $this->_customerModel->findIdentity($customer_id);
} elseif (is_string($identity)) {
$email = $identity;
- $customerModel = $this->_customerModel::findByEmail($email);
+ $customerModel = $this->_customerModel->findByEmail($email);
} elseif (is_object($identity)) {
$customerModel = $identity;
}
@@ -222,7 +222,7 @@ protected function actionGetModelName()
protected function actionGetByPrimaryKey($val)
{
if ($val) {
- $one = $this->_customerModel::findOne($val);
+ $one = $this->_customerModel->findOne($val);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
@@ -242,10 +242,10 @@ protected function actionChangePasswordAndClearToken($password, $identity)
{
if (is_int($identity)) {
$customer_id = $identity;
- $customerModel = $this->_customerModel::findIdentity($customer_id);
+ $customerModel = $this->_customerModel->findIdentity($customer_id);
} elseif (is_string($identity)) {
$email = $identity;
- $customerModel = $this->_customerModel::findByEmail($email);
+ $customerModel = $this->_customerModel->findByEmail($email);
} elseif (is_object($identity)) {
$customerModel = $identity;
} else {
@@ -286,7 +286,7 @@ protected function actionGetCurrentAccount()
*/
protected function actionGetUserIdentityByEmail($email)
{
- $one = $this->_customerModel::findByEmail($email);
+ $one = $this->_customerModel->findByEmail($email);
if ($one['email']) {
return $one;
} else {
@@ -324,7 +324,7 @@ protected function actionGeneratePasswordResetToken($identify)
*/
protected function actionFindByPasswordResetToken($token)
{
- return $this->_customerModel::findByPasswordResetToken($token);
+ return $this->_customerModel->findByPasswordResetToken($token);
}
/**
@@ -379,7 +379,8 @@ protected function actionLoginSuccessRedirect($urlKey = '')
*/
protected function actionGetStatusDeleted()
{
- return $this->_customerModel::STATUS_DELETED;
+ $model = $this->_customerModel;
+ return $model::STATUS_DELETED;
}
/**
@@ -387,7 +388,8 @@ protected function actionGetStatusDeleted()
*/
protected function actionGetStatusActive()
{
- return $this->_customerModel::STATUS_ACTIVE;
+ $model = $this->_customerModel;
+ return $model::STATUS_ACTIVE;
}
/**
* 得到customer 表的主键(mysql表)
@@ -415,7 +417,7 @@ protected function actionGetPrimaryKey()
*/
protected function actionColl($filter = '')
{
- $query = $this->_customerModel::find();
+ $query = $this->_customerModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
//var_dump($query->all());exit;
return [
@@ -433,7 +435,7 @@ protected function actionGetEmailByIds($user_ids)
{
$arr = [];
if (is_array($user_ids) && !empty($user_ids)) {
- $data = $this->_customerModel::find()->where([
+ $data = $this->_customerModel->find()->where([
'in', 'id', $user_ids,
])->all();
if (is_array($data) && !empty($data)) {
diff --git a/services/Order.php b/services/Order.php
index 1f369bf37..a2e7244ed 100644
--- a/services/Order.php
+++ b/services/Order.php
@@ -138,7 +138,7 @@ protected function actionGetPrimaryKey()
*/
protected function actionGetByPrimaryKey($primaryKey)
{
- $one = $this->_orderModel::findOne($primaryKey);
+ $one = $this->_orderModel->findOne($primaryKey);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
@@ -154,7 +154,7 @@ protected function actionGetByPrimaryKey($primaryKey)
*/
protected function actionGetByIncrementId($increment_id)
{
- $one = $this->_orderModel::findOne(['increment_id' => $increment_id]);
+ $one = $this->_orderModel->findOne(['increment_id' => $increment_id]);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
@@ -219,7 +219,7 @@ protected function actionGetOrderInfoById($order_id)
if (!$order_id) {
return;
}
- $one = $this->_orderModel::findOne($order_id);
+ $one = $this->_orderModel->findOne($order_id);
$primaryKey = $this->getPrimaryKey();
if (!isset($one[$primaryKey]) || empty($one[$primaryKey])) {
return;
@@ -256,7 +256,7 @@ protected function actionGetOrderInfoById($order_id)
*/
protected function actionColl($filter = '')
{
- $query = $this->_orderModel::find();
+ $query = $this->_orderModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
$coll = $query->all();
@@ -276,7 +276,7 @@ protected function actionSave($one)
$primaryKey = $this->getPrimaryKey();
$primaryVal = isset($one[$primaryKey]) ? $one[$primaryKey] : '';
if ($primaryVal) {
- $model = $this->_orderModel::findOne($primaryVal);
+ $model = $this->_orderModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('order '.$this->getPrimaryKey().' is not exist');
@@ -308,7 +308,7 @@ protected function actionRemove($ids)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_orderModel::findOne($id);
+ $model = $this->_orderModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$model->delete();
} else {
@@ -319,7 +319,7 @@ protected function actionRemove($ids)
}
} else {
$id = $ids;
- $model = $this->_orderModel::findOne($id);
+ $model = $this->_orderModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$model->delete();
} else {
@@ -380,7 +380,7 @@ protected function actionGeneratePPExpressOrder($token){
* 通过token 得到订单 Object
*/
protected function actionGetByPaymentToken($token){
- $one = $this->_orderModel::find()->where(['payment_token' => $token])
+ $one = $this->_orderModel->find()->where(['payment_token' => $token])
->one();
if(isset($one['order_id']) && $one['order_id']){
return $one;
@@ -547,12 +547,12 @@ protected function actionGenerateOrderByCart($address, $shipping_method, $paymen
*/
protected function checkOrderVersion($increment_id){
# 更新订单版本号,防止被多次执行。
- $sql = 'update '.$this->_orderModel::tableName().' set version = version + 1 where increment_id = :increment_id';
+ $sql = 'update '.$this->_orderModel->tableName().' set version = version + 1 where increment_id = :increment_id';
$data = [
'increment_id' => $increment_id,
];
- $result = $this->_orderModel::getDb()->createCommand($sql,$data)->execute();
- $myOrder = $this->_orderModel::find()->where([
+ $result = $this->_orderModel->getDb()->createCommand($sql,$data)->execute();
+ $myOrder = $this->_orderModel->find()->where([
'increment_id' => $increment_id,
])->one();
# 如果版本号不等于1,则回滚
diff --git a/services/Request.php b/services/Request.php
index e468c8d08..042cb6c9d 100644
--- a/services/Request.php
+++ b/services/Request.php
@@ -131,7 +131,7 @@ public function setRequestParam($originUrlPath)
*/
protected function getOriginUrl($urlKey)
{
- $UrlData = $this->_urlRewriteModel::find()->where([
+ $UrlData = $this->_urlRewriteModel->find()->where([
'custom_url_key' => $urlKey,
])->asArray()->one();
if ($UrlData['custom_url_key']) {
diff --git a/services/cart/Coupon.php b/services/cart/Coupon.php
index 6022aeba1..5def0fedb 100644
--- a/services/cart/Coupon.php
+++ b/services/cart/Coupon.php
@@ -49,7 +49,7 @@ protected function actionGetPrimaryKey()
*/
protected function actionGetByPrimaryKey($primaryKey)
{
- $one = $this->_couponModel::findOne($primaryKey);
+ $one = $this->_couponModel->findOne($primaryKey);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
@@ -73,7 +73,7 @@ protected function actionGetCouponUsageModel($customer_id = '', $coupon_id = '')
$coupon_id = isset($couponModel['coupon_id']) ? $couponModel['coupon_id'] : '';
}
if ($customer_id && $coupon_id) {
- $one = $this->_couponUsageModel::findOne([
+ $one = $this->_couponUsageModel->findOne([
'customer_id' => $customer_id,
'coupon_id' => $coupon_id,
]);
@@ -97,7 +97,7 @@ protected function actionGetCouponModel($coupon_code = '')
$coupon_code = $this->_coupon_code;
}
if ($coupon_code) {
- $one = $this->_couponModel::findOne(['coupon_code' => $coupon_code]);
+ $one = $this->_couponModel->findOne(['coupon_code' => $coupon_code]);
if ($one['coupon_code']) {
$this->_coupon_model = $one;
}
@@ -127,7 +127,7 @@ protected function actionGetCouponModel($coupon_code = '')
*/
protected function actionColl($filter = '')
{
- $query = $this->_couponModel::find();
+ $query = $this->_couponModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
$coll = $query->all();
return [
@@ -145,13 +145,13 @@ protected function actionSave($one)
$primaryKey = $this->getPrimaryKey();
$primaryVal = isset($one[$primaryKey]) ? $one[$primaryKey] : '';
if ($primaryVal) {
- $model = $this->_couponModel::findOne($primaryVal);
+ $model = $this->_couponModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('coupon '.$this->getPrimaryKey().' is not exist');
return;
} else {
- $o_one = $this->_couponModel::find()
+ $o_one = $this->_couponModel->find()
->where(['coupon_code' =>$one['coupon_code']])
->andWhere(['!=', $primaryKey, $primaryVal])
->one();
@@ -162,7 +162,7 @@ protected function actionSave($one)
}
}
} else {
- $o_one = $this->_couponModel::find()
+ $o_one = $this->_couponModel->find()
->where(['coupon_code' =>$one['coupon_code']])
->one();
if ($o_one[$primaryKey]) {
@@ -203,7 +203,7 @@ protected function actionRemove($ids)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_couponModel::findOne($id);
+ $model = $this->_couponModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$model->delete();
} else {
@@ -214,7 +214,7 @@ protected function actionRemove($ids)
}
} else {
$id = $ids;
- $model = $this->_couponModel::findOne($id);
+ $model = $this->_couponModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$model->delete();
} else {
@@ -341,35 +341,35 @@ protected function updateCouponUse($type)
$cu_model->save();
} else {
// 通过update函数 将times_used +1
- $sql = 'update '.$this->_couponUsageModel::tableName().' set times_used = times_used + 1 where id = :id';
+ $sql = 'update '.$this->_couponUsageModel->tableName().' set times_used = times_used + 1 where id = :id';
$data = [
'id' => $cu_model['id'],
];
- $result = $this->_couponUsageModel::getDb()->createCommand($sql,$data)->execute();
+ $result = $this->_couponUsageModel->getDb()->createCommand($sql,$data)->execute();
}
// coupon的总使用次数+1
- $sql = 'update '.$this->_couponModel::tableName().' set times_used = times_used + 1 where coupon_id = :coupon_id ';
+ $sql = 'update '.$this->_couponModel->tableName().' set times_used = times_used + 1 where coupon_id = :coupon_id ';
$data = [
'coupon_id' => $c_model['coupon_id'],
];
- $result = $this->_couponModel::getDb()->createCommand($sql,$data)->execute();
+ $result = $this->_couponModel->getDb()->createCommand($sql,$data)->execute();
return true;
} elseif ($type == 'cancel') {
$couponModel = $this->getCouponModel();
$cu_model = $this->getCouponUsageModel();
if ($cu_model) {
// $this->_couponUsageModel 使用次数-1
- $sql = 'update '.$this->_couponUsageModel::tableName().' set times_used = times_used - 1 where id = :id';
+ $sql = 'update '.$this->_couponUsageModel->tableName().' set times_used = times_used - 1 where id = :id';
$data = [
'id' => $cu_model['id'],
];
- $result = $this->_couponUsageModel::getDb()->createCommand($sql,$data)->execute();
+ $result = $this->_couponUsageModel->getDb()->createCommand($sql,$data)->execute();
// $this->_couponModel 使用次数-1
- $sql = 'update '.$this->_couponModel::tableName().' set times_used = times_used - 1 where coupon_id = :coupon_id ';
+ $sql = 'update '.$this->_couponModel->tableName().' set times_used = times_used - 1 where coupon_id = :coupon_id ';
$data = [
'coupon_id' => $c_model['coupon_id'],
];
- $result = $this->_couponModel::getDb()->createCommand($sql,$data)->execute();
+ $result = $this->_couponModel->getDb()->createCommand($sql,$data)->execute();
return true;
}
diff --git a/services/cart/Quote.php b/services/cart/Quote.php
index a58cf1109..f79659b90 100644
--- a/services/cart/Quote.php
+++ b/services/cart/Quote.php
@@ -113,7 +113,7 @@ public function getCurrentCart()
if (!$this->_cart) {
$cart_id = $this->getCartId();
if ($cart_id) {
- $one = $this->_cartModel::findOne(['cart_id' => $cart_id]);
+ $one = $this->_cartModel->findOne(['cart_id' => $cart_id]);
if ($one['cart_id']) {
$this->_cart = $one;
}
@@ -135,7 +135,7 @@ public function getCart()
if (!$cart_id) {
$this->createCart();
} else {
- $one = $this->_cartModel::findOne(['cart_id' => $cart_id]);
+ $one = $this->_cartModel->findOne(['cart_id' => $cart_id]);
if ($one['cart_id']) {
$this->_cart = $one;
} else {
@@ -167,7 +167,7 @@ public function getCartItemCount()
if ($cart_id = $this->getCartId()) {
if($cart_id ){
$cart = $this->getCart();
- //$one = $this->_cartModel::findOne(['cart_id' => $cart_id]);
+ //$one = $this->_cartModel->findOne(['cart_id' => $cart_id]);
if (isset($cart['items_count']) && $cart['items_count']) {
$items_count = $cart['items_count'];
}
@@ -248,7 +248,7 @@ protected function actionCreateCart()
$myCart->save();
$cart_id = $myCart['cart_id'];
$this->setCartId($cart_id);
- $this->setCart($this->_cartModel::findOne($cart_id));
+ $this->setCart($this->_cartModel->findOne($cart_id));
}
/** 该函数已经废弃
@@ -533,7 +533,7 @@ public function mergeCartAfterUserLogin()
public function getCartByCustomerId($customer_id)
{
if ($customer_id) {
- $one = $this->_cartModel::findOne(['customer_id' => $customer_id]);
+ $one = $this->_cartModel->findOne(['customer_id' => $customer_id]);
if ($one['cart_id']) {
return $one;
}
diff --git a/services/cart/QuoteItem.php b/services/cart/QuoteItem.php
index 40b691979..358c8ffbd 100644
--- a/services/cart/QuoteItem.php
+++ b/services/cart/QuoteItem.php
@@ -60,7 +60,7 @@ public function addItem($item)
if (isset($item['custom_option_sku']) && !empty($item['custom_option_sku'])) {
$where['custom_option_sku'] = $item['custom_option_sku'];
}
- $item_one = $this->_itemModel::find()->where($where)->one();
+ $item_one = $this->_itemModel->find()->where($where)->one();
if ($item_one['cart_id']) {
$item_one->qty = $item['qty'] + $item_one['qty'];
$item_one->save();
@@ -96,7 +96,7 @@ public function changeItemQty($item)
{
$cart_id = Yii::$service->cart->quote->getCartId();
// 查看是否存在此产品,如果存在,则更改
- $item_one = $this->_itemModel::find()->where([
+ $item_one = $this->_itemModel->find()->where([
'cart_id' => $cart_id,
'product_id' => $item['product_id'],
'custom_option_sku' => $item['custom_option_sku'],
@@ -127,7 +127,7 @@ public function getItemQty()
$cart_id = Yii::$service->cart->quote->getCartId();
$item_qty = 0;
if ($cart_id) {
- $data = $this->_itemModel::find()->asArray()->where([
+ $data = $this->_itemModel->find()->asArray()->where([
'cart_id' => $cart_id,
])->all();
if (is_array($data) && !empty($data)) {
@@ -158,7 +158,7 @@ public function getCartProductInfo()
$product_weight = 0;
if ($cart_id) {
if (!isset($this->_cart_product_info[$cart_id])) {
- $data = $this->_itemModel::find()->where([
+ $data = $this->_itemModel->find()->where([
'cart_id' => $cart_id,
])->all();
if (is_array($data) && !empty($data)) {
@@ -254,7 +254,7 @@ public function addOneItem($item_id)
{
$cart_id = Yii::$service->cart->quote->getCartId();
if ($cart_id) {
- $one = $this->_itemModel::find()->where([
+ $one = $this->_itemModel->find()->where([
'cart_id' => $cart_id,
'item_id' => $item_id,
])->one();
@@ -280,7 +280,7 @@ public function lessOneItem($item_id)
{
$cart_id = Yii::$service->cart->quote->getCartId();
if ($cart_id) {
- $one = $this->_itemModel::find()->where([
+ $one = $this->_itemModel->find()->where([
'cart_id' => $cart_id,
'item_id' => $item_id,
])->one();
@@ -308,7 +308,7 @@ public function removeItem($item_id)
{
$cart_id = Yii::$service->cart->quote->getCartId();
if ($cart_id) {
- $one = $this->_itemModel::find()->where([
+ $one = $this->_itemModel->find()->where([
'cart_id' => $cart_id,
'item_id' => $item_id,
])->one();
@@ -336,7 +336,7 @@ public function removeItemByCartId($cart_id = '')
$cart_id = Yii::$service->cart->quote->getCartId();
}
if ($cart_id) {
- $items = $this->_itemModel::deleteAll([
+ $items = $this->_itemModel->deleteAll([
'cart_id' => $cart_id,
//'item_id' => $item_id,
]);
@@ -356,7 +356,7 @@ public function removeItemByCartId($cart_id = '')
public function updateCartId($new_cart_id, $cart_id)
{
if ($cart_id && $new_cart_id) {
- $this->_itemModel::updateAll(
+ $this->_itemModel->updateAll(
['cart_id'=>$new_cart_id], // $attributes
'cart_id = '.$cart_id // $condition
);
diff --git a/services/category/CategoryMongodb.php b/services/category/CategoryMongodb.php
index b23beb040..d26ee026b 100644
--- a/services/category/CategoryMongodb.php
+++ b/services/category/CategoryMongodb.php
@@ -33,7 +33,7 @@ public function __construct(){
public function getByPrimaryKey($primaryKey)
{
if ($primaryKey) {
- return $this->_categoryModel::findOne($primaryKey);
+ return $this->_categoryModel->findOne($primaryKey);
} else {
return new $this->_categoryModelName;
}
@@ -50,14 +50,15 @@ public function getPrimaryKey()
* 得到分类激活状态的值
*/
public function getCategoryEnableStatus(){
-
- return $this->_categoryModel::STATUS_ENABLE;
+ $model = $this->_categoryModel;
+ return $model::STATUS_ENABLE;
}
/**
* 得到分类在menu中显示的状态值
*/
public function getCategoryMenuShowStatus(){
- return $this->_categoryModel::MENU_SHOW;
+ $model = $this->_categoryModel;
+ return $model::MENU_SHOW;
}
@@ -77,7 +78,7 @@ public function getCategoryMenuShowStatus(){
*/
public function coll($filter = '')
{
- $query = $this->_categoryModel::find();
+ $query = $this->_categoryModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
return [
@@ -91,7 +92,7 @@ public function coll($filter = '')
*/
public function collCount($filter = '')
{
- $query = $this->_categoryModel::find();
+ $query = $this->_categoryModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
return $query->count();
@@ -107,7 +108,7 @@ public function save($one, $originUrlKey = 'catalog/category/index')
$currentDateTime = \fec\helpers\CDate::getCurrentDateTime();
$primaryVal = isset($one[$this->getPrimaryKey()]) ? $one[$this->getPrimaryKey()] : '';
if ($primaryVal) {
- $model = $this->_categoryModel::findOne($primaryVal);
+ $model = $this->_categoryModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('Category '.$this->getPrimaryKey().' is not exist');
@@ -126,7 +127,7 @@ public function save($one, $originUrlKey = 'catalog/category/index')
if ($parent_id === '0') {
$model['level'] = 1;
} else {
- $parent_model = $this->_categoryModel::findOne($parent_id);
+ $parent_model = $this->_categoryModel->findOne($parent_id);
if ($parent_level = $parent_model['level']) {
$model['level'] = $parent_level + 1;
}
@@ -159,7 +160,7 @@ public function remove($id)
return false;
}
- $model = $this->_categoryModel::findOne($id);
+ $model = $this->_categoryModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$url_key = $model['url_key'];
Yii::$service->url->removeRewriteUrlKey($url_key);
@@ -176,7 +177,7 @@ public function remove($id)
protected function removeChildCate($id)
{
- $data = $this->_categoryModel::find()->where(['parent_id'=>$id])->all();
+ $data = $this->_categoryModel->find()->where(['parent_id'=>$id])->all();
if (!empty($data)) {
foreach ($data as $one) {
$idVal = (string) $one['_id'];
@@ -206,7 +207,7 @@ public function getTreeArr($rootCategoryId = '', $lang = '')
} else {
$where = ['parent_id' => $rootCategoryId];
}
- $categorys = $this->_categoryModel::find()->asArray()->where($where)->all();
+ $categorys = $this->_categoryModel->find()->asArray()->where($where)->all();
//var_dump($categorys);exit;
$idKey = $this->getPrimaryKey();
if (!empty($categorys)) {
@@ -229,7 +230,7 @@ public function getTreeArr($rootCategoryId = '', $lang = '')
protected function hasChildCategory($idVal)
{
- $one = $this->_categoryModel::find()->asArray()->where(['parent_id'=>$idVal])->one();
+ $one = $this->_categoryModel->find()->asArray()->where(['parent_id'=>$idVal])->one();
if (!empty($one)) {
return true;
}
@@ -247,7 +248,7 @@ protected function hasChildCategory($idVal)
public function getAllParentInfo($parent_id)
{
if ($parent_id) {
- $parentModel = $this->_categoryModel::findOne($parent_id);
+ $parentModel = $this->_categoryModel->findOne($parent_id);
$parent_parent_id = $parentModel['parent_id'];
$parent_category = [];
if ($parent_parent_id !== '0') {
@@ -272,7 +273,7 @@ protected function getParentCategory($parent_id)
if ($parent_id === '0') {
return [];
}
- $category = $this->_categoryModel::find()->asArray()->where(['_id' => new \MongoDB\BSON\ObjectId($parent_id)])->one();
+ $category = $this->_categoryModel->find()->asArray()->where(['_id' => new \MongoDB\BSON\ObjectId($parent_id)])->one();
if (isset($category['_id']) && !empty($category['_id'])) {
$currentUrlKey = $category['url_key'];
$currentName = $category['name'];
@@ -306,7 +307,7 @@ public function getFilterCategory($category_id, $parent_id)
{
$returnData = [];
$primaryKey = $this->getPrimaryKey();
- $currentCategory = $this->_categoryModel::findOne($category_id);
+ $currentCategory = $this->_categoryModel->findOne($category_id);
$currentUrlKey = $currentCategory['url_key'];
$currentName = $currentCategory['name'];
$currentId = (string) $currentCategory['_id'];
@@ -337,7 +338,7 @@ protected function getOneLevelCateChild($category)
$_id = $category['_id'];
$name = $category['name'];
$url_key = $category['url_key'];
- $cate = $this->_categoryModel::find()->asArray()->where([
+ $cate = $this->_categoryModel->find()->asArray()->where([
'parent_id' => $_id,
])->all();
if (is_array($cate) && !empty($cate)) {
@@ -365,7 +366,7 @@ protected function getAllParentCate($allParent)
$category_id = $category['_id'];
$parent_id = $category['parent_id'];
if ($parent_id) {
- $cate = $this->_categoryModel::find()->asArray()->where([
+ $cate = $this->_categoryModel->find()->asArray()->where([
'parent_id' => $parent_id,
])->all();
//var_dump($cate);
@@ -404,7 +405,7 @@ protected function getAllParentCate($allParent)
protected function getChildCate($category_id)
{
//echo $category_id;
- $data = $this->_categoryModel::find()->asArray()->where([
+ $data = $this->_categoryModel->find()->asArray()->where([
'parent_id' => $category_id,
])->all();
$arr = [];
diff --git a/services/category/Menu.php b/services/category/Menu.php
index a84ed1711..f5156e411 100644
--- a/services/category/Menu.php
+++ b/services/category/Menu.php
@@ -32,17 +32,17 @@ public function __construct(){
*/
protected function actionGetCategoryMenuArr($parentId = '')
{
-
+ $model = $this->_categoryModel;
$arr = [];
if (!$parentId) {
$parentId = $this->rootCategoryId;
}
- $data = $this->_categoryModel::find()->asArray()->select([
+ $data = $this->_categoryModel->find()->asArray()->select([
'_id', 'parent_id', 'name', 'url_key', 'menu_custom',
])->where([
'parent_id' => $parentId,
- 'status' => $this->_categoryModel::STATUS_ENABLE,
- 'menu_show' => $this->_categoryModel::MENU_SHOW,
+ 'status' => $model::STATUS_ENABLE,
+ 'menu_show' => $model::MENU_SHOW,
])->all();
if (is_array($data) && !empty($data)) {
foreach ($data as $category) {
@@ -71,7 +71,7 @@ protected function actionGetCategoryMenuArr($parentId = '')
*/
protected function hasChild($categoryId)
{
- $one = $this->_categoryModel::find()->asArray()->where([
+ $one = $this->_categoryModel->find()->asArray()->where([
'parent_id' => $categoryId,
])->one();
if ($one['_id']) {
diff --git a/services/cms/article/ArticleMongodb.php b/services/cms/article/ArticleMongodb.php
index 4ceda59be..45d58e4bd 100644
--- a/services/cms/article/ArticleMongodb.php
+++ b/services/cms/article/ArticleMongodb.php
@@ -35,7 +35,7 @@ public function getPrimaryKey()
public function getByPrimaryKey($primaryKey)
{
if ($primaryKey) {
- return $this->_articleModel::findOne($primaryKey);
+ return $this->_articleModel->findOne($primaryKey);
} else {
return new $this->_articleModelName;
}
@@ -57,7 +57,7 @@ public function getByPrimaryKey($primaryKey)
*/
public function coll($filter = '')
{
- $query = $this->_articleModel::find();
+ $query = $this->_articleModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
return [
@@ -75,7 +75,7 @@ public function save($one, $originUrlKey)
$currentDateTime = \fec\helpers\CDate::getCurrentDateTime();
$primaryVal = isset($one[$this->getPrimaryKey()]) ? $one[$this->getPrimaryKey()] : '';
if ($primaryVal) {
- $model = $this->_articleModel::findOne($primaryVal);
+ $model = $this->_articleModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('article '.$this->getPrimaryKey().' is not exist');
@@ -113,7 +113,7 @@ public function remove($ids)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_articleModel::findOne($id);
+ $model = $this->_articleModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$url_key = $model['url_key'];
Yii::$service->url->removeRewriteUrlKey($url_key);
@@ -127,7 +127,7 @@ public function remove($ids)
}
} else {
$id = $ids;
- $model = $this->_articleModel::findOne($id);
+ $model = $this->_articleModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$url_key = $model['url_key'];
Yii::$service->url->removeRewriteUrlKey($url_key);
diff --git a/services/cms/article/ArticleMysqldb.php b/services/cms/article/ArticleMysqldb.php
index 5420ad7a2..958a65c55 100644
--- a/services/cms/article/ArticleMysqldb.php
+++ b/services/cms/article/ArticleMysqldb.php
@@ -44,7 +44,7 @@ public function getPrimaryKey()
public function getByPrimaryKey($primaryKey)
{
if ($primaryKey) {
- $one = $this->_articleModel::findOne($primaryKey);
+ $one = $this->_articleModel->findOne($primaryKey);
foreach ($this->_lang_attr as $attrName) {
if (isset($one[$attrName])) {
$one[$attrName] = unserialize($one[$attrName]);
@@ -73,7 +73,7 @@ public function getByPrimaryKey($primaryKey)
*/
public function coll($filter = '')
{
- $query = $this->_articleModel::find();
+ $query = $this->_articleModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
$coll = $query->all();
if (!empty($coll)) {
@@ -100,7 +100,7 @@ public function save($one, $originUrlKey)
$currentDateTime = \fec\helpers\CDate::getCurrentDateTime();
$primaryVal = isset($one[$this->getPrimaryKey()]) ? $one[$this->getPrimaryKey()] : '';
if ($primaryVal) {
- $model = $this->_articleModel::findOne($primaryVal);
+ $model = $this->_articleModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('article '.$this->getPrimaryKey().' is not exist');
@@ -142,7 +142,7 @@ public function remove($ids)
$innerTransaction = Yii::$app->db->beginTransaction();
try {
foreach ($ids as $id) {
- $model = $this->_articleModel::findOne($id);
+ $model = $this->_articleModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$url_key = $model['url_key'];
Yii::$service->url->removeRewriteUrlKey($url_key);
@@ -165,7 +165,7 @@ public function remove($ids)
}
} else {
$id = $ids;
- $model = $this->_articleModel::findOne($id);
+ $model = $this->_articleModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
$innerTransaction = Yii::$app->db->beginTransaction();
try {
diff --git a/services/cms/staticblock/StaticBlockMongodb.php b/services/cms/staticblock/StaticBlockMongodb.php
index a611fe680..da78072a3 100644
--- a/services/cms/staticblock/StaticBlockMongodb.php
+++ b/services/cms/staticblock/StaticBlockMongodb.php
@@ -34,7 +34,7 @@ public function getPrimaryKey()
public function getByPrimaryKey($primaryKey)
{
if ($primaryKey) {
- return $this->_staticBlockModel::findOne($primaryKey);
+ return $this->_staticBlockModel->findOne($primaryKey);
} else {
return new $this->_staticBlockModelName();
}
@@ -42,7 +42,7 @@ public function getByPrimaryKey($primaryKey)
public function getByIdentify($identify)
{
- return $this->_staticBlockModel::find()->asArray()->where([
+ return $this->_staticBlockModel->find()->asArray()->where([
'identify' => $identify,
])->one();
}
@@ -63,7 +63,7 @@ public function getByIdentify($identify)
*/
public function coll($filter = '')
{
- $query = $this->_staticBlockModel::find();
+ $query = $this->_staticBlockModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
return [
@@ -86,7 +86,7 @@ public function save($one)
return;
}
if ($primaryVal) {
- $model = $this->_staticBlockModel::findOne($primaryVal);
+ $model = $this->_staticBlockModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('StaticBlock '.$this->getPrimaryKey().' is not exist');
@@ -113,7 +113,7 @@ protected function validateIdentify($one)
$id = $this->getPrimaryKey();
$primaryVal = isset($one[$id]) ? $one[$id] : '';
$where = ['identify' => $identify];
- $query = $this->_staticBlockModel::find()->asArray();
+ $query = $this->_staticBlockModel->find()->asArray();
$query->where(['identify' => $identify]);
if ($primaryVal) {
$query->andWhere([$id => ['$ne'=> new \MongoDB\BSON\ObjectId($primaryVal)]]);
@@ -139,12 +139,12 @@ public function remove($ids)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_staticBlockModel::findOne($id);
+ $model = $this->_staticBlockModel->findOne($id);
$model->delete();
}
} else {
$id = $ids;
- $model = $this->_staticBlockModel::findOne($id);
+ $model = $this->_staticBlockModel->findOne($id);
$model->delete();
}
diff --git a/services/cms/staticblock/StaticBlockMysqldb.php b/services/cms/staticblock/StaticBlockMysqldb.php
index a4e17162b..279b014bb 100644
--- a/services/cms/staticblock/StaticBlockMysqldb.php
+++ b/services/cms/staticblock/StaticBlockMysqldb.php
@@ -41,7 +41,7 @@ public function getPrimaryKey()
public function getByPrimaryKey($primaryKey)
{
if ($primaryKey) {
- $one = $this->_staticBlockModel::findOne($primaryKey);
+ $one = $this->_staticBlockModel->findOne($primaryKey);
foreach ($this->_lang_attr as $attrName) {
if (isset($one[$attrName])) {
$one[$attrName] = unserialize($one[$attrName]);
@@ -56,7 +56,7 @@ public function getByPrimaryKey($primaryKey)
public function getByIdentify($identify)
{
- $one = $this->_staticBlockModel::find()->asArray()->where([
+ $one = $this->_staticBlockModel->find()->asArray()->where([
'identify' => $identify,
])->one();
foreach ($this->_lang_attr as $attrName) {
@@ -84,7 +84,7 @@ public function getByIdentify($identify)
*/
public function coll($filter = '')
{
- $query = $this->_staticBlockModel::find();
+ $query = $this->_staticBlockModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
$coll = $query->all();
if (!empty($coll)) {
@@ -116,7 +116,7 @@ public function save($one)
return;
}
if ($primaryVal) {
- $model = $this->_staticBlockModel::findOne($primaryVal);
+ $model = $this->_staticBlockModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('static block '.$this->getPrimaryKey().' is not exist');
@@ -146,7 +146,7 @@ protected function validateIdentify($one)
$id = $this->getPrimaryKey();
$primaryVal = isset($one[$id]) ? $one[$id] : '';
$where = ['identify' => $identify];
- $query = $this->_staticBlockModel::find()->asArray();
+ $query = $this->_staticBlockModel->find()->asArray();
$query->where(['identify' => $identify]);
if ($primaryVal) {
$query->andWhere(['<>', $id, $primaryVal]);
@@ -168,13 +168,13 @@ public function remove($ids)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_staticBlockModel::findOne($id);
+ $model = $this->_staticBlockModel->findOne($id);
$model->delete();
}
} else {
$id = $ids;
foreach ($ids as $id) {
- $model = $this->_staticBlockModel::findOne($id);
+ $model = $this->_staticBlockModel->findOne($id);
$model->delete();
}
}
diff --git a/services/customer/Address.php b/services/customer/Address.php
index bf78c2758..d0008574c 100644
--- a/services/customer/Address.php
+++ b/services/customer/Address.php
@@ -41,7 +41,7 @@ protected function actionGetPrimaryKey()
*/
protected function actionGetByPrimaryKey($primaryKey)
{
- $one = $this->_addressModel::findOne($primaryKey);
+ $one = $this->_addressModel->findOne($primaryKey);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
@@ -58,7 +58,7 @@ protected function actionGetByPrimaryKey($primaryKey)
protected function actionGetAddressByIdAndCustomerId($address_id, $customer_id)
{
$primaryKey = $this->getPrimaryKey();
- $one = $this->_addressModel::findOne([
+ $one = $this->_addressModel->findOne([
$primaryKey => $address_id,
'customer_id' => $customer_id,
]);
@@ -88,7 +88,7 @@ protected function actionGetAddressByIdAndCustomerId($address_id, $customer_id)
*/
protected function actionColl($filter = '')
{
- $query = $this->_addressModel::find();
+ $query = $this->_addressModel->find();
$query = Yii::$service->helper->ar->getCollByFilter($query, $filter);
$coll = $query->all();
@@ -171,7 +171,7 @@ protected function actionSave($one)
$primaryKey = $this->getPrimaryKey();
$primaryVal = isset($one[$primaryKey]) ? $one[$primaryKey] : '';
if ($primaryVal) {
- $model = $this->_addressModel::findOne($primaryVal);
+ $model = $this->_addressModel->findOne($primaryVal);
if (!$model) {
Yii::$service->helper->errors->add('address '.$this->getPrimaryKey().' is not exist');
@@ -186,7 +186,7 @@ protected function actionSave($one)
$primaryVal = $model[$primaryKey];
if ($one['is_default'] == 1) {
$customer_id = $one['customer_id'];
- $this->_addressModel::updateAll(
+ $this->_addressModel->updateAll(
['is_default'=>2], // $attributes
'customer_id = '.$customer_id.' and '.$primaryKey.' != ' .$primaryVal // $condition
//[':customer_id' => $customer_id]
@@ -212,7 +212,7 @@ protected function actionRemove($ids, $customer_id)
}
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $id) {
- $model = $this->_addressModel::findOne($id);
+ $model = $this->_addressModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
if ($customer_id) {
if ($model['customer_id'] == $customer_id) {
@@ -234,7 +234,7 @@ protected function actionRemove($ids, $customer_id)
}
} else {
$id = $ids;
- $model = $this->_addressModel::findOne($id);
+ $model = $this->_addressModel->findOne($id);
if (isset($model[$this->getPrimaryKey()]) && !empty($model[$this->getPrimaryKey()])) {
if ($customer_id) {
if ($model['customer_id'] == $customer_id) {
@@ -256,11 +256,11 @@ protected function actionRemove($ids, $customer_id)
}
// 查看是否有默认地址?如果该用户存在记录,但是没有默认地址,
// 则查找用户是否存在非默认地址,如果存在,则取一个设置为默认地址
- $addressOne = $this->_addressModel::find()->asArray()
+ $addressOne = $this->_addressModel->find()->asArray()
->where(['customer_id' => $customer_id, 'is_default' => 1])
->one();
if (!$addressOne['address_id']) {
- $assOne = $this->_addressModel::find()
+ $assOne = $this->_addressModel->find()
->where(['customer_id' => $customer_id])
->one();
if ($assOne['address_id']) {
@@ -300,13 +300,13 @@ protected function actionGetDefaultAddress($customer_id = ''){
$customer_id = $identity['id'];
}
if($customer_id ){
- $addressOne = $this->_addressModel::find()->asArray()
+ $addressOne = $this->_addressModel->find()->asArray()
->where(['customer_id' => $customer_id,'is_default' => 1])
->one();
if($addressOne['address_id']){
return $addressOne;
}else{
- $assOne = $this->_addressModel::find()->asArray()
+ $assOne = $this->_addressModel->find()->asArray()
->where(['customer_id' => $customer_id])
->one();
if($assOne['address_id']){
diff --git a/services/customer/Newsletter.php b/services/customer/Newsletter.php
index 20c9561cf..e8bcae548 100644
--- a/services/customer/Newsletter.php
+++ b/services/customer/Newsletter.php
@@ -33,8 +33,8 @@ public function __construct(){
*/
protected function emailIsExist($emailAddress)
{
- $primaryKey = $this->_newsletterModel::primaryKey();
- $one = $this->_newsletterModel::findOne(['email' => $emailAddress]);
+ $primaryKey = $this->_newsletterModel->primaryKey();
+ $one = $this->_newsletterModel->findOne(['email' => $emailAddress]);
if ($one[$primaryKey]) {
return true;
}
@@ -62,10 +62,11 @@ protected function actionSubscribe($emailAddress)
return;
}
+ $model = $this->_newsletterModel;
$newsletterModel = new $this->_newsletterModelName();
$newsletterModel->email = $emailAddress;
$newsletterModel->created_at = time();
- $newsletterModel->status = $this->_newsletterModel::ENABLE_STATUS;
+ $newsletterModel->status = $model::ENABLE_STATUS;
$newsletterModel->save();
return true;
diff --git a/services/helper/Log.php b/services/helper/Log.php
index e944e1860..726a20091 100644
--- a/services/helper/Log.php
+++ b/services/helper/Log.php
@@ -72,7 +72,7 @@ public function isServiceLogEnable()
public function printServiceLog($log_info)
{
if ($this->isServiceLogDbPrint()) {
- $this->_logModel::getCollection()->save($log_info);
+ $this->_logModel->getCollection()->save($log_info);
}
if ($this->isServiceLogHtmlPrint() || $this->isServiceLogDbPrintByParam()) {
$str = '
#################################