mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-28 03:22:39 +00:00
25 lines
514 B
Go
25 lines
514 B
Go
/*
|
|
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
|
SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
package device
|
|
|
|
import (
|
|
"context"
|
|
"stackChan/internal/dao"
|
|
"stackChan/internal/model"
|
|
|
|
"stackChan/api/device/v1"
|
|
)
|
|
|
|
func (c *ControllerV1) GetDeviceInfo(ctx context.Context, req *v1.GetDeviceInfoReq) (res *v1.GetDeviceInfoRes, err error) {
|
|
var info model.DeviceInfo
|
|
err = dao.Device.Ctx(ctx).WherePri(req.Mac).Scan(&info)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
res = (*v1.GetDeviceInfoRes)(&info)
|
|
return res, nil
|
|
}
|