mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
同步代码
This commit is contained in:
parent
6eac25425c
commit
c901931738
6 changed files with 26 additions and 4 deletions
|
|
@ -49,6 +49,21 @@ public class DeviceController {
|
|||
DeviceEntity device = deviceService.bindDevice(user.getId(), deviceHeader);
|
||||
return new Result<DeviceEntity>().ok(device);
|
||||
}
|
||||
|
||||
// @PostMapping("/add/{deviceCode}")
|
||||
// @Operation(summary = "添加设备")
|
||||
// @RequiresPermissions("sys:role:normal")
|
||||
// public Result<DeviceEntity> addDevice(@PathVariable String deviceCode) {
|
||||
// UserDetail user = SecurityUser.getUser();
|
||||
//
|
||||
// String deviceHeaders = (String) redisUtils.get(RedisKeys.getDeviceCaptchaKey(deviceCode));
|
||||
// if (StringUtils.isBlank(deviceHeaders)) {
|
||||
// return new Result<DeviceEntity>().error(ErrorCode.DEVICE_CAPTCHA_ERROR);
|
||||
// }
|
||||
// DeviceHeaderDTO deviceHeader = JsonUtils.parseObject(deviceHeaders.getBytes(), DeviceHeaderDTO.class);
|
||||
// DeviceEntity device = deviceService.addDevice(user.getId(), deviceHeader);
|
||||
// return new Result<DeviceEntity>().ok(device);
|
||||
// }
|
||||
|
||||
@GetMapping("/bind")
|
||||
@Operation(summary = "获取已绑定设备")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ spring:
|
|||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: root%12345
|
||||
initial-size: 10
|
||||
max-active: 100
|
||||
min-idle: 10
|
||||
|
|
|
|||
1
main/manager-web/.npmrc
Normal file
1
main/manager-web/.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
registry=https://registry.npmjs.org/
|
||||
|
|
@ -7,9 +7,9 @@ import user from './module/user.js'
|
|||
* 如果你想调用8002端口,就用'/xiaozhi-esp32-api/api/v1',请与vue.config.js的devServer配置相结合,方便跨域请求
|
||||
*
|
||||
*/
|
||||
const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default'
|
||||
// const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default'
|
||||
// 8002开发完成完成后使用这个
|
||||
// const DEV_API_SERVICE = '/xiaozhi-esp32-api'
|
||||
const DEV_API_SERVICE = 'http://localhost:8002/xiaozhi-esp32-api'
|
||||
|
||||
/**
|
||||
* 根据开发环境返回接口url
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default {
|
|||
// 绑定设备
|
||||
bindDevice(deviceCode, callback) {
|
||||
RequestService.sendRequest()
|
||||
.url(`${getServiceUrl()}/api/v1/user/device/bind/${deviceCode}`)
|
||||
.url(`${getServiceUrl()}/api/v1/device/bind/${deviceCode}`)
|
||||
.method('POST')
|
||||
.success((res) => {
|
||||
RequestService.clearRequestTime();
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
import DeviceItem from '@/components/DeviceItem.vue'
|
||||
import AddDeviceDialog from '@/components/AddDeviceDialog.vue'
|
||||
import HeaderBar from '@/components/HeaderBar.vue'
|
||||
import Api from '@/apis/api';
|
||||
export default {
|
||||
name: 'HomePage',
|
||||
components: { DeviceItem, AddDeviceDialog, HeaderBar },
|
||||
|
|
@ -74,6 +75,11 @@ export default {
|
|||
handleDeviceAdded(deviceCode) {
|
||||
// 根据需要处理添加设备后逻辑,比如刷新设备列表等
|
||||
console.log('设备验证码:', deviceCode)
|
||||
Api.user.bindDevice(deviceCode).then(res => {
|
||||
console.log('绑定设备成功:', res)
|
||||
}).catch(err => {
|
||||
console.error('绑定设备失败:', err)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue