作者 王智

接口新增

@@ -884,4 +884,34 @@ class Index extends Api @@ -884,4 +884,34 @@ class Index extends Api
884 $res = Db::name('stor')->where('id', $params['id'])->where('user_id', $UserId)->delete(); 884 $res = Db::name('stor')->where('id', $params['id'])->where('user_id', $UserId)->delete();
885 $this->res($res); 885 $this->res($res);
886 } 886 }
  887 +
  888 +
  889 + /**
  890 + * 首页接口
  891 + * @ApiTitle (电池电量存储)
  892 + * @ApiSummary (电池电量存储)
  893 + * @ApiMethod (POST)
  894 + * @ApiRoute (/api/Index/InsertBattery)
  895 + * @ApiParams (name="code", type="string", required=true, description="电池编码")
  896 + * @ApiParams (name="battery", type="string", required=true, description="电量")
  897 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  898 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  899 + * @ApiReturn ({
  900 + 'code':'1',
  901 + 'msg':'返回成功',
  902 + "data": {
  903 + }
  904 + })
  905 + */
  906 + public function InsertBattery()
  907 + {
  908 + $Params = $this->request->param();
  909 + $data = [
  910 + 'code' => $Params['code'],
  911 + 'battery' => $Params['battery'],
  912 + 'createtime' => time()
  913 + ];
  914 + $Res = Db::name('battery')->insert($data);
  915 + $this->Res($Res);
  916 + }
887 } 917 }