|
|
@@ -3,6 +3,7 @@
|
|
|
namespace common\models;
|
|
|
|
|
|
use common\helpers\Cache;
|
|
|
+use common\helpers\LoggerTool;
|
|
|
use Yii;
|
|
|
use yii\db\Exception;
|
|
|
use yii\helpers\Json;
|
|
|
@@ -484,6 +485,7 @@ class User extends \common\components\ActiveRecord
|
|
|
->SUM('PV_PCS');
|
|
|
|
|
|
if ($pv >= $sysConfig['monthPcsPvFxCondition']['VALUE']) {
|
|
|
+ LoggerTool::debug('isPerfActive-1: ' . $userId . ': ' . $pv . ' ' . $sysConfig['monthPcsPvFxCondition']['VALUE']);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -494,29 +496,50 @@ class User extends \common\components\ActiveRecord
|
|
|
$calcMonth = $calcYear . (strlen($calcMonth) == 1 ? '0' . $calcMonth : $calcMonth);
|
|
|
|
|
|
// 条件2: 任意水机+150粒的EKSP(HES150N)
|
|
|
- $orderEKSP = Order::find()
|
|
|
+// $orderEKSP = Order::find()
|
|
|
+// ->alias('O')
|
|
|
+// ->join('INNER JOIN', OrderGoods::tableName() . ' AS G', 'O.SN = G.ORDER_SN')
|
|
|
+// ->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND LEFT(O.P_CALC_MONTH, 7)=:P_CALC_MONTH AND O.PERIOD_NUM<=:PERIOD_NUM AND G.SKU_CODE=:SKU_CODE",
|
|
|
+// ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum, ':SKU_CODE' => 'HES150N'])
|
|
|
+// ->count();
|
|
|
+
|
|
|
+ $query = Order::find()
|
|
|
->alias('O')
|
|
|
->join('INNER JOIN', OrderGoods::tableName() . ' AS G', 'O.SN = G.ORDER_SN')
|
|
|
->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND LEFT(O.P_CALC_MONTH, 7)=:P_CALC_MONTH AND O.PERIOD_NUM<=:PERIOD_NUM AND G.SKU_CODE=:SKU_CODE",
|
|
|
- ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum, ':SKU_CODE' => 'HES150N'])
|
|
|
- ->count();
|
|
|
+ ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum, ':SKU_CODE' => 'HES150N']);
|
|
|
+
|
|
|
+ LoggerTool::debug('isPerfActive-1-sql: ' . $userId . ': ' . $query->createCommand()->getRawSql());
|
|
|
+ $orderEKSP = $query->count();
|
|
|
if (!$orderEKSP) {
|
|
|
+ LoggerTool::debug('isPerfActive-2: ' . $userId . ': ' . $orderEKSP);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
// 所有分期商品
|
|
|
$instalmentShopGoods = ShopGoods::find()->where('INSTALMENT>0 AND STATUS=1')->select('GOODS_NO')->column();
|
|
|
$instalmentShopGoods = implode("','", $instalmentShopGoods);
|
|
|
- $orderInstalment = Order::find()
|
|
|
+// $orderInstalment = Order::find()
|
|
|
+// ->alias('O')
|
|
|
+// ->join('INNER JOIN', OrderGoods::tableName() . ' AS G', 'O.SN = G.ORDER_SN')
|
|
|
+// ->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND LEFT(O.P_CALC_MONTH, 7)=:P_CALC_MONTH AND O.PERIOD_NUM<=:PERIOD_NUM AND G.SKU_CODE IN ('{$instalmentShopGoods}')",
|
|
|
+// ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum])
|
|
|
+// ->count();
|
|
|
+
|
|
|
+ $query1 = Order::find()
|
|
|
->alias('O')
|
|
|
->join('INNER JOIN', OrderGoods::tableName() . ' AS G', 'O.SN = G.ORDER_SN')
|
|
|
->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND LEFT(O.P_CALC_MONTH, 7)=:P_CALC_MONTH AND O.PERIOD_NUM<=:PERIOD_NUM AND G.SKU_CODE IN ('{$instalmentShopGoods}')",
|
|
|
- ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum])
|
|
|
- ->count();
|
|
|
+ ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum]);
|
|
|
+
|
|
|
+ LoggerTool::debug('isPerfActive-2-sql: ' . $userId . ': ' . $query1->createCommand()->getRawSql());
|
|
|
+ $orderInstalment = $query1->count();
|
|
|
if (!$orderInstalment) {
|
|
|
+ LoggerTool::debug('isPerfActive-3: ' . $userId . ': ' . $orderInstalment);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ LoggerTool::debug('isPerfActive-4: ' . $userId . ': ' . 10000000);
|
|
|
return 1;
|
|
|
}
|
|
|
}
|