'integer', 'status' => 'integer']; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time'; /** * @param int $id * @return Builder|\Hyperf\Database\Model\Model|object|null */ public function getInfoById(int $id) { return $this->where('id', $id)->first(); } /** * @param string $name * @return Builder|\Hyperf\Database\Model\Model|object|null */ public function getInfoByName(string $name) { return $this->where('name', $name)->first(); } /** * 获取批量数据 * @param $ids * @return array */ public function getDataByIds($ids) { $data = $this->whereIn('id', $ids)->get(); if (empty($data)){ return []; } $res = []; foreach ($data->toArray() as $one) { $res[$one['id']] = $one; } return $res; } }