|
|
@ -2,6 +2,12 @@ package com.iflytop.profilometer.api.system; |
|
|
|
|
|
|
|
import android.content.Context; |
|
|
|
|
|
|
|
import com.iflytop.profilometer.common.constant.SystemConfigType; |
|
|
|
import com.iflytop.profilometer.common.result.Result; |
|
|
|
import com.iflytop.profilometer.dao.SystemConfigDao; |
|
|
|
import com.iflytop.profilometer.model.entity.SystemConfig; |
|
|
|
import com.iflytop.profilometer.model.vo.SystemConfigVO; |
|
|
|
|
|
|
|
/** |
|
|
|
* 系统相关接口 |
|
|
|
*/ |
|
|
@ -12,5 +18,27 @@ public class SystemApi { |
|
|
|
this.context = context.getApplicationContext(); |
|
|
|
} |
|
|
|
|
|
|
|
public String config() { |
|
|
|
SystemConfigDao systemConfigDao = new SystemConfigDao(context); |
|
|
|
SystemConfig serverConfig = systemConfigDao.getSystemConfigByKey(SystemConfigType.SERVER); |
|
|
|
SystemConfigVO systemConfigVO = new SystemConfigVO(); |
|
|
|
if (serverConfig != null) { |
|
|
|
systemConfigVO.setServer(serverConfig.getConfigValue()); |
|
|
|
} |
|
|
|
return Result.success(systemConfigVO); |
|
|
|
} |
|
|
|
|
|
|
|
public String save(String server) { |
|
|
|
SystemConfigDao systemConfigDao = new SystemConfigDao(context); |
|
|
|
SystemConfig systemConfig = new SystemConfig(); |
|
|
|
systemConfig.setConfigKey(SystemConfigType.SERVER); |
|
|
|
systemConfig.setConfigValue(server); |
|
|
|
int rows = systemConfigDao.updateSystemConfig(systemConfig); |
|
|
|
if (rows < 1) { |
|
|
|
systemConfigDao.insertSystemConfig(systemConfig); |
|
|
|
} |
|
|
|
return Result.success(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |