|
|
@@ -492,8 +492,8 @@ class User extends \common\components\ActiveRecord
|
|
|
$periodObj = Period::instance();
|
|
|
$calcYear = $periodObj->getYear($periodNum);
|
|
|
$calcMonth = $periodObj->getMonth($periodNum);
|
|
|
-
|
|
|
- $calcMonth = $calcYear . (strlen($calcMonth) == 1 ? '0' . $calcMonth : $calcMonth);
|
|
|
+ $periodList = $periodObj->getYearMonthAllPeriod($calcYear, $calcMonth);
|
|
|
+ $periodList = implode("','", $periodList);
|
|
|
|
|
|
// 条件2: 任意水机+150粒的EKSP(HES150N)
|
|
|
// $orderEKSP = Order::find()
|
|
|
@@ -506,8 +506,8 @@ class User extends \common\components\ActiveRecord
|
|
|
$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']);
|
|
|
+ ->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND O.PERIOD_NUM IN ('{$periodList}') AND G.SKU_CODE=:SKU_CODE",
|
|
|
+ ['USER_ID' => $userId, ':SKU_CODE' => 'HES150N']);
|
|
|
|
|
|
LoggerTool::debug('isPerfActive-1-sql: ' . $userId . ': ' . $query->createCommand()->getRawSql());
|
|
|
$orderEKSP = $query->count();
|
|
|
@@ -529,8 +529,7 @@ class User extends \common\components\ActiveRecord
|
|
|
$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]);
|
|
|
+ ->where("O.IS_DELETE=0 AND O.USER_ID=:USER_ID AND O.PERIOD_NUM ('{$periodList}') AND G.SKU_CODE IN ('{$instalmentShopGoods}')", ['USER_ID' => $userId]);
|
|
|
|
|
|
LoggerTool::debug('isPerfActive-2-sql: ' . $userId . ': ' . $query1->createCommand()->getRawSql());
|
|
|
$orderInstalment = $query1->count();
|