* @version : HUOSDK 8.0 */ namespace huo\controller\help; use huo\controller\common\Base; use huolib\constant\GameConst; use huolib\status\CommonStatus; class Help extends Base { /** * h5 浮点客服信息 * * @param $game_id * * @return array */ public function getH5FloatHelp($game_id = 0) { $_data['qq'] = $this->getHelpQq($game_id); $_data['qqgroup'] = $this->getHelpQqGroup($game_id); $_data['wx'] = $this->getHelpWx($game_id); $_data['tel'] = $this->getHelpMobile($game_id); $_data['service_time'] = $this->getHelpServiceTime($game_id); $_data['weibo'] = $this->getHelpWeibo($game_id); $_data['officesite'] = $this->getHelpOfficeSite($game_id); $_code = CommonStatus::NO_ERROR; return $this->huoSuccess($_code, CommonStatus::getMsg($_code), $_data); } /** * 获取客服QQ信息 * * @param $game_id * * @return string */ public function getHelpQq($game_id) { $_data = []; if (!empty($game_id)) { $_qq_ids = $this->getHelpData($game_id, 'qq_ids'); if (!empty($_qq_ids)) { $_data = (new QqCache())->getQqByIds($_qq_ids, GameConst::QQ_TYPE_QQ); } } if (empty($_data)) { $game_id = 0; $_qq_ids = $this->getHelpData($game_id, 'qq_ids'); if (!empty($_qq_ids)) { $_data = (new QqCache())->getQqByIds($_qq_ids, GameConst::QQ_TYPE_QQ); } } return json_encode($_data); } /** * 获取客服QQ群信息 * * @param $game_id * * @return string */ public function getHelpQqGroup($game_id) { $_data = []; if (!empty($game_id)) { $_qq_ids = $this->getHelpData($game_id, 'qq_ids'); if (!empty($_qq_ids)) { $_data = (new QqCache())->getQqByIds($_qq_ids, GameConst::QQ_TYPE_QQ_GROUP); } } if (empty($_data)) { $game_id = 0; $_qq_ids = $this->getHelpData($game_id, 'qq_ids'); if (!empty($_qq_ids)) { $_data = (new QqCache())->getQqByIds($_qq_ids, GameConst::QQ_TYPE_QQ_GROUP); } } return json_encode($_data); } /** * 获取客服微信 * * @param $game_id * * @return string */ public function getHelpWx($game_id) { return $this->getHelpData($game_id, 'wx'); } /** * 获取客服电话 * * @param $game_id * * @return string */ public function getHelpMobile($game_id) { $_data = $this->getHelpData($game_id, 'tel'); $_data = explode(',', $_data); return json_encode($_data); } /** * 获取客服时间 * * @param $game_id * * @return string */ public function getHelpServiceTime($game_id) { return $this->getHelpData($game_id, 'service_time'); } /** * 获取客服微博 * * @param $game_id * * @return string */ public function getHelpWeibo($game_id) { return $this->getHelpData($game_id, 'weibo'); } /** * 获取 官方网站 * * @param $game_id * * @return string */ public function getHelpOfficeSite($game_id) { return $this->getHelpData($game_id, 'officesite'); } /** * 获取数据库信息 * * @param $game_id * @param $field * * @return string */ public function getHelpData($game_id, $field) { $_data = ''; if (!empty($game_id)) { $_gmh_data = (new GameHelpCache())->getInfoByGmhId($game_id); $_data = $_gmh_data[$field]; } if (empty($_data)) { $game_id = 0; $_gmh_data = (new GameHelpCache())->getInfoByGmhId($game_id); $_data = $_gmh_data[$field]; } return $_data; } }