param(); try { $InformationValidate = Loader::validate('InformationValidate'); if(!$InformationValidate->check($param)){ throw new ValidateException($InformationValidate->getError()); } $insertArr = [ 'tenantId' => $param['tenantId'], 'taskId' => $param['taskId'], 'protocol' => $param['protocol'], 'productId' => $param['productId'], 'deviceId' => $param['deviceId'], 'timestamp' => $param['timestamp'] ]; $query = Db::table('bs_device_receiving_information')->where($insertArr)->field('id')->find(); if ($query) throw new ValidateException('数据已存在,请勿重复发送'); $insertArr['create_time'] = date("Y-m-d H:i:s"); Db::table('bs_device_receiving_information')->insert($insertArr); return $this->jsonSuccess(); } catch (ValidateException $exception) { return $this->jsonError($exception->getMessage()); } } }