'integer', 'avatar_id' => 'integer', 'gender' => 'integer', 'age' => 'integer', 'city' => 'integer', 'is_del' => 'integer']; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time'; /** * @param int $id * @return Builder|\Hyperf\Database\Model\Model|null */ public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null { return $this->where('id', $id)->first(); } /** * @param array $ids * @return array */ public function getInfoByIds(array $ids): array { $data = $this->whereIn('id', $ids)->get(); if ($data->isEmpty()) return []; $data = $data->toArray(); return array_column($data,null,'id'); } /** * @param string $code * @return int */ public function checkInviteCodeIsUse(string $code): int { return $this->where('invite_code', $code)->count() ?? 0; } /** * @param string $code * @return int */ public function getUserIdByInviteCode(string $code): int { return $this->where('invite_code', $code)->value('id') ?? 0; } }