Quellcode durchsuchen

feature/NG-27: Qualified bonus regulations 奖金合格制度:活动期间购买指定商品,BV≥27即可维持活跃度.

kevin vor 1 Jahr
Ursprung
Commit
f863f5c524
4 geänderte Dateien mit 611 neuen und 10 gelöschten Zeilen
  1. 182 0
      common/models/Order.php
  2. 82 0
      common/models/OrderGoods.php
  3. 287 0
      common/models/ShopGoods.php
  4. 60 10
      common/models/User.php

+ 182 - 0
common/models/Order.php

@@ -0,0 +1,182 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%ORDER}}".
+ *
+ * @property string $ID
+ * @property string $SN 订单号
+ * @property string $DEC_SN 报单编号
+ * @property string $USER_ID 用户ID
+ * @property string $USER_NAME 会员编号
+ * @property string $DEC_USER_ID  会员编号
+ * @property string $ORDER_TYPE 订货类型
+ * @property string $ORDER_AMOUNT 订单总价格(n)
+ * @property string $ORDER_AMOUNT_STANDARD 订单总价格($)
+ * @property string $PV 订货PV
+ * @property string $PAY_AMOUNT 支付价格
+ * @property string $PAY_AMOUNT_STANDARD 支付价格
+ * @property string $EXCHANGE_RATE 汇率
+ * @property string $PAY_PV 实付PV
+ * @property int $PAY_AT 支付时间
+ * @property string $PAY_TYPE 支付方式
+ * @property string $FREIGHT 运费
+ * @property string $PAY_FREIGHT 实付运费金额
+ * @property int $DELIVERY_STATUS 发货状态
+ * @property int $DELIVERY_PERIOD 发货期数
+ * @property int $DELIVERY_AT 发货时间
+ * @property string $EXPRESS_COMPANY 快递公司
+ * @property string $ORDER_TRACK_NO 快递单号
+ * @property int $EXPRESS_TYPE 发货方式
+ * @property string $FRONT_REMARK 前台备注
+ * @property string $REMARK 后台备注
+ * @property int $PERIOD_NUM 期数
+ * @property int $STATUS 订单状态
+ * @property string $CONSIGNEE 收货人
+ * @property string $MOBILE 收货人手机
+ * @property string $TEL 固定电话
+ * @property int $PROVINCE 省份名称
+ * @property int $CITY 城市名称
+ * @property int $COUNTY 县区
+ * @property string $LGA_NAME
+ * @property string $CITY_NAME
+ * @property string $ADDRESS 详细地址
+ * @property string $P_CALC_MONTH 分区日期
+ * @property int $CREATED_AT 订单创建时间
+ * @property string $CREATE_USER 订单创建人
+ * @property int $UPDATED_AT 修改时间
+ * @property string $UPDATER 修改人
+ * @property int $IS_DELETE 是否删除
+ * @property int $DELETED_AT 删除时间
+ * @property int $WAREHOUSE 发货仓
+ * @property string $EMAIL 邮箱
+ * @property string $NOTE 备注说明
+ */
+class Order extends \common\components\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return '{{%ORDER}}';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['USER_ID', 'ORDER_TYPE', 'CREATE_USER'/*, 'EMAIL'*/], 'required'],
+            [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT', 'ORDER_AMOUNT_STANDARD', 'PAY_AMOUNT_STANDARD', 'EXCHANGE_RATE'], 'number'],
+            [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'STATUS', 'PROVINCE', /*'CITY', 'COUNTY', */'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
+            [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE','DEC_USER_ID'], 'string', 'max' => 32],
+            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
+            [['ORDER_TYPE'], 'string', 'max' => 12],
+            [['EXPRESS_COMPANY'], 'string', 'max' => 128],
+            [['FRONT_REMARK'], 'string', 'max' => 1000],
+            [['REMARK', 'NOTE'], 'string', 'max' => 4000],
+            [['CONSIGNEE'], 'string', 'max' => 120],
+            [['MOBILE'], 'string', 'max' => 11],
+            [['ADDRESS'], 'string', 'max' => 255],
+            [['SN'], 'unique'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'SN' => '订单号',
+            'DEC_SN' => '报单编号',
+            'USER_ID' => '用户ID',
+            'USER_NAME' => '会员编号',
+            'DEC_USER_ID' => '报单中心编号',
+            'ORDER_TYPE' => '订货类型',
+            'ORDER_AMOUNT' => '订单总价格',
+            'PV' => '订货BV',
+            'PAY_AMOUNT' => '支付价格',
+            'PAY_PV' => '实付BV',
+            'PAY_AT' => '支付时间',
+            'PAY_TYPE' => '支付方式',
+            'FREIGHT' => '运费',
+            'PAY_FREIGHT' => '实付运费金额',
+            'DELIVERY_STATUS' => '发货状态',
+            'DELIVERY_PERIOD' => '发货期数',
+            'DELIVERY_AT' => '发货时间',
+            'EXPRESS_COMPANY' => '快递公司',
+            'ORDER_TRACK_NO' => '快递单号',
+            'EXPRESS_TYPE' => '发货方式',
+            'FRONT_REMARK' => '前台备注',
+            'REMARK' => '后台备注',
+            'PERIOD_NUM' => '期数',
+            'STATUS' => '订单状态',
+            'CONSIGNEE' => '收货人',
+            'MOBILE' => '收货人手机',
+            'TEL' => '固定电话',
+            'PROVINCE' => '省份名称',
+//            'CITY' => '城市名称',
+//            'COUNTY' => '县区',
+            'ADDRESS' => '详细地址',
+            'P_CALC_MONTH' => '分区日期',
+            'CREATED_AT' => '订单创建时间',
+            'CREATE_USER' => '订单创建人',
+            'UPDATED_AT' => '修改时间',
+            'UPDATER' => '修改人',
+            'IS_DELETE' => '是否删除',
+            'DELETED_AT' => '删除时间',
+            'WAREHOUSE' => '发货仓',
+            'EMAIL' => 'Email'
+        ];
+    }
+    /*
+     * 通过 期数和用户ID
+     * 查询当月订单
+     */
+    public static function fetchOrderCurrentMonth($periodNum, $userId){
+        $currentPeriod = Period::findOneAsArray("PERIOD_NUM = :PERIOD_NUM", [':PERIOD_NUM' => $periodNum]);
+
+        switch ($currentPeriod['CALC_WEEKEND']){
+            case 1:
+                $periods = [$periodNum];
+                break;
+            case 2:
+                $periods = [$periodNum-1, $periodNum];
+                break;
+        }
+
+        $periodsStr = implode(",", $periods);
+        $orders = Order::find()->where("USER_ID = :USER_ID AND PERIOD_NUM IN ($periodsStr)", [':USER_ID' => $userId]);
+        return $orders;
+    }
+    /*
+     * 通过 期数和用户ID
+     * 查询当期订单
+     */
+    public static function fetchOrderCurrentPeriod($periodNum, $userId){
+        $orders = Order::find()->where("USER_ID = :USER_ID AND PERIOD_NUM = :PERIOD_NUM", [':USER_ID' => $userId,':PERIOD_NUM' => $periodNum]);
+        return $orders;
+    }
+
+    public function getRecName()
+    {
+        return $this->hasOne(UserInfo::class, ['USER_ID' => 'USER_ID']);
+    }
+
+    public function getUserByUserId()
+    {
+        return $this->hasOne(User::class, ['ID' => 'USER_ID']);
+    }
+
+    public function getOrderGoods()
+    {
+        return $this->hasMany(OrderGoods::class, ['SN' => 'ORDER_SN']);
+    }
+}

+ 82 - 0
common/models/OrderGoods.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%ORDER_GOODS}}".
+ *
+ * @property string $ID
+ * @property string $ORDER_SN 订单ID
+ * @property string $GOODS_ID 商品ID
+ * @property string $GOODS_TITLE 商品名称
+ * @property string $PRICE 价格
+ * @property string $REAL_PRICE 实际价格
+ * @property string $PV 订货PV
+ * @property string $REAL_PV 实际PV
+ * @property string $TAX_RATE 税率
+ * @property string $POINT 兑换积分
+ * @property string $SKU_CODE 商品编码
+ * @property int $BUY_NUMS 购买数量
+ * @property string $P_CALC_MONTH 分区日期
+ * @property int CATEGORY_TYPE 商品分类
+ * @property int PAY_TYPE 支付方式
+ * @property string $EMAIL Email
+ */
+class OrderGoods extends \common\components\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return '{{%ORDER_GOODS}}';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['ORDER_SN', 'GOODS_ID', 'GOODS_TITLE', 'SKU_CODE', 'CATEGORY_TYPE', 'PAY_TYPE', 'EMAIL'], 'required'],
+            [['PRICE', 'REAL_PRICE', 'PV', 'REAL_PV', 'POINT', 'CATEGORY_TYPE', 'PAY_TYPE', 'TAX_RATE'], 'number'],
+            [['BUY_NUMS'], 'integer'],
+            [['ID', 'ORDER_SN', 'GOODS_ID'], 'string', 'max' => 32],
+            [['GOODS_TITLE'], 'string', 'max' => 255],
+            [['SKU_CODE'], 'string', 'max' => 16],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'ORDER_SN' => '订单ID',
+            'GOODS_ID' => '商品ID',
+            'GOODS_TITLE' => '商品名称',
+            'PRICE' => '价格',
+            'REAL_PRICE' => '实际价格',
+            'PV' => '订货BV',
+            'REAL_PV' => '实际BV',
+            'TAX_RATE' => 'TAX_RATE',
+            'POINT' => '兑换积分',
+            'SKU_CODE' => '商品编码',
+            'BUY_NUMS' => '购买数量',
+            'P_CALC_MONTH' => '分区日期',
+            'CATEGORY_TYPE' => '商品分类',
+            'PAY_TYPE' => '支付方式',
+            'EMAIL' => 'Email'
+        ];
+    }
+
+    public function getShopGoods()
+    {
+        return $this->hasMany(ShopGoods::class, ['ID' => 'GOODS_ID']);
+    }
+}

+ 287 - 0
common/models/ShopGoods.php

@@ -0,0 +1,287 @@
+<?php
+
+namespace common\models;
+
+/**
+ * This is the model class for table "{{%SHOP_GOODS}}".
+ *
+ * @property string $ID
+ * @property string $GOODS_NAME 商品名称
+ * @property string $CATE_ID 所属分类ID
+ * @property string $TYPE 商品来源
+ * @property string $GIFT_TYPE 商品类型
+ * @property string $CATEGORY_TYPE 商品分类
+ * @property string $SELL_TYPE 允许购买方式
+ * @property int $GOODS_NO 商品编号
+ * @property string $UNIT 单位
+ * @property string $COVER 商品封面
+ * @property int $IMAGES 商品图片
+ * @property string $CONTENT 商品内容
+ * @property string $SELL_PRICE 销售价格
+ * @property string $SELL_PRICE_STANDARD 标准价格
+ * @property string $MARKET_PRICE 市场价格
+ * @property int $PRICE_PV 价格PV
+ * @property string $TAX_RATE 税率
+ * @property int $POINT 兑换积分
+ * @property int $STORE_NUMS 库存
+ * @property int $IS_DEL 是否删除
+ * @property int $CREATED_AT 创建时间
+ * @property int $UPDATED_AT 更新时间
+ * @property int $DELETED_AT 删除时间
+ * @property int $STATUS 状态
+ * @property string $SORT 排序
+ */
+class ShopGoods extends \common\components\ActiveRecord
+{
+    const SALE_TYPE = [
+        1 => [
+            'id' => 1,
+            'name' => 'Account Balance', //余额购买
+            'label' => 'cash',
+            'language' => 'shopListAccountBalance',
+        ],
+//        2 => [
+//            'id' => 2,
+//            'name' => '复消兑换',
+//        ],
+//        3 => [
+//            'id' => 3,
+//            'name' => '兑换点数',
+//            'label' => 'exchange',
+//        ],
+        4 => [
+            'id' => 4,
+            'name' => 'Travel Bonus',
+            'label' => 'tourism_points',
+            'language' => 'shopListPayTravelBonus',
+        ],
+        5 => [
+            'id' => 5,
+            'name' => 'Car Fund',
+            'label' => 'garage_points',
+            'language' => 'shopListPayCarFund',
+        ],
+        6 => [
+            'id' => 6,
+            'name' => 'Villa Fund',
+            'label' => 'villa_points',
+            'language' => 'shopListPayVillaFund',
+        ],
+        7 => [
+            'id' => 7,
+            'name' => 'PayStack',
+            'label' => 'pay_stack',
+            'language' => 'saleTypePayStack',
+        ],
+    ];
+
+    const GOODS_TYPE = [
+        1 =>[
+            'name'=>'国内商品',//国内商品
+            'discount'=>'50',
+            'language' => 'shopGoodTypeDomestic',
+        ],
+        2 =>[
+            'name'=>'进口商品',//进口商品
+            'discount'=>'60',
+            'language' => 'shopGoodTypeImport',
+        ],
+    ];
+    const STATUS_NAME = [
+        1 => 'On sale',//已上架
+        0 => 'Sold out',//已下架
+    ];
+
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%SHOP_GOODS}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['SELL_DISCOUNT','GOODS_NAME', 'CATE_ID','GIFT_TYPE', 'GOODS_NO', 'SELL_PRICE','MARKET_PRICE','PRICE_PV','STORE_NUMS', 'SELL_TYPE', 'CATEGORY_TYPE', 'SELL_PRICE_STANDARD', 'TAX_RATE'], 'required'],
+            [['STORE_NUMS'], 'integer'],
+            [['SELL_PRICE','MARKET_PRICE','PRICE_PV','POINT',/* 'SELL_TYPE',*/ 'CATEGORY_TYPE' ,'SELL_PRICE_STANDARD', 'TAX_RATE'], 'number'],
+            [['ID','CATE_ID', 'GOODS_NO','GIFT_TYPE'], 'string', 'max' => 32],
+            [['UNIT'], 'string', 'max' => 16],
+            [['COVER', 'GOODS_NAME'], 'string', 'max' => 255],
+            [['IMAGES','CONTENT'], 'string', 'max' => 4000],
+            [['GOODS_NAME'], 'unique'],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'GOODS_NAME' => '商品名称',
+            'CATE_ID' => '所属分类ID',
+            // 'TYPE' => '商品来源',
+            'SELL_DISCOUNT' => '会员折扣',
+            'GIFT_TYPE' => '商品类型',
+            'CATEGORY_TYPE' => '商品分类',
+            'SELL_TYPE' => '出售方式',
+            'GOODS_NO' => '商品编号',
+            'UNIT' => '商品单位',
+            'COVER' => '商品封面',
+            'IMAGES' => '商品图片',
+            'CONTENT' => '商品内容',
+            'SELL_PRICE' => '销售价格',
+            'SELL_PRICE_STANDARD' => 'US price($)',
+            'MARKET_PRICE' => '市场价格',
+            'PRICE_PV' => '价格PV',
+            'TAX_RATE' => '税率',
+            'TAX_AMOUNT' => '税额',
+//            'POINT' => '兑换积分',
+            'STORE_NUMS' => '库存',
+            'STATUS' => '是否上架',
+            'IS_DEL' => '是否删除',
+            'CREATED_AT' => '创建时间',
+            'UPDATED_AT' => '更新时间',
+            'DELETED_AT' => '更新时间',
+            'SORT' => '排序',
+        ];
+    }
+
+    /**
+     * 判断提现状态
+     * @param $nowStatus
+     * @param $toStatus
+     * @return string
+     */
+    public static function chkAuditStatus($nowStatus, $toStatus) {
+        $statusName = self::STATUS_NAME;
+        // $msg = 'The current product status is【' . $statusName[$nowStatus] . '】,cannot be set to【' . $statusName[$toStatus] . '】';// 当前商品状态为    无法设置为
+        $msg = \Yii::t('ctx', 'shopSetProductStatusErrorNotice', [
+            'nowStatus' => $statusName[$nowStatus],
+            'newStatus' => $statusName[$toStatus]
+        ]);
+        switch ($toStatus) {
+            // 下架
+            case 0:
+                if ($nowStatus == 1) {
+                    $msg = '';
+                }
+                break;
+            //上架
+            case 1:
+                if ($nowStatus == 0) {
+                    $msg = '';
+                }
+                break;
+            default:
+        }
+        return $msg;
+    }
+
+    /**
+     * 支付方式
+     * @return array
+     */
+    public static function payTypes(){
+        return [
+            'cash'=>[
+                'name'=> \Yii::t('ctx', 'shopPayTypeCash')//余额支付
+            ],
+//            'point'=>[
+//                'name'=>'积分支付' //积分支付
+//            ],
+//            'exchange' => [
+//                'name' => '积分点数'
+//            ],
+//            'tourism_points'=>[
+//                'name'=>'Travel Bonus'
+//            ],
+            'garage_points' => [
+                'name' => \Yii::t('ctx', 'shopPayTypeGaragePoints')
+            ],
+            'villa_points' => [
+                'name' => \Yii::t('ctx', 'shopPayTypeVillaFund')
+            ],
+            'pay_stack' => [
+                'name' => 'PayStack'
+            ],
+        ];
+    }
+
+    // 获取商品类型
+    public static function getGiftType() {
+        return [
+            1 =>[
+                'name'=>\Yii::t('ctx', 'shopList1stPurchase'),//报单区
+            ],
+            2 =>[
+                'name'=>\Yii::t('ctx', 'shopListRepeatPurchase'),//复消区
+            ],
+//            3 =>[
+//                'name'=>\Yii::t('ctx', 'shopListEntryArea'),//工作室报单
+//            ],
+//            4 =>[
+//                'name'=>\Yii::t('ctx', 'shopListResellingArea'),//工作室复消
+//            ],
+        ];
+    }
+
+    // 获取分类类型
+    public static function getCategoryType() {
+        return [
+            [
+                'id' => 1,
+                'name' => \Yii::t('ctx', 'shopListStandardProducts'),//普通商品
+                'sell_type' => [
+                    self::SALE_TYPE[1],
+    //                self::SALE_TYPE[3],
+                    self::SALE_TYPE[7],
+                ]
+            ],
+    //        [
+    //            'id' => 4,
+    //            'name' => 'Travel bonus products',//旅游积分商品
+    //            'sell_type' => [
+    //                self::SALE_TYPE[4]
+    //            ]
+    //        ],
+            [
+                'id' => 5,
+                'name' => \Yii::t('ctx', 'shopListCarFundProducts'),
+                'sell_type' => [
+                    self::SALE_TYPE[5]
+                ]
+            ],
+            [
+                'id' => 6,
+                'name' => \Yii::t('ctx', 'shopListVillaFundProducts'),
+                'sell_type' => [
+                    self::SALE_TYPE[6]
+                ]
+            ],
+        ];
+    }
+
+    public static function getSaleType(): array
+    {
+        return array_map(function ($item) {
+            $item['name'] = \Yii::t('ctx', $item['language']);
+            return $item;
+        }, self::SALE_TYPE);
+    }
+
+    public static function getGoodType(): array
+    {
+        return array_map(function ($item) {
+            $item['name'] = \Yii::t('ctx', $item['language']);
+            return $item;
+        }, self::GOODS_TYPE);
+    }
+}

+ 60 - 10
common/models/User.php

@@ -3,9 +3,8 @@
 namespace common\models;
 
 use common\helpers\Cache;
-use common\helpers\Tool;
-use common\helpers\user\Info;
 use Yii;
+use yii\db\Exception;
 use yii\helpers\Json;
 use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
 
@@ -456,18 +455,69 @@ class User extends \common\components\ActiveRecord
         ];
     }
 
+//    /**
+//     * 判断此期用户是否活跃
+//     * @param varchar $userId 用户ID
+//     * @param int $periodNum 业绩期
+//     * @param varchar $calcYearMonth 结算年月
+//     */
+//    public static function isPerfActive($userId, $periodNum, $calcYearMonth): bool {
+//        $sysConfig = Cache::getSystemConfig();
+//        $pv = PerfPeriod::find()->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH AND PERIOD_NUM<=:PERIOD_NUM',
+//        ['USER_ID'=>$userId, 'CALC_MONTH'=>$calcYearMonth, 'PERIOD_NUM'=>$periodNum])
+//        ->SUM('PV_PCS');
+//
+//        return $pv >= $sysConfig['monthPcsPvFxCondition']['VALUE'] ? 1 : 0;
+//    }
+
+    // 判断会员是否活跃:1. 当月消费30BV. 2.任意水机+150粒的EKSP. (满足任意条件即可)
+
     /**
-     * 判断此期用户是否活跃
-     * @param varchar $userId 用户ID
-     * @param int $periodNum 业绩期
-     * @param varchar $calcYearMonth 结算年月
+     * @throws Exception
      */
-    public static function isPerfActive($userId, $periodNum, $calcYearMonth): bool {
+    public function isPerfActive($userId, $periodNum, $calcYearMonth): bool
+    {
         $sysConfig = Cache::getSystemConfig();
+
+        // 条件1: 当月消费30BV
         $pv = PerfPeriod::find()->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH AND PERIOD_NUM<=:PERIOD_NUM',
-        ['USER_ID'=>$userId, 'CALC_MONTH'=>$calcYearMonth, 'PERIOD_NUM'=>$periodNum])
-        ->SUM('PV_PCS');
+            ['USER_ID' => $userId, 'CALC_MONTH' => $calcYearMonth, 'PERIOD_NUM' => $periodNum])
+            ->SUM('PV_PCS');
+
+        if ($pv >= $sysConfig['monthPcsPvFxCondition']['VALUE']) {
+            return true;
+        }
+
+        $periodObj = Period::instance();
+        $calcYear = $periodObj->getYear($periodNum);
+        $calcMonth = $periodObj->getMonth($periodNum);
+
+        $calcMonth = $calcYear . ($calcMonth == 1 ? '0' . $calcMonth : $calcMonth);
+
+        // 条件2: 任意水机+150粒的EKSP(HES150N)
+        $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();
+        if (!$orderEKSP) {
+            return false;
+        }
+
+        // 所有分期商品
+        $instalmentShopGoods = ShopGoods::find()->where('INSTALMENT>0 AND STATUS=1')->select('GOODS_NO')->column();
+        $instalmentShopGoods = implode("','", $instalmentShopGoods);
+        $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();
+        if (!$orderInstalment) {
+            return false;
+        }
 
-        return $pv >= $sysConfig['monthPcsPvFxCondition']['VALUE'] ? 1 : 0;
+        return true;
     }
 }