diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 15403b0..2249e7d 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -884,4 +884,34 @@ class Index extends Api $res = Db::name('stor')->where('id', $params['id'])->where('user_id', $UserId)->delete(); $this->res($res); } + + + /** + * 首页接口 + * @ApiTitle (电池电量存储) + * @ApiSummary (电池电量存储) + * @ApiMethod (POST) + * @ApiRoute (/api/Index/InsertBattery) + * @ApiParams (name="code", type="string", required=true, description="电池编码") + * @ApiParams (name="battery", type="string", required=true, description="电量") + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") + * @ApiReturn ({ + 'code':'1', + 'msg':'返回成功', + "data": { + } + }) + */ + public function InsertBattery() + { + $Params = $this->request->param(); + $data = [ + 'code' => $Params['code'], + 'battery' => $Params['battery'], + 'createtime' => time() + ]; + $Res = Db::name('battery')->insert($data); + $this->Res($Res); + } }