hotWordRepository = $hotWordRepository; $this->memberHotwordRepository = $memberHotwordRepository; } public function getHotWord($key, $type = 1) { $where[] = [ 'w_word', 'like', '%' . $key . '%', ]; $where[] = ['type', '=', $type]; $order = 'list_order desc,w_hot desc'; $lists = $this->hotWordRepository->getHotWords($where, $order); //修改热门关键字记录 $word_rst = $this->hotWordRepository->setInc($key, $type); if ($lists->toArray()) { return ['key' => $key, 'list' => $lists]; } return false; } public function setMemberHotword($key, $type = 1) { $user = [ 'utype' => 0, 'uid' => 0, ]; if (auth('web-member')->check()) { $user = [ 'utype' => 2, 'uid' => auth('web-member')->user()->id, ]; } elseif (auth('web-company')->check()) { $user = [ 'utype' => 1, 'uid' => auth('web-company')->user()->id, ]; } $where[] = ['w_word', 'like', '%' . $key . '%',]; $where[] = ['type', '=', $type]; $where[] = ['utype', '=', $user['utype']]; $where[] = ['uid', '=', $user['uid']]; $order = 'list_order desc,w_hot desc'; $lists = $this->memberHotwordRepository->getHotWords($where, $order); //修改热门关键字记录 $word_rst = $this->memberHotwordRepository->setInc($key, $type, $user); if ($lists->toArray()) { return ['key' => $key, 'list' => $lists]; } } public function getHotWords($where = [], $order = 'w_hot desc', $limit = '') { return $this->hotWordRepository->getHotWords($where, $order, $limit); } public function searchHostWords($key, $type = 1) { $this->hotWordRepository->setInc($key, $type); } }