'1', 'name' => '', 'remarks' => '', 'phone' => '', 'business_time' => '', 'qr_code' => '', 'enterprise_id' => '', 'kefu_link' => '' ]; $config = [ 'mnp' => ConfigService::get('kefu_config', 'mnp', $defaultData), 'oa' => ConfigService::get('kefu_config', 'oa', $defaultData), 'h5' => ConfigService::get('kefu_config', 'h5', $defaultData), 'pc' => ConfigService::get('kefu_config', 'pc', $defaultData), 'app' => ConfigService::get('kefu_config', 'app', $defaultData), ]; if (!empty($config['mnp']['qr_code'])) $config['mnp']['qr_code'] = FileService::getFileUrl($config['mnp']['qr_code']); if (!empty($config['oa']['qr_code'])) $config['oa']['qr_code'] = FileService::getFileUrl($config['oa']['qr_code']); if (!empty($config['h5']['qr_code'])) $config['h5']['qr_code'] = FileService::getFileUrl($config['h5']['qr_code']); if (!empty($config['pc']['qr_code'])) $config['pc']['qr_code'] = FileService::getFileUrl($config['pc']['qr_code']); if (!empty($config['app']['qr_code'])) $config['app']['qr_code'] = FileService::getFileUrl($config['app']['qr_code']); return $config; } /** * @notes 设置 * @param $params * @return string|true * @author ljj * @date 2024/8/27 下午5:17 */ public static function setConfig($params) { Db::startTrans(); try { foreach($params as $key => $value) { if(!in_array($key, ['mnp','oa','h5','pc','app'])) { throw new \think\Exception('数据异常'); } ConfigService::set('kefu_config', $key, $value); } // 提交事务 Db::commit(); return true; } catch (\Exception $e) { // 回滚事务 Db::rollback(); return $e->getMessage(); } } }