Data.php
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
namespace app\api\controller;
use think\Db;
use app\common\controller\Api;
/**
* 数据存储
*/
class Data extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @ApiTitle (产品移动轨迹记录)
* @ApiSummary (产品移动轨迹记录)
* @ApiMethod (POST)
* @ApiRoute (/api/Data/BatteryWhere)
* @ApiParams (name="cp_xulehao", type="string", required=true, description="产品序列号")
* @ApiParams (name="lng", type="string", required=true, description="经度")
* @ApiParams (name="lat", 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 BatteryWhere()
{
$Params = $this->request->param();
Db::name('gis')->insert(['cp_xulehao' => $Params['cp_xulehao'], 'lng' => $Params['lng'], 'lat' => $Params['lat'], 'createtime' => time()]);
$this->success('成功', 1);
}
/**
* @ApiTitle (动态数据记录)
* @ApiSummary (动态数据记录)
* @ApiMethod (POST)
* @ApiRoute (/api/Data/DynamicData)
* @ApiParams (name="cp_xulehao", type="string", required=true, description="产品序列号")
* @ApiParams (name="yydt_jb", type="string", required=true, description="警报信息")
* @ApiParams (name="yydt_dqdl", type="string", required=true, description="当前电量")
* @ApiParams (name="yydt_gfbhcs", type="string", required=true, description="过放保护次数")
* @ApiParams (name="yydt_gfbcsj", type="string", required=true, description="过放保护时间")
* @ApiParams (name="yydt_ljxhcs", type="string", required=true, description="累计循环次数")
* @ApiParams (name="yydt_dqrl", type="string", required=true, description="当前容量")
* @ApiParams (name="yydt_zfdl", type="string", required=true, description="总放电量")
* @ApiParams (name="yydt_zcdl", type="string", required=true, description="总充电量")
* @ApiParams (name="yydt_pjdy", type="string", required=true, description="平均电压")
* @ApiParams (name="yydt_zgdtdy", type="string", required=true, description="最高单体电压")
* @ApiParams (name="yydt_zddtdy", type="string", required=true, description="最低单体电压")
* @ApiParams (name="yydt_dqzgwd", type="string", required=true, description="当前最高温度")
* @ApiParams (name="yydt_dqzdwd", 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 DynamicData()
{
$Params = $this->request->param();
$data = [
'cp_xulehao' => $Params['cp_xulehao'],
'yydt_jb' => $Params['yydt_jb'],
'yydt_dqdl' => $Params['yydt_dqdl'],
'yydt_gfbhcs' => $Params['yydt_gfbhcs'],
'yydt_gfbcsj' => $Params['yydt_gfbcsj'],
'yydt_ljxhcs' => $Params['yydt_ljxhcs'],
'yydt_dqrl' => $Params['yydt_dqrl'],
'yydt_zfdl' => $Params['yydt_zfdl'],
'yydt_zcdl' => $Params['yydt_zcdl'],
'yydt_pjdy' => $Params['yydt_pjdy'],
'yydt_zgdtdy' => $Params['yydt_zgdtdy'],
'yydt_zddtdy' => $Params['yydt_zddtdy'],
'yydt_dqzgwd' => $Params['yydt_dqzgwd'],
'yydt_dqzdwd' => $Params['yydt_dqzdwd'],
'createtime' => time()
];
Db::name('yydtsjb')->insert($data);
$this->success('成功', 1);
}
}