|
@@ -18,14 +18,21 @@ error_reporting(0);
|
|
|
class Tool extends Base
|
|
|
{
|
|
|
/**
|
|
|
- * @Descripttion: 下发设备 携带的参数 imei号 版本号
|
|
|
+ * @Descripttion: 下发设备 携带的参数 imei号 版本号 上传心跳包
|
|
|
* @name: likang
|
|
|
* @return {*}
|
|
|
*/
|
|
|
|
|
|
+
|
|
|
public function Issued()
|
|
|
{
|
|
|
+ $token = $_GET['token'];
|
|
|
+ if (!$token || $token != '22723927C') {
|
|
|
+ json_fail('缺少token或者token错误');
|
|
|
+ }
|
|
|
+
|
|
|
$param = json_decode(file_get_contents("php://input"), true);
|
|
|
+
|
|
|
//校验imei是否存在
|
|
|
if (!isset($param['IMEI']) || $param['IMEI'] == '') {
|
|
|
json_fail('缺少设备IMEI号参数');
|
|
@@ -34,18 +41,23 @@ class Tool extends Base
|
|
|
if (!$this->IsImei($Imei)) {
|
|
|
json_fail('该Imei号不存在');
|
|
|
}
|
|
|
- if (!($param['SoftVersion']) || $param['SoftVersion'] == '') {
|
|
|
+ if (!($param['CntVersion']) || $param['CntVersion'] == '') {
|
|
|
|
|
|
- $param['SoftVersion'] = 0;
|
|
|
+ $param['CntVersion'] = 0;
|
|
|
}
|
|
|
- // $param['SoftVersion'] = 1658387272908;
|
|
|
- $version = $param['SoftVersion'];
|
|
|
+
|
|
|
+ $version = $param['CntVersion'];
|
|
|
return $this->DataIssued($Imei, $version);
|
|
|
}
|
|
|
//收到的数据
|
|
|
public function receive()
|
|
|
{
|
|
|
+ $token = $_GET['token'];
|
|
|
+ if (!$token || $token != '22723927C') {
|
|
|
+ json_fail('缺少token或者token不对');
|
|
|
+ }
|
|
|
$param = json_decode(file_get_contents("php://input"), true);
|
|
|
+
|
|
|
//校验imei是否存在
|
|
|
$where = [];
|
|
|
if (!isset($param['Imei']) || $param['Imei'] == '') {
|
|
@@ -92,6 +104,10 @@ class Tool extends Base
|
|
|
*/
|
|
|
private function DataIssued($Imei, $version)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$where1 = [
|
|
|
['ContentType', '<>', 'WorkRecord'],
|
|
|
['Imei', '=', NULL],
|
|
@@ -115,8 +131,20 @@ class Tool extends Base
|
|
|
->whereOr([$where1, $where2, $where4])
|
|
|
->order('Version asc')->limit(5)->select();
|
|
|
if ($list->isEmpty()) {
|
|
|
+
|
|
|
return json_success('获取成功', $content, $Imei);
|
|
|
}
|
|
|
+ //目前不下发数据 截停
|
|
|
+ return json_success('获取成功', $content, $Imei);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
foreach ($list as $key => $value) {
|
|
|
|
|
|
$da = json_decode($value['Content'], true);
|
|
@@ -126,7 +154,8 @@ class Tool extends Base
|
|
|
$where3[] = ['fan_number', '=', $da['fnum']];
|
|
|
$where3[] = ['parts', '=', $da['parts']];
|
|
|
$where3[] = ['work_sign', '=', $da['work']];
|
|
|
- $da['lt'] = WorkRecord::where($where3)->order('fastening_time desc')->value('fastening_torque');
|
|
|
+ $DD = WorkRecord::where($where3)->order('fastening_time desc')->value('fastening_torque');
|
|
|
+ $da['lt'] = $DD ? $DD : 0;
|
|
|
}
|
|
|
$da['id'] = strval($da['id']);
|
|
|
$content[] = [
|
|
@@ -138,6 +167,7 @@ class Tool extends Base
|
|
|
];
|
|
|
$CntVersion = strval($value['Version']);
|
|
|
}
|
|
|
+
|
|
|
//保存下发的记录
|
|
|
$ack = [
|
|
|
'PublishVersion' => $CntVersion,
|