### CTA SDK Usage Example - Multiple Instances Source: https://help.fxiaoke.com/93d5/0f81/5171 Example showing how to initialize and manage multiple independent CTA SDK instances. ```APIDOC // 第一个实例 const cta1 = FsYxt.CtaSDK({ ctaId: "first-cta-id" }); // 第二个实例 const cta2 = FsYxt.CtaSDK({ ctaId: "second-cta-id", autoExecuteOnReady: false }); ``` -------------------------------- ### Invalid Operation XML Request (GET and POST) Source: https://help.fxiaoke.com/9bfb/c68f/b2b9/00d6 Examples of request formats for an 'invalid' operation. For GET requests, parameters are appended to the URL. For POST requests, parameters are included in the request body. ```xml get方式,拼接到url里面invalid?objAPIName=#(objAPIName)&dataId=#(dataId) ``` ```xml post方式,放在请求体里面 #(objAPIName) #(dataId) ``` -------------------------------- ### SDK Configuration Example Source: https://help.fxiaoke.com/93d5/9188/6407/f4f4 Example of how to configure the SDK with essential parameters like enterprise EA, website ID, and host. This must be called before using other SDK features. ```javascript FsYxt.configure({ ea: "88146", websiteId: "8b28bec67afc42c281f078ff9bea7fec", host: "crm.example.com" }); ``` -------------------------------- ### Recommended SDK Installation Source: https://help.fxiaoke.com/93d5/9188/6407/f4f4 Use this method to asynchronously load and initialize the FsYxt Web SDK. Ensure the script is loaded before calling configuration or other SDK methods. ```html ``` -------------------------------- ### winsw Commands for SAP Proxy Service Management Source: https://help.fxiaoke.com/9bfb/c68f/502e/8fe0 Common commands to manage the SAP proxy service using winsw.exe, including installation, starting, stopping, and uninstallation. ```bash winsw.exe install winsw.exe start winsw.exe stop winsw.exe uninstall ``` -------------------------------- ### Linux Service Setup Script Source: https://help.fxiaoke.com/9bfb/c68f/502e/8fe0 This bash script automates the creation and management of the SAP connector as a systemd service. It checks for Java installation, creates a service file, and manages the service lifecycle. ```bash #!/bin/bash basePath=$(pwd) serviceName="sapConnect" jarPath="$basePath/sapConnect.jar" libraryPath="-Djava.library.path=$basePath/sapjar" config="--spring.config.location=file:$basePath/config/application.properties" # 检查Java是否安装 function check_java_installed { if ! command -v java &> /dev/null then echo "未找到Java环境,请确保Java已安装并配置在PATH中。" exit 1 fi } echo "检查Java环境..." check_java_installed servicePath="/etc/systemd/system/${serviceName}.service" # 检查服务是否已存在 if [ -f "$servicePath" ]; then echo "服务已存在,配置文件路径:$servicePath" read -p "是否重新生成配置文件并重启服务?(y/n): " response if [ "$response" != "y" ]; then echo "已退出。" exit 0 fi fi if [ ! -f "$jarPath" ]; then echo "目录下不存在jar包:db-proxy-server.jar" exit 1 fi # 创建服务文件 cat <"$servicePath" [Unit] Description=Java Service - $serviceName After=network.target network-online.target Wants=network-online.target [Service] Type=simple ExecStart=/usr/bin/java -jar $jarPath $libraryPath $config WorkingDirectory=$basePath User=root Restart=on-failure RestartSec=3 [Install] WantedBy=multi-user.target EOF echo "配置文件已生成并写入:$servicePath" # 重新加载systemd守护进程,启动和启用服务 systemctl daemon-reload systemctl start $serviceName systemctl enable $serviceName # 等待进度条 echo -n "启动服务中" for i in {1..10}; do echo -n "." sleep 1 done echo "完成" echo "服务${serviceName}已启动。" echo "在app/logs下查看服务日志" echo "执行以下命令查看服务状态: systemctl status $serviceName" # 显示服务状态 systemctl status $serviceName ``` -------------------------------- ### Deprecated SDK Installation and Configuration Source: https://help.fxiaoke.com/93d5/9188/6407/f4f4 This method combines SDK loading and initialization in a single step. It is deprecated and only for legacy projects. New projects should use the recommended method. ```javascript (function () { var config = { ea: 'your-enterprise-ea', websiteId: 'your-website-id', host: 'your-host.com' }; var s = document.createElement("script"); s.type = "text/javascript"; s.charset = "utf-8"; s.src = "https://www.fxiaoke.com/ec/kemai/release/static/marketing-website-access.js?id=" + Math.random(); s.id = "fsMarketingWebsiteScript"; s.innerHTML = [ "FSscriptArgs.WebsiteEa='" + config.ea + "'", "FSscriptArgs.WebsiteId='" + config.websiteId + "'", "FSscriptArgs.host='" + config.host + "'" ].join(';'); window.FsYxtWebsiteEa = config.ea; window.FsYxtWebsiteId = config.websiteId; window.FsYxtHost = config.host; document.getElementsByTagName("head")[0].appendChild(s); })(); ``` -------------------------------- ### Batch Query ERP Data Source: https://help.fxiaoke.com/9bfb/221e/70d7 This GET request allows for the periodic polling of incremental data from the ERP system within a specified time range. Parameters include the object API name, start and end times (Unix timestamp in milliseconds), and pagination controls. ```http GET http://MyDoman/path/queryMasterBatch?objAPIName=查询 ERP 对象的 APIName&startTime=数据变更的开始时间(unix 时间戳,单位毫 秒)&endTime=数据变更的结束时间(unix 时间戳,单位毫秒)&includeDetail=true&offset=获取记录的偏移&limit=当前请求记录条数 ``` ```json { "code": "错误返回码", "message": "错误提示语", "data": { "totalNum": "总记录数", "dataList": [ { "objAPIName": "ERP 侧对象的 APIName", "masterFieldVal": { "Key1": "value1", "Key2": "value2", "Key3": "value3" }, "detailFieldVals": { "明细 apiName1": [ { "Key4": "value4", "Key5": "value5", "Key6": "value6" } ], "明细 apiName2": [ { "Key4": "value7", "Key5": "value8", "Key6": "value9" } ] } } ] } } ``` -------------------------------- ### Hutool Configuration Examples (user.setting and db.setting) Source: https://help.fxiaoke.com/9bfb/c68f/0540/191e These examples show the configuration for user authentication and database connections using Hutool's configuration files. The `setting.dir` property in Spring configuration must point to the directory containing these files. ```properties # user.setting # 安全性配置 username=admin password=1234qwer ``` ```properties #db.setting 数据库配置, #使用druid的配置参考https://github.com/alibaba/druid/wiki/DruidDataSource%E9%85%8D%E7%BD%AE%E5%B1%9E%E6%80%A7%E5%88%97%E8%A1%A8 #分组名就是作为数据源名称 [db1] url=jdbc:postgresql://localhost:5432/db1?ssl=false username=postgres password=1234qwer queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true [db2] url=jdbc:postgresql://localhost:5432/db2?ssl=false username=postgres password=1234qwer queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true [db3] # mysql url=jdbc:mysql://localhost:3306/db3?useSSL=false&characterEncoding=UTF-8&connectionTimeZone=Asia/Shanghai username=root password=1234qwer queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true [db4] # sqlserver url=jdbc:sqlserver://;serverName=localhost;databaseName=db4;encrypt=true;trustServerCertificate=true username=sa password=8kn0ye66JxO5 queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true [db5] # oracle url=jdbc:oracle:thin:@127.0.0.1:1521:XE username=dbproxy password=1234qwer queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true [dm8] # 达梦数据库 需要另外增加驱动启动 url=jdbc:dm://localhost:5236?LobMode=1 username=SYSDBA password=SYSDBA001 queryTimeout=30 initialSize=5 maxActive=20 testWhileIdle=true # 未集成驱动的,需要指定jdbc驱动的jar包。 driverJarPath=D:\driver\db-driver\DmJdbcDriver18.jar ```