Android 项目

2018-11-18  本文已影响0人  flashyy

修改冗余代码

1.修改URL.java内容

LOGIN("/api/user/login","用户登录"),

PERSON_CENTER("/api/user/update","用户中心"),

REGISTER("/api/user/register","用户注册"),

UPDATE_USER_PASSWORD("/api/user/modifyPassword","用户修改密码"),

SCAN("/api/device/add","二维码扫描"),

DEVICEINFO("/api/device/update","添加设备"),

DEVICEITEM("/api/device/devices","获取单个设备信息"),

SMART_UPDATE_FISH("/api/device/getData","更新鱼种"),

LIGHT_AUTO_CONTROLLER("/api/compositeDevice/change","自动控制光照"),

LIGHT_SELF_CONTROLLER("/api/compositeDevice/change","手动控制光照"),

LIGHT_SWITCH("/api/compositeDevice/change","灯光开关"),

LIGHTNESS_CONTROLLER("/api/compositeDevice/change","光照亮度"),

2.修改Feedback.java内容

SUCCESS("请求成功",200),

DEVICE_NO_EXIT("设备不存在",201),

DEVICE_PASS_ERROR("设备密码错误",202),

DEVICE_OFFLINE("设备离线",203),

USER_PASS_ERROR("用户密码错误",-1),

USER_ID_NO_EXIT("用户账户不存在", -2),

PERSON_CENTER_SUCCESS("修改成功",200),

PERSON_CENTER_PARAM_WRONG("参数错误",-1),

PERSON_CENTER_WRONGPWD("密码错误",-2),

REGISTE_SUCCESS("注册成功",200),

REGISTE_USERNAME_EXIST("用户名已存在", -1),

REGISTE_PARAM_WRONG("参数错误", -2),

REGISTE_PHONE_EXIST("手机号已存在", -3),

SCAN_SUCCESS("添加成功",200),

SCAN_WORONGPSW("设备密码错误",-1),

SCAN_WRONGCODE("设备编码错误",-2),

SCAN_NOUSER("用户不存在",-3),

SCAN_DEVICE_EXIST("设备已添加",-5),

DEVICE_INFO_SUCCESS("修改成功",200),

DEVICE_INFO_WRONGPWD("设备密码错误",-2),

DEVICE_INFO_WRONDCODE("设备编码错误",-3),

DEVICE_ITEM_SUCCESS("刷新成功",200),

DEVICE_ITEM_WRONGPWD("用户不存在", -1),

DEVICE_ITEM_NOUSER("用户密码错误",-2),

3.修改所有Activity的上述的相关内容

MainActivity.java 

PersonCenter.java

RegisteActivity.java

DeviceInfoActivity.java

DeviceItemActivity.java

SmartFishActivity.java

AddDeviceActivity.java

4.修改所有Activity的switch为 if else

同3.

上一篇下一篇

猜你喜欢

热点阅读