IsImei($Imei)) { json_fail('该Imei号不存在'); } if (!($param['SoftVersion']) || $param['SoftVersion'] == '') { $param['SoftVersion'] = 0; } $version = $param['SoftVersion']; $this->Conversion($param, 1); return json_success('获取成功', '', $Imei); } /** * @Descripttion: 上传维护模式 * @name: likang * @return {*} */ public function UploadWorkRecordMA() { $param = json_decode(file_get_contents("php://input"), true); //校验imei是否存在 if (!isset($param['IMEI']) || $param['IMEI'] == '') { json_fail('缺少设备IMEI号参数'); } $Imei = $param['IMEI']; if (!$this->IsImei($Imei)) { json_fail('该Imei号不存在'); } if (!($param['SoftVersion']) || $param['SoftVersion'] == '') { $param['SoftVersion'] = 0; } $version = $param['SoftVersion']; $this->Conversion($param, 2); return json_success('获取成功', '', $Imei); } /** * @Descripttion: Imei 是否存在 * @name: likang * @param {*} $imei * @return {*} */ private function IsImei($imei) { $data = ModelHydraulic::where('imei', $imei)->find(); if ($data) { return true; } else { return false; } } /** * @Descripttion: * @name: likang * @param {*} $data 数据内容 * @param {*} $type 工作类型 * @return {*} */ private function Conversion($data, $type) { $content = []; $content['creator_id'] = Users::where('username', $data['Username'])->value('id'); $content['wrench_number'] = $data['WrenchNumber']; $content['fan_number'] = $data['TurbineNumber']; $content['fan_model'] = $data['Model']; $content['parts'] = $data['PartNumber']; $content['work_sign'] = $data['WorkPos']; $content['boit_type'] = $data['BoltModel']; $content['bolt_number'] = $data['BoltNumber']; $content['boit_total'] = $data['BoltTotal']; $content['set_torque'] = $data['SetTorque']; $content['fastening_torque'] = $data['FasteningTorque']; $content['set_stress'] = $data['SetStress']; $content['fastening_stress'] = $data['FasteningStress']; $content['fastening_status'] = $data['FasteningStatus']; $content['fastening_time'] = $data['Time']; $content['move_angle'] = $data['WrenchAngle']; $content['imei'] = $data['IMEI']; $content['FasteningStatus'] = $data['FasteningStatus']; if ($type == 2) { $content['wrench_type'] = $data['FasteningStatus']; if ($data['FasteningStatus'] == 3) { if ($content['move_angle'] > 2) { $content['FasteningStatus'] = 2; } } else { $content['FasteningStatus'] = 1; } } else { $content['wrench_type'] = 1; } $workRecod = new ModelWorkRecord(); $bool = $workRecod->save($content); } }