255], [['content'], 'string', 'max' => 8192], [['discount_rule'], 'string', 'max' => 512], [['loop_discount_rule'], 'string', 'max' => 128], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'name' => 'Name', 'content' => 'Content', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'deleted_at' => 'Deleted At', 'start_at' => 'Start At', 'end_at' => 'End At', 'appoint_type' => 'Appoint Type', 'rule_type' => 'Rule Type', 'discount_rule' => 'Discount Rule', 'loop_discount_rule' => 'Loop Discount Rule', 'appoint_goods' => 'Appoint Goods', 'noappoint_goods' => 'Noappoint Goods', 'is_delete' => 'Is Delete', ]; } /** * 获取当前正在进行中的活动 * @param string $select * @return array|\yii\db\ActiveRecord|null */ public static function getNowActivity($select = '*') { return self::find()->where([ 'mall_id' => \Yii::$app->mall->id, 'is_delete' => 0, 'status' => 1 ])->select($select) ->andWhere(['<=', 'start_at', date('y-m-d H:i:s')]) ->andWhere(['>=', 'end_at', date('y-m-d H:i:s')]) ->limit(1) ->one(); } }