where([ 'uid' => $uid, 'use_status' => static::STATUS_CAN_USE ])->get(); } public static function getUseStatusMap() { return [ self::STATUS_CAN_USE => self::STATUS_CAN_USE_STRING, self::STATUS_USED => self::STATUS_USED_STRING, ]; } // 关联优惠模型 public function getCoupon() { return $this->hasOne(ShopCoupon::class, 'id', 'coupon_id'); } }