// +---------------------------------------------------------------------- declare(strict_types=1); namespace addon\iot\controller\api; use ywxapp\controller\ApiBase; /** * App 端 client API 控制器公共基类 * * 2026-09-18 Client.php 按功能域拆分(38 个方法 → 4 个控制器): * Client 连接/设备绑定/共享/影子/命令(品类无关的接入层) * Monitor 传感器配置/历史曲线/设备日志/告警(多路数值品类共用) * Scene 场景联动 + 设备分组 * Ota 固件升级 * * ⚠️ 拆分原则:**按功能域,不按设备品类**。接入层(myDevices/sendCommand/ * deviceState/config)全品类共用,将来开关/安防品类复用这些接口,不得 * 再按品类另起控制器。 * 路由 URL(/iot/api/client/*)保持不变,仅路由目标换成新控制器 ⇒ App 无感。 */ abstract class ClientBase extends ApiBase { /** * 当前会员ID */ protected function memberId(): int { return (int) ($this->auth->model->uid ?? 0); } /** * 当前会员账号(Broker 连接用户名通常为 member.account) */ protected function memberAccount(): string { return (string) ($this->auth->model->account ?? ''); } }