TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at' ] ] ]; } /** * {@inheritdoc} */ public function rules() { return [ [['store_id', 'saas_id', 'coupon_id'], 'required'], [['store_id', 'saas_id', 'coupon_id', 'coupon_auto_send_id', 'begin_time', 'end_time', 'is_expire', 'is_use', 'is_delete', 'created_at', 'type', 'integral', 'updated_at', 'give_user_id'], 'integer'], [['price'], 'number'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'saas_id' => '用户id', 'coupon_id' => '优惠券id', 'coupon_auto_send_id' => '自动发放id', 'begin_time' => '有效期开始时间', 'end_time' => '有效期结束时间', 'is_expire' => '是否已过期:0=未过期,1=已过期', 'is_use' => '是否已使用:0=未使用,1=已使用', 'is_delete' => '是否删除', 'created_at' => '添加时间', 'type' => '领取类型 0--平台发放 1--自动发放 2--领券中心领取 3--saas福利中心 4--转赠', 'integral' => '兑换支付积分数量', 'price' => '兑换支付价格', 'updated_at' => '更新时间', ]; } public function getCoupon() { return $this->hasOne(Coupon::className(), ['id' => 'coupon_id']); } public function getSaas() { return $this->hasOne(SaasUser::className(), ['id'=>'saas_id']); } }