where('counting_month', $counting_month) ->where('owner_id', $owner_id)->where('type', $type); } /** * @param $counting_month * @param $owner_id * @param $type * @return int */ public function isArchived($counting_month, $owner_id, $type): int { $type = $this->switchType($type); return $this->getSql($counting_month, $owner_id, $type)->exists() ? 1 : 2; } /** * 获取确认账单数据 * @param array $kvPairs * @return Builder|Model|object|null */ public function get(array $kvPairs) { return $this->getSql($kvPairs['counting_month'], $kvPairs['owner_id'], $this->switchType($kvPairs['type']))->first(); } /** * @param $type * @return int|mixed */ private function switchType($type) { //枚举转换 if (is_string($type)) { $type = OwnerBillReportArchive::$enums['type'][$type]; } return $type; } }