setConfig($data, '客服设置', 1, [ [ 'site_id', '=', 1 ], [ 'app_module', '=', 'shop' ], [ 'config_key', '=', 'SERVICER_CONFIG' ] ]); return $res; } /** * 客服配置 */ public function getConfig() { $config = new ConfigModel(); $res = $config->getConfig([ [ 'site_id', '=', 1 ], [ 'app_module', '=', 'shop' ], [ 'config_key', '=', 'SERVICER_CONFIG' ] ]); if (empty($res['data']['value'])) { $socket_url = (get_http_type() === 'http' ? str_replace('http', 'ws', __ROOT__) : str_replace('https', 'wss', __ROOT__)) . '/wss'; $res['data']['value'] = [ // 客服类型 'web_socket' => $socket_url ]; } return $res; } /** * 设置客服配置 * @param $data * @return array */ public function setKeywordConfig($data) { $config_model = new ConfigModel(); $res = $config_model->setConfig($data, '关键词配置', 1, [['site_id', '=', 1], ['app_module', '=', 'shop'], ['config_key', '=', 'SRRVICER_KEYWORD_CONFIG']]); return $res; } /** * 获取客服配置 */ public function getKeywordConfig() { $config_model = new ConfigModel(); $res = $config_model->getConfig([['site_id', '=', 1], ['app_module', '=', 'shop'], ['config_key', '=', 'SRRVICER_KEYWORD_CONFIG']]); if(empty($res['data']['value'])) $res['data']['value'] = ['is_open' => 0]; return $res; } }