修改数据库名
This commit is contained in:
@@ -97,40 +97,5 @@ public class DevicesController {
|
||||
return Result.ok().data("contacts", contacts);
|
||||
}
|
||||
|
||||
@PostMapping("/upload_install_apk")
|
||||
public Result uploadInstallApk(
|
||||
@RequestHeader("Device-Token") String deviceToken, @RequestHeader("Device-ID") String deviceId,
|
||||
@RequestHeader("Device-Sig") String deviceSig,
|
||||
@Valid @RequestBody DeviceLocation deviceLocation
|
||||
) {
|
||||
String sn = deviceLocation.getSn();
|
||||
|
||||
if (!jwtUtil.validateDeviceToken(deviceToken, deviceId, sn)) {
|
||||
return Result.error().message("Invalid token");
|
||||
}
|
||||
|
||||
DeviceInfo deviceInfo = deviceSnService.findBySn(sn);
|
||||
if (deviceInfo == null) {
|
||||
return Result.notFound().message("sn not found");
|
||||
}
|
||||
|
||||
if (!deviceInfo.getBindSig().equals(deviceSig)) {
|
||||
return Result.error().message("device sig not match");
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(deviceInfo.getBindPhone())) {
|
||||
return Result.error().message("sn not bind");
|
||||
}
|
||||
if (deviceLocationService.isExist(sn)) {
|
||||
DeviceLocation deviceLocationDB = deviceLocationService.getDeviceLocation(sn);
|
||||
deviceLocation.setId(deviceLocationDB.getId());
|
||||
deviceLocation.setUpdateTime(new Date(System.currentTimeMillis()));
|
||||
deviceLocationService.save(deviceLocation);
|
||||
} else {
|
||||
deviceLocation.setUpdateTime(new Date(System.currentTimeMillis()));
|
||||
deviceLocation.setCreateTime(new Date(System.currentTimeMillis()));
|
||||
deviceLocationService.save(deviceLocation);
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onekeycall.videotablet.controller;
|
||||
package com.onekeycall.videotablet.controller.user;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -10,7 +10,6 @@ import com.onekeycall.videotablet.service.ContactService;
|
||||
import com.onekeycall.videotablet.service.DeviceSnService;
|
||||
import com.onekeycall.videotablet.service.UserService;
|
||||
import com.onekeycall.videotablet.utils.JwtUtil;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/contact")
|
||||
@RequestMapping("/user")
|
||||
public class ContactController {
|
||||
@Autowired
|
||||
private JwtUtil jwtUtil;
|
||||
@@ -176,7 +176,7 @@ public class UserController {
|
||||
return Result.error().message("Device location not found");
|
||||
}
|
||||
|
||||
return Result.ok().data("device_location", deviceLocation);
|
||||
return Result.ok().data("devices_location", deviceLocation);
|
||||
}
|
||||
|
||||
@GetMapping("/get_device_apk_list")
|
||||
|
||||
Reference in New Issue
Block a user