From 34327c626b278ec2e8f0ddd1585dc08646bfbaec Mon Sep 17 00:00:00 2001 From: xu Date: Sat, 2 Nov 2019 23:46:58 +0800 Subject: [PATCH] 1. F 完成所有接口的逻辑 2. A 后台添加机器状态统计功能 3. F 调整升级新增字段 --- app-api/config/url-rules.php | 4 ++-- app-api/controllers/AuthDeviceController.php | 38 ++++++++++++++++++++++++++------------ app-api/controllers/UpgradeController.php | 489 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------- app-api/helpers/Aes.php | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/datas/controllers/DeviceStatsController.php | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/datas/views/device-stats/export.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/datas/views/device-stats/index.php | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/device/config/perm.php | 2 +- app-ht/modules/device/controllers/DeviceController.php | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- app-ht/modules/device/views/device/auth-fail-index.php | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/device/views/device/index.php | 45 ++++++++++++++++++++++++++++++++++++++++++--- app-ht/modules/upgrade/controllers/UpgradeController.php | 15 ++++++++------- app-ht/views/layouts/routes.php | 8 +++++--- app-ht/web/exts-src/baidumap/MarkerClusterer.js | 636 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ app-ht/web/exts-src/baidumap/TextIconOverlay.js | 1046 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm | Bin 5739430 -> 0 bytes app-ht/web/exts-src/dbr_wasm/js/dbr.js | 46 ---------------------------------------------- app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js | 235 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- app-ht/web/exts/baidumap/MarkerClusterer.js | 1 - app-ht/web/exts/baidumap/TextIconOverlay.js | 1046 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- common/helpers/Utils.php | 18 +----------------- console/controllers/TestController.php | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- domain/device/Device.php | 18 +++++++++++++++++- domain/device/DeviceAuthFailRepository.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ domain/device/DeviceRepository.php | 1 + domain/device/DeviceStats.php | 35 +++++++++++++++++++++++++++++++++++ domain/device/DeviceStatsRepository.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ domain/device/models/DeviceStats.php | 28 ++++++++++++++++++++++++++++ domain/upgrade/Upgrade.php | 2 +- domain/upgrade/UpgradeLog.php | 3 +++ 30 files changed, 1431 insertions(+), 3118 deletions(-) create mode 100644 app-api/helpers/Aes.php create mode 100644 app-ht/modules/datas/controllers/DeviceStatsController.php create mode 100644 app-ht/modules/datas/views/device-stats/export.php create mode 100644 app-ht/modules/datas/views/device-stats/index.php create mode 100644 app-ht/modules/device/views/device/auth-fail-index.php delete mode 100644 app-ht/web/exts-src/baidumap/MarkerClusterer.js delete mode 100644 app-ht/web/exts-src/baidumap/TextIconOverlay.js delete mode 100644 app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm delete mode 100644 app-ht/web/exts-src/dbr_wasm/js/dbr.js delete mode 100644 app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js delete mode 100644 app-ht/web/exts/baidumap/MarkerClusterer.js delete mode 100644 app-ht/web/exts/baidumap/TextIconOverlay.js create mode 100644 domain/device/DeviceStats.php create mode 100644 domain/device/DeviceStatsRepository.php create mode 100644 domain/device/models/DeviceStats.php diff --git a/app-api/config/url-rules.php b/app-api/config/url-rules.php index 7d54854..15e4259 100644 --- a/app-api/config/url-rules.php +++ b/app-api/config/url-rules.php @@ -7,8 +7,8 @@ return [ 'POST authDevice' => 'auth-device/index', 'POST checkOtaVersion' => 'upgrade/check-version', 'POST reportOtaUpgradeEvent' => 'upgrade/report-upgrade-event', - 'POST checkAppVersion' => 'upgrade/check-app-versionx', - 'POST reportAppUpgradeEvent' => 'upgrade/reportAppUpgradeEvent', + 'POST checkAppVersion' => 'upgrade/check-app-version', + 'POST reportAppUpgradeEvent' => 'upgrade/report-app-upgrade-event', 'POST reportDeviceVersion' => 'upgrade/report-device-version', 'GET errorPage' => 'site/error-page-info', 'GET minaQuery' => 'site/mina-query', diff --git a/app-api/controllers/AuthDeviceController.php b/app-api/controllers/AuthDeviceController.php index 881e864..81201db 100644 --- a/app-api/controllers/AuthDeviceController.php +++ b/app-api/controllers/AuthDeviceController.php @@ -6,6 +6,7 @@ namespace app\api\controllers; use Yii; use common\helpers\Utils; +use common\helpers\Log as AppLog; use domain\device\DeviceRepository; use domain\device\Device; use domain\device\DeviceStatus; @@ -32,30 +33,42 @@ class AuthDeviceController extends BaseController { const SIGN_SALT = '13456'; - + private static function myLog($str) + { + AppLog::DEBUG($str); + } /** * 设备授权接口 * @return stdClass */ public function actionIndex() { - $req = Yii::$app->request; - $manufactureNo = $req->post('manufacture'); - $deviceId = $req->post('device_id'); - $projectNo = $req->post('project'); - $modelNo = $req->post('model'); - $sign = $req->post('sign'); - $productionNo = $req->post('production'); - $timestamp = $req->post('timestamp'); $e = new stdClass(); - $e->status = 0; + $e->status = 1; $e->message = 'message'; $e->serial_no = '';; $e->mac = ''; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionIndex postData:'.$getPostData); + if (!$getPostData) { + $e->status = 2; + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $manufactureNo = isset($getPostData['manufacture'])?$getPostData['manufacture']:''; + $deviceId = isset($getPostData['device_id'])?$getPostData['device_id']:''; + $projectNo = isset($getPostData['project'])?$getPostData['project']:''; + $modelNo = isset($getPostData['model'])?$getPostData['model']:''; + $productionNo = isset($getPostData['production'])?$getPostData['production']:''; + $timestamp = isset($getPostData['timestamp'])?$getPostData['timestamp']:''; + $sign = isset($getPostData['sign'])?$getPostData['sign']:''; + $salt = self::SIGN_SALT; $makeSign = md5($manufactureNo . $projectNo. $modelNo . $productionNo . $timestamp . $salt); if ($sign != $makeSign) { + $e->status = 3; $e->message = '签名有误'; return $e; } @@ -65,7 +78,7 @@ class AuthDeviceController extends BaseController $e->mac = $deviceModel->mac; $e->serial_no = $deviceModel->serial_no; $e->message = 'ok'; - $e->status = 1; + $e->status = 0; return $e; } $authResult = Device::authDevice($deviceId, $manufactureNo, $projectNo, $modelNo, $productionNo); @@ -74,8 +87,9 @@ class AuthDeviceController extends BaseController $e->mac = $authResult->mac; $e->serial_no = $authResult->serial_no; $e->message = $authResult->message; - $e->status = 1; + $e->status = 0; } else { + $e->status = 4; $e->message = $authResult->message; } diff --git a/app-api/controllers/UpgradeController.php b/app-api/controllers/UpgradeController.php index b5890bd..3c0c85a 100644 --- a/app-api/controllers/UpgradeController.php +++ b/app-api/controllers/UpgradeController.php @@ -3,8 +3,24 @@ namespace app\api\controllers; use Yii; +use common\helpers\Log as AppLog; +use common\helpers\Utils; +use domain\model\ModelRepository; +use domain\production\ProductionRepository; +use domain\upgrade\models\Upgrade as UpgradeModel; +use domain\upgrade\UpgradeLog; +use domain\upgrade\UpgradeLogRepository; +use domain\upgrade\UpgradeRepository; +use domain\upgrade\UpgradeStatus; +use domain\device\DeviceStatsRepository; +use domain\device\Device; +use domain\device\DeviceStats; +use domain\manufacturer\ManufacturerRepository; +use domain\project\ProjectRepository; +use domain\device\DeviceRepository; use stdClass; + use function sizeof; use function date; use function count; @@ -16,112 +32,467 @@ use function time; */ class UpgradeController extends BaseController { + + private static function myLog($str) + { + AppLog::DEBUG($str); + } /** * OTA 包升级检测 * @return stdClass */ public function actionCheckVersion() { - $req = Yii::$app->request; - $barcode = $req->post('barcode'); - $deviceId = $req->post('device_id'); - $softwareVersion = $req->post('software_version'); - $hardwareVersion = $req->post('hardware_version'); - $e = new stdClass(); - $e->status = 0; - $e->message = 'fail'; + $e->status = 1; + $e->message = 'ok'; $e->update_flag = 0; // 0 1 2 - $e->version = ''; - $e->file_path = ''; - $e->file_md5 = ''; - $e->size = 3627; - $e->package_type = 0; // 0 1, 2 - $e->version_message = 'ok'; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionCheckVersion:'.$getPostData); + if (!$getPostData) { + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']:''; + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']:''; + $softwareVersion = isset($getPostData['software_version'])? $getPostData['software_version']:''; + $hardwareVersion = isset($getPostData['hardware_version'])? $getPostData['hardware_version']:''; + + if (empty($barcode) || empty($packageName) || empty($currentVersion) || empty($softwareVersion)|| empty($hardwareVersion)) { + $e->status = 2; + $e->message = '部分数据为空'; + return $e; + } + + $deviceBatchInfo = Device::explodeBarcode($barcode); + if (empty($deviceBatchInfo)) { + $e->status = 3; + $e->message = 'barcode格式有误'; + return $e; + } + + $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId]); + if (empty($deviceModel)) { + $e->status = 4; + $e->message = '无该设备记录'; + return $e; + } + + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); + $manufactureId = 0; + if ($ma) { + $manufactureId = $ma->id; + } + + $upgradeModel = UpgradeModel::find(); + $upgradeModel->where([ + 'manufacture_id' => $manufactureId, + 'status' => UpgradeStatus::STATUS_ON, + 'is_delete' => 0, + 'type' => UpgradeStatus::TYPE_OTA + ]); + $upgradeModel->andWhere(['>', 'version', $hardwareVersion]); + $upgradeModel->orderBy('created_at desc'); + $upgradeRecord = $upgradeModel->one(); + + if (!$upgradeRecord) { + $e->status = 1; + $e->message = '暂无升级包'; + $e->update_flag = 0; + $e->version = ''; + $e->file_path = ''; + $e->file_md5 = ''; + $e->size = 0; + $e->version_message = ''; + $e->package_type = 0; + + return $e; + } + $devices = []; + if ($upgradeRecord->device_ids) { + $devices = explode(',', $upgradeRecord->device_ids); + } + // 不在预发布指定的设备里面 + if ($devices && !in_array($deviceId, $devices)) { + $e->status = 1; + $e->message = '暂无升级包'; + $e->update_flag = 0; + $e->version = ''; + $e->file_path = ''; + $e->file_md5 = ''; + $e->size = 0; + $e->version_message = ''; + $e->package_type = 0; + + return $e; + } + + $domainURL = Yii::$app->params['file_upload_domain']; + $e->status = 0; + $e->message = '有升级包'; + $e->update_flag = $upgradeRecord->focuse; + $e->version = $upgradeRecord->version; + $e->file_path = $domainURL.$upgradeRecord->path; + $e->file_md5 = $upgradeRecord->file_md5; + $e->size = $upgradeRecord->size; + $e->package_type = $upgradeRecord->package_type; + $e->version_message = $upgradeRecord->desc; return $e; } /** - * + * 上报 OTA 升级事件 * @return stdClass */ public function actionReportUpgradeEvent() { - $req = Yii::$app->request; - $barcode = $req->post('barcode'); - $deviceId = $req->post('device_id'); - $currentVersion = $req->post('current_version'); - $targetVersion = $req->post('target_version'); - $status = $req->post('status'); - $errorCode = $req->post('error_code'); - $timestamp = $req->post('timestamp'); - $e = new stdClass(); - $e->status = 0; - $e->message = 'fail'; + $e->status = 1; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionReportUpgradeEvent:'. $getPostData); + if (!$getPostData) { + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']:''; + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']:''; + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']:''; + $targetVersion = isset($getPostData['target_version'])? $getPostData['target_version']:''; + $status = isset($getPostData['status'])? $getPostData['status']:''; + $errorCode = isset($getPostData['error_code'])? $getPostData['error_code']:''; + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']:''; + + if (empty($barcode) || empty($currentVersion) || empty($targetVersion) || empty($status) || empty($errorCode) || empty($timestamp)) { + $e->status = 2; + $e->message = '部分数据为空'; + return $e; + } + if (empty($deviceId)) { + $e->status = 3; + $e->message = '设备ID为空'; + return $e; + } + $deviceBatchInfo = Device::explodeBarcode($barcode); + if (empty($deviceBatchInfo)) { + $e->status = 4; + $e->message = 'barcode格式有误'; + return $e; + } + $upgradeLogModel = UpgradeLogRepository::findOne(['device_id' => $deviceId, 'current_version' => $currentVersion, 'target_version' => $targetVersion, 'status' => $status, 'type' => UpgradeStatus::TYPE_OTA]); + if ($upgradeLogModel) { + $upgradeLogModel->timestamp = $timestamp; + $upgradeLogModel->save(); + $e->status = 0; + $e->message = '已更新'; + + return $e; + } + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]); + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]); + $manufactureId = $projectId = $modelId = 0; + if ($ma) { + $manufactureId = $ma->id; + } + if ($pro) { + $projectId = $pro->id; + } + if ($model) { + $modelId = $model->id; + } + + $item = [ + "barcode" => $barcode, + "device_id" => $deviceId, + "manufacture_id" => $manufactureId, + "project_id" => $projectId, + "model_id" => $modelId, + "current_version" => $currentVersion, + "target_version" => $targetVersion, + "status" => $status, + "error_code" => $errorCode, + "timestamp" => $timestamp, + "type" => UpgradeStatus::TYPE_OTA + ]; + $saveR = UpgradeLog::create($item); + if ($saveR) { + $e->status = 0; + $e->message = 'ok'; + } else { + $e->status = 5; + $e->message = '报告记录失败'; + } return $e; } + /** + * APP 升级检测 + * @return stdClass + */ public function actionCheckAppVersion() { - $req = Yii::$app->request; - $barcode = $req->post('barcode'); - $deviceId = $req->post('device_id'); - $packageName = $req->post('package_name'); - $currentVersion = $req->post('current_version'); - $e = new stdClass(); - $e->status = 0; - $e->message = 'fail'; - $e->update_flag = 0; // 0 1 2 - $e->version = ''; - $e->file_path = ''; - $e->file_md5 = ''; - $e->size = 3627; - $e->version_message = 'ok'; + $e->status = 1; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionReportUpgradeEvent:'. $getPostData); + if (!$getPostData) { + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: ''; + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: ''; + $packageName = isset($getPostData['package_name'])? $getPostData['package_name']: ''; + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']: ''; + + if (empty($barcode) || empty($packageName) || empty($currentVersion)) { + $e->status = 2; + $e->message = '部分数据为空'; + return $e; + } + + $deviceBatchInfo = Device::explodeBarcode($barcode); + if (empty($deviceBatchInfo)) { + $e->status = 3; + $e->message = 'barcode格式有误'; + return $e; + } + + $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId]); + if (empty($deviceModel)) { + $e->status = 4; + $e->message = '无该设备记录'; + return $e; + } + + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); + $manufactureId = 0; + if ($ma) { + $manufactureId = $ma->id; + } + + $upgradeModel = UpgradeModel::find(); + $upgradeModel->where([ + 'manufacture_id' => $manufactureId, + 'status' => UpgradeStatus::STATUS_ON, + 'package_name' => $packageName, + 'is_delete' => 0, + 'type' => UpgradeStatus::TYPE_APP + ]); + $upgradeModel->andWhere(['>', 'version', $currentVersion]); + $upgradeModel->orderBy('created_at desc'); + $upgradeRecord = $upgradeModel->one(); + + if (!$upgradeRecord) { + $e->status = 1; + $e->message = '暂无升级包'; + $e->update_flag = 0; + $e->version = ''; + $e->file_path = ''; + $e->file_md5 = ''; + $e->size = 0; + $e->version_message = ''; + } else { + $domainURL = Yii::$app->params['file_upload_domain']; + $e->status = 0; + $e->message = '有升级包'; + $e->update_flag = $upgradeRecord->focuse; + $e->version = $upgradeRecord->version; + $e->file_path = $domainURL.$upgradeRecord->path; + $e->file_md5 = $upgradeRecord->file_md5; + $e->size = $upgradeRecord->size; + $e->version_message = $upgradeRecord->desc; + } return $e; } /** + * APP 升级报告 * @return stdClass */ public function actionReportAppUpgradeEvent() { - $req = Yii::$app->request; - $barcode = $req->post('barcode'); - $deviceId = $req->post('device_id'); - $currentVersion = $req->post('current_version'); - $targetVersion = $req->post('target_version'); - $status = $req->post('status'); - $errorCode = $req->post('error_code'); - $timestamp = $req->post('timestamp'); - $e = new stdClass(); - $e->status = 0; - $e->message = 'fail'; + $e->status = 1; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionReportUpgradeEvent:'. $getPostData); + if (!$getPostData) { + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: ''; + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: ''; + $currentVersion = isset($getPostData['current_version'])? $getPostData['current_version']: ''; + $targetVersion = isset($getPostData['target_version'])? $getPostData['target_version']: ''; + $status = isset($getPostData['status'])? $getPostData['status']: ''; + $errorCode = isset($getPostData['error_code'])? $getPostData['error_code']: ''; + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']: ''; + + if (empty($barcode) || empty($currentVersion) || empty($targetVersion) || empty($status) || empty($errorCode) || empty($timestamp)) { + $e->status = 2; + $e->message = '部分数据为空'; + return $e; + } + + if (empty($deviceId)) { + $e->status = 3; + $e->message = '设备ID为空'; + return $e; + } + $deviceBatchInfo = Device::explodeBarcode($barcode); + if (empty($deviceBatchInfo)) { + $e->status = 4; + $e->message = 'barcode格式有误'; + return $e; + } + $upgradeLogModel = UpgradeLogRepository::findOne(['device_id' => $deviceId, 'current_version' => $currentVersion, 'target_version' => $targetVersion, 'status' => $status, 'type' => UpgradeStatus::TYPE_APP]); + if ($upgradeLogModel) { + $upgradeLogModel->timestamp = $timestamp; + $upgradeLogModel->save(); + $e->status = 0; + $e->message = '已更新'; + + return $e; + } + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]); + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]); + $manufactureId = $projectId = $modelId = 0; + if ($ma) { + $manufactureId = $ma->id; + } + if ($pro) { + $projectId = $pro->id; + } + if ($model) { + $modelId = $model->id; + } + + $item = [ + "barcode" => $barcode, + "device_id" => $deviceId, + "manufacture_id" => $manufactureId, + "project_id" => $projectId, + "model_id" => $modelId, + "current_version" => $currentVersion, + "target_version" => $targetVersion, + "status" => $status, + "error_code" => $errorCode, + "timestamp" => $timestamp, + "type" => UpgradeStatus::TYPE_APP + ]; + $saveR = UpgradeLog::create($item); + if ($saveR) { + $e->status = 0; + $e->message = 'ok'; + } else { + $e->status = 5; + $e->message = '记录失败'; + } return $e; } /** + * 机器状态统计 * @return stdClass */ public function actionReportDeviceVersion() { - $req = Yii::$app->request; - $barcode = $req->post('barcode'); - $deviceId = $req->post('device_id'); - $softwareVersion = $req->post('software_version'); - $hardwareVersion = $req->post('hardware_version'); - $timestamp = $req->post('timestamp'); - $e = new stdClass(); + $e->status = 1; + $getPostData = file_get_contents('php://input', 'r'); + self::myLog('actionReportDeviceVersion:'. $getPostData); + if (!$getPostData) { + $e->message = '数据为空'; + return $e; + } + $getPostData = json_decode($getPostData, true); + $barcode = isset($getPostData['barcode'])? $getPostData['barcode']: ''; + $deviceId = isset($getPostData['device_id'])? $getPostData['device_id']: ''; + $softwareVersion = isset($getPostData['software_version'])? $getPostData['software_version']: ''; + $hardwareVersion = isset($getPostData['hardware_version'])? $getPostData['hardware_version']: ''; + $timestamp = isset($getPostData['timestamp'])? $getPostData['timestamp']: ''; + + if (empty($barcode) || empty($softwareVersion) || empty($hardwareVersion) || empty($timestamp)) { + $e->status = 2; + $e->message = '部分数据为空'; + return $e; + } + + if (empty($deviceId)) { + $e->status = 3; + $e->message = '设备ID为空'; + return $e; + } + + $ipAddress = Utils::clientIp(); + $deviceStatsModel = DeviceStatsRepository::findOne(['device_id' => $deviceId]); + if ($deviceStatsModel) { + $deviceStatsModel->timestamp = $timestamp; + $deviceStatsModel->ip = $ipAddress; + $deviceStatsModel->save(); + $e->status = 0; + $e->message = 'ok'; + return $e; + } + + $deviceBatchInfo = Device::explodeBarcode($barcode); + if (empty($deviceBatchInfo)) { + $e->status = 4; + $e->message = 'barcode格式有误'; + return $e; + } + + $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); + $pro = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]); + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]); + $prod = ProductionRepository::findOne(['production_no' => $deviceBatchInfo[3]]); + $manufactureId = $projectId = $modelId = $productionId = 0; + if ($ma) { + $manufactureId = $ma->id; + } + if ($pro) { + $projectId = $pro->id; + } + if ($model) { + $modelId = $model->id; + } + if ($prod) { + $productionId = $prod->id; + } + + $cityResult = Utils::getAddressByIPAddress($ipAddress); + $city = ''; + if ($cityResult && isset($cityResult['city']) && !empty($cityResult['city'])) { + $city = $cityResult['city']; + } + + $item = [ + 'device_id' => $deviceId, + 'barcode' => $barcode, + 'software_version' => $softwareVersion, + 'hardware_version' => $hardwareVersion, + 'timestamp' => $timestamp, + 'manufacture_id' => $manufactureId, + 'project_id' => $projectId, + 'model_id' => $modelId, + 'production_id' => $productionId, + 'ip' => $ipAddress, + 'city' => $city + ]; + + DeviceStats::create($item); + $e->status = 0; - $e->message = 'fail'; + $e->message = 'ok'; return $e; } diff --git a/app-api/helpers/Aes.php b/app-api/helpers/Aes.php new file mode 100644 index 0000000..557aeb8 --- /dev/null +++ b/app-api/helpers/Aes.php @@ -0,0 +1,73 @@ +secret_key = isset($key) ? $key : 'king_board_key_01'; + + $this->method = $method; + + $this->iv = $iv; + + $this->options = $options; + } + + /** + * 加密方法,对数据进行加密,返回加密后的数据 + * + * @param string $data 要加密的数据 + * + * @return string + * + */ + public function encrypt($data) + { + return openssl_encrypt($data, $this->method, $this->secret_key, $this->options, $this->iv); + } + + /** + * 解密方法,对数据进行解密,返回解密后的数据 + * + * @param string $data 要解密的数据 + * + * @return string + * + */ + public function decrypt($data) + { + return openssl_decrypt($data, $this->method, $this->secret_key, $this->options, $this->iv); + } +} \ No newline at end of file diff --git a/app-ht/modules/datas/controllers/DeviceStatsController.php b/app-ht/modules/datas/controllers/DeviceStatsController.php new file mode 100644 index 0000000..68e056f --- /dev/null +++ b/app-ht/modules/datas/controllers/DeviceStatsController.php @@ -0,0 +1,119 @@ +dataList(1); + /** + * 渲染模板 + */ + return $this->render('index', $params); + } + + /** + * 查询数据列表 + */ + protected function dataList($type = '') + { + $request = Yii::$app->request; + $createTime = $request->get('createTime'); + $endTime = $request->get('endTime'); + $software_version = $request->get('software_version'); + $hardware_version = $request->get('hardware_version'); + $manufacture_name = $request->get('manufacture_name'); + $model_name = $request->get('model_name'); + $device_id = $request->get('device_id'); + $barcode = $request->get('barcode'); + $city = $request->get('city'); + + $gets = [ + 'createTime' => $createTime, + 'endTime' => $endTime, + 'software_version' => $software_version, + 'hardware_version' => $hardware_version, + 'manufacture_name' => $manufacture_name, + 'device_id' => $device_id, + 'barcode' => $barcode, + 'model_name' => $model_name, + 'city' => $city, + ]; + + $where = ['and']; + if ($createTime) { + $createTime = strtotime($createTime); + $where[] = ['>=', 'ds.created_at', $createTime]; + } + if ($endTime) { + $endTime = strtotime($endTime) + 86400; + $where[] = ['<=', 'ds.created_at', $endTime]; + } + + if ($software_version) { + $where[] = ['like', 'ds.software_version', $software_version]; + } + if ($hardware_version) { + $where[] = ['like', 'ds.hardware_version', $hardware_version]; + } + if ($manufacture_name) { + $where[] = ['like', 'mf.name', $manufacture_name]; + } + if ($model_name) { + $where[] = ['like', 'md.name', $model_name]; + } + if ($device_id) { + $where[] = ['like', 'ds.device_id', $device_id]; + } + if ($barcode) { + $where[] = ['like', 'ds.barcode', $barcode]; + } + if ($city) { + $where[] = ['like', 'ds.city', $city]; + } + + if ($type == 0) { + $pageList = DeviceStatsRepository::getPageList($where, 0 , 0); + $pages = null; + } else { + $pageSize = 20; + $pages = new Pagination(['totalCount' => DeviceStatsRepository::getPageCount($where), 'pageSize' => $pageSize]); + $pageList = DeviceStatsRepository::getPageList($where, $pages->offset, $pages->limit); + } + + /** + * 数据整理 + */ + return [ + 'listdata' => $pageList, + 'pages' => $pages, + 'gets' => $gets + ]; + } + + /** + * 导出设备状态数据 + * @return string + */ + public function actionExport() + { + $params = $this->dataList(0); + return $this->renderPartial('export', $params); + } +} \ No newline at end of file diff --git a/app-ht/modules/datas/views/device-stats/export.php b/app-ht/modules/datas/views/device-stats/export.php new file mode 100644 index 0000000..b573e28 --- /dev/null +++ b/app-ht/modules/datas/views/device-stats/export.php @@ -0,0 +1,66 @@ + + + + + + + + + +
+ + + + + + + + + + + + + + + + $item) : ?> + + + + + + + + + + + + + + +
设备IDBarcode硬件版本软件版本厂商设备型号所在城市IP地址时间
+
+ + \ No newline at end of file diff --git a/app-ht/modules/datas/views/device-stats/index.php b/app-ht/modules/datas/views/device-stats/index.php new file mode 100644 index 0000000..e9b6ad2 --- /dev/null +++ b/app-ht/modules/datas/views/device-stats/index.php @@ -0,0 +1,160 @@ +params['breadcrumbs'][] = '机器状态统计'; +?> + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
barcode + + 设备ID + + 厂商 + + 机器型号 + +
软件版本 + + 硬件版本 + + + 所在城市 + + 时间 +
+ - + +
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
设备IDBarcode硬件版本软件版本厂商设备型号所在城市IP地址时间
+
暂无记录
+
+
+ + +
+ \ No newline at end of file diff --git a/app-ht/modules/device/config/perm.php b/app-ht/modules/device/config/perm.php index 14e95ef..504f1c6 100644 --- a/app-ht/modules/device/config/perm.php +++ b/app-ht/modules/device/config/perm.php @@ -9,7 +9,7 @@ return [ 65 => '序列号列表', ], - 'path' => 'serialnumber/serialnumber/*' + 'path' => 'device/device/*' ], ] diff --git a/app-ht/modules/device/controllers/DeviceController.php b/app-ht/modules/device/controllers/DeviceController.php index 927378d..4fe000f 100644 --- a/app-ht/modules/device/controllers/DeviceController.php +++ b/app-ht/modules/device/controllers/DeviceController.php @@ -3,6 +3,7 @@ namespace app\ht\modules\device\controllers; +use domain\device\DeviceAuthFailRepository; use Yii; use yii\base\Exception; use yii\data\Pagination; @@ -103,7 +104,8 @@ class DeviceController extends BaseController } /** - * + * @return string + * @throws \yii\db\Exception */ public function actionDoCreateDevice() { @@ -203,6 +205,69 @@ class DeviceController extends BaseController } + public function actionAuthFailIndex() + { + $request = Yii::$app->request; + $serialNo = $request->get('serial_no'); + $mac = $request->get('mac'); + $project = $request->get('project'); + $model = $request->get('model'); + $production = $request->get('production'); + $manufacture = $request->get('manufacture'); + $deviceId = $request->get('device_id'); + $status = $request->get('status'); + $page = $request->get('page'); + $where = [ + 'and', + ['=','a.is_delete', 0] + ]; + if (!empty($serialNo)) { + $where[] = ['like', 'a.serial_no', $serialNo]; + } + if (!empty($project)) { + $where[] = ['like', 'p.name', $project]; + } + if (!empty($model)) { + $where[] = ['like', 'mo.name', $model]; + } + if (!empty($production)) { + $where[] = ['like', 'pd.name', $production]; + } + if (!empty($mac)) { + $where[] = ['like', 'a.mac', $mac]; + } + if (!empty($manufacture)) { + $where[] = ['like', 'm.name', $manufacture]; + } + if (!empty($deviceId)) { + $where[] = ['like', 'a.device_id', $deviceId]; + } + if (isset($_GET['status']) && -1 != $status) { + $where[] = ['=', 'a.status', $status]; + } + + if (0 >= $page) { + $page = 1; + } + $pageSize = 20; + $page = ($page -1) * $pageSize; + // DeviceRepository::getList($where, $pageSize, $page); + $deviceData = DeviceAuthFailRepository::getList($where, $pageSize, $page); + $pages = new Pagination(['totalCount' => DeviceAuthFailRepository::getListCount($where), 'pageSize' => $pageSize]); + + $params['deviceList'] = $deviceData; + $params['pages'] = $pages; + $params["gets"] = [ + 'project' => $project, + 'model' => $model, + 'device_id' => $deviceId, + 'production' => $production, + 'manufacture' => $manufacture, + ]; + + return $this->render('auth-fail-index', $params); + } + /** * @return string */ diff --git a/app-ht/modules/device/views/device/auth-fail-index.php b/app-ht/modules/device/views/device/auth-fail-index.php new file mode 100644 index 0000000..23fbd32 --- /dev/null +++ b/app-ht/modules/device/views/device/auth-fail-index.php @@ -0,0 +1,163 @@ +title = '授权失败管理'; +$this->params['breadcrumbs'][] = '失败序列号管理'; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + +
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID厂商项目设备型号生产日期设备ID申请时间操作
+ + + + + + + + + + + + + + +  |  + +
+
暂无记录
+
+
+ + +
+ + \ No newline at end of file diff --git a/app-ht/modules/device/views/device/index.php b/app-ht/modules/device/views/device/index.php index 7764ea6..b825dbf 100644 --- a/app-ht/modules/device/views/device/index.php +++ b/app-ht/modules/device/views/device/index.php @@ -127,10 +127,10 @@ $this->params['breadcrumbs'][] = $this->title; -
+
- +
@@ -142,7 +142,7 @@ $this->params['breadcrumbs'][] = $this->title; -  |  +  |   |  @@ -198,5 +198,44 @@ $this->params['breadcrumbs'][] = $this->title; window.location.reload(); }, 'json') }) + $('.btn_edit').click(function(e) { + var action = $(this).attr('data-action') + var id = $(this).attr('aid'); + var editMac = $('.edit_mac_'+id); + var editDevice = $('.edit_device_'+id); + + if ('edit' == action ) { + var editMacs = $('.edit_mac'); + $.each(editMacs, function(i,n){ + $(n).html($(n).attr('data')); + }) + var editDevices = $('.edit_device'); + $.each(editDevices, function(i,n){ + $(n).html($(n).attr('data')); + }) + var btnEdits = $('.btn_edit'); + $.each(btnEdits, function(i,n){ + $(n).html('编辑').attr('data-action','edit'); + }) + $(this).html('保存').attr('data-action','save'); + + var editMacVal = editMac.attr('data'); + var editDeviceVal = editDevice.attr('data'); + editMac.html(''); + editDevice.html(''); + } else { + var newMAc = editMac.find('.mac_edit').val(); + var newDevice = editDevice.find('.device_edit').val(); + // 请求之后保存 + //$.post() + editMac.html(newMAc).attr('data', newMAc); + editDevice.html(newDevice).attr('data', newDevice); + $(this).html('编辑').attr('data-action','edit'); + } + + + }) + + }); \ No newline at end of file diff --git a/app-ht/modules/upgrade/controllers/UpgradeController.php b/app-ht/modules/upgrade/controllers/UpgradeController.php index 94e9ef0..9a973a4 100644 --- a/app-ht/modules/upgrade/controllers/UpgradeController.php +++ b/app-ht/modules/upgrade/controllers/UpgradeController.php @@ -369,7 +369,8 @@ class UpgradeController extends BaseController * 值:4; 没有文件被上传。 * date:2018.4.18 from:zhix.net */ - public function actionUploadFile(){ + public function actionUploadFile() + { header("Expires: Mon, 26 Jul 2020 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Content-type: text/html; charset=utf-8"); @@ -502,12 +503,12 @@ class UpgradeController extends BaseController } fclose($out); $response = [ - 'success'=>true, - 'oldName'=>$oldName, - 'filePath'=>$savePath, - 'fileSize'=>filesize($uploadPath), - 'fileSuffixes'=>$pathInfo['extension'], //文件后缀名 - 'file_md5'=>md5_file($uploadPath), + 'success' => true, + 'oldName' => $oldName, + 'filePath' => $savePath, + 'fileSize' => filesize($uploadPath), + 'fileSuffixes' => $pathInfo['extension'], //文件后缀名 + 'file_md5' => md5_file($uploadPath), ]; /** * 后台操作日志 diff --git a/app-ht/views/layouts/routes.php b/app-ht/views/layouts/routes.php index 06fb75c..dd83e92 100644 --- a/app-ht/views/layouts/routes.php +++ b/app-ht/views/layouts/routes.php @@ -56,7 +56,9 @@ if (isset($user->is_manufacture) && $user->is_manufacture == 1) { 'path' => '/device', 'redirect' => '/device/device/index' ], + ['label' => '序列号管理', 'path' => '/device/device/index'], + ['label' => '授权失败管理', 'path' => '/device/device/auth-fail-index'], ['label' => '创建序列号', 'path' => '/device/device/create-device'], ] ], @@ -110,12 +112,12 @@ if (isset($user->is_manufacture) && $user->is_manufacture == 1) { 'routes' => [ [ 'path' => '/datas', - 'redirect' => '/datas/datas/index' + 'redirect' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_OTA ], - ['label' => '序列号统计', 'path' => '/datas/datas/index'], + /*['label' => '序列号统计', 'path' => '/datas/datas/index'], */ ['label' => 'OTA升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_OTA], ['label' => 'APP升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_APP], - ['label' => '机器状态统计', 'path' => '/datas/datas-setting/default'], + ['label' => '机器状态统计', 'path' => '/datas/device-stats/index'], ] ], [ diff --git a/app-ht/web/exts-src/baidumap/MarkerClusterer.js b/app-ht/web/exts-src/baidumap/MarkerClusterer.js deleted file mode 100644 index c583c70..0000000 --- a/app-ht/web/exts-src/baidumap/MarkerClusterer.js +++ /dev/null @@ -1,636 +0,0 @@ -/** - * @fileoverview MarkerClusterer标记聚合器用来解决加载大量点要素到地图上产生覆盖现象的问题,并提高性能。 - * 主入口类是MarkerClusterer, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ - - -/** - * @namespace BMap的所有library类均放在BMapLib命名空间下 - */ -var BMapLib = window.BMapLib = BMapLib || {}; -(function(){ - - /** - * 获取一个扩展的视图范围,把上下左右都扩大一样的像素值。 - * @param {Map} map BMap.Map的实例化对象 - * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象 - * @param {Number} gridSize 要扩大的像素值 - * - * @return {BMap.Bounds} 返回扩大后的视图范围。 - */ - var getExtendedBounds = function(map, bounds, gridSize){ - bounds = cutBoundsInRange(bounds); - var pixelNE = map.pointToPixel(bounds.getNorthEast()); - var pixelSW = map.pointToPixel(bounds.getSouthWest()); - pixelNE.x += gridSize; - pixelNE.y -= gridSize; - pixelSW.x -= gridSize; - pixelSW.y += gridSize; - var newNE = map.pixelToPoint(pixelNE); - var newSW = map.pixelToPoint(pixelSW); - return new BMap.Bounds(newSW, newNE); - }; - - /** - * 按照百度地图支持的世界范围对bounds进行边界处理 - * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象 - * - * @return {BMap.Bounds} 返回不越界的视图范围 - */ - var cutBoundsInRange = function (bounds) { - var maxX = getRange(bounds.getNorthEast().lng, -180, 180); - var minX = getRange(bounds.getSouthWest().lng, -180, 180); - var maxY = getRange(bounds.getNorthEast().lat, -74, 74); - var minY = getRange(bounds.getSouthWest().lat, -74, 74); - return new BMap.Bounds(new BMap.Point(minX, minY), new BMap.Point(maxX, maxY)); - }; - - /** - * 对单个值进行边界处理。 - * @param {Number} i 要处理的数值 - * @param {Number} min 下边界值 - * @param {Number} max 上边界值 - * - * @return {Number} 返回不越界的数值 - */ - var getRange = function (i, mix, max) { - mix && (i = Math.max(i, mix)); - max && (i = Math.min(i, max)); - return i; - }; - - /** - * 判断给定的对象是否为数组 - * @param {Object} source 要测试的对象 - * - * @return {Boolean} 如果是数组返回true,否则返回false - */ - var isArray = function (source) { - return '[object Array]' === Object.prototype.toString.call(source); - }; - - /** - * 返回item在source中的索引位置 - * @param {Object} item 要测试的对象 - * @param {Array} source 数组 - * - * @return {Number} 如果在数组内,返回索引,否则返回-1 - */ - var indexOf = function(item, source){ - var index = -1; - if(isArray(source)){ - if (source.indexOf) { - index = source.indexOf(item); - } else { - for (var i = 0, m; m = source[i]; i++) { - if (m === item) { - index = i; - break; - } - } - } - } - return index; - }; - - /** - *@exports MarkerClusterer as BMapLib.MarkerClusterer - */ - var MarkerClusterer = - /** - * MarkerClusterer - * @class 用来解决加载大量点要素到地图上产生覆盖现象的问题,并提高性能 - * @constructor - * @param {Map} map 地图的一个实例。 - * @param {Json Object} options 可选参数,可选项包括:
- * markers {Array} 要聚合的标记数组
- * girdSize {Number} 聚合计算时网格的像素大小,默认60
- * maxZoom {Number} 最大的聚合级别,大于该级别就不进行相应的聚合
- * minClusterSize {Number} 最小的聚合数量,小于该数量的不能成为一个聚合,默认为2
- * isAverangeCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值,默认为否,落脚在聚合内的第一个点
- * styles {Array} 自定义聚合后的图标风格,请参考TextIconOverlay类
- */ - BMapLib.MarkerClusterer = function(map, options){ - if (!map){ - return; - } - this._map = map; - this._markers = []; - this._clusters = []; - - var opts = options || {}; - this._gridSize = opts["gridSize"] || 60; - this._maxZoom = opts["maxZoom"] || 18; - this._minClusterSize = opts["minClusterSize"] || 2; - this._isAverageCenter = false; - if (opts['isAverageCenter'] != undefined) { - this._isAverageCenter = opts['isAverageCenter']; - } - this._styles = opts["styles"] || []; - - var that = this; - this._map.addEventListener("zoomend",function(){ - that._redraw(); - }); - - this._map.addEventListener("moveend",function(){ - that._redraw(); - }); - - var mkrs = opts["markers"]; - isArray(mkrs) && this.addMarkers(mkrs); - }; - - /** - * 添加要聚合的标记数组。 - * @param {Array} markers 要聚合的标记数组 - * - * @return 无返回值。 - */ - MarkerClusterer.prototype.addMarkers = function(markers){ - for(var i = 0, len = markers.length; i } markers 需要被删除的marker数组 - * - * @return {Boolean} 删除成功返回true,否则返回false - */ - MarkerClusterer.prototype.removeMarkers = function(markers) { - var success = false; - for (var i = 0; i < markers.length; i++) { - var r = this._removeMarker(markers[i]); - success = success || r; - } - - if (success) { - this._clearLastClusters(); - this._createClusters(); - } - return success; - }; - - /** - * 从地图上彻底清除所有的标记 - * @return 无返回值 - */ - MarkerClusterer.prototype.clearMarkers = function() { - this._clearLastClusters(); - this._removeMarkersFromMap(); - this._markers = []; - }; - - /** - * 重新生成,比如改变了属性等 - * @return 无返回值 - */ - MarkerClusterer.prototype._redraw = function () { - this._clearLastClusters(); - this._createClusters(); - }; - - /** - * 获取网格大小 - * @return {Number} 网格大小 - */ - MarkerClusterer.prototype.getGridSize = function() { - return this._gridSize; - }; - - /** - * 设置网格大小 - * @param {Number} size 网格大小 - * @return 无返回值 - */ - MarkerClusterer.prototype.setGridSize = function(size) { - this._gridSize = size; - this._redraw(); - }; - - /** - * 获取聚合的最大缩放级别。 - * @return {Number} 聚合的最大缩放级别。 - */ - MarkerClusterer.prototype.getMaxZoom = function() { - return this._maxZoom; - }; - - /** - * 设置聚合的最大缩放级别 - * @param {Number} maxZoom 聚合的最大缩放级别 - * @return 无返回值 - */ - MarkerClusterer.prototype.setMaxZoom = function(maxZoom) { - this._maxZoom = maxZoom; - this._redraw(); - }; - - /** - * 获取聚合的样式风格集合 - * @return {Array} 聚合的样式风格集合 - */ - MarkerClusterer.prototype.getStyles = function() { - return this._styles; - }; - - /** - * 设置聚合的样式风格集合 - * @param {Array} styles 样式风格数组 - * @return 无返回值 - */ - MarkerClusterer.prototype.setStyles = function(styles) { - this._styles = styles; - this._redraw(); - }; - - /** - * 获取单个聚合的最小数量。 - * @return {Number} 单个聚合的最小数量。 - */ - MarkerClusterer.prototype.getMinClusterSize = function() { - return this._minClusterSize; - }; - - /** - * 设置单个聚合的最小数量。 - * @param {Number} size 单个聚合的最小数量。 - * @return 无返回值。 - */ - MarkerClusterer.prototype.setMinClusterSize = function(size) { - this._minClusterSize = size; - this._redraw(); - }; - - /** - * 获取单个聚合的落脚点是否是聚合内所有标记的平均中心。 - * @return {Boolean} true或false。 - */ - MarkerClusterer.prototype.isAverageCenter = function() { - return this._isAverageCenter; - }; - - /** - * 获取聚合的Map实例。 - * @return {Map} Map的示例。 - */ - MarkerClusterer.prototype.getMap = function() { - return this._map; - }; - - /** - * 获取所有的标记数组。 - * @return {Array} 标记数组。 - */ - MarkerClusterer.prototype.getMarkers = function() { - return this._markers; - }; - - /** - * 获取聚合的总数量。 - * @return {Number} 聚合的总数量。 - */ - MarkerClusterer.prototype.getClustersCount = function() { - var count = 0; - for(var i = 0, cluster; cluster = this._clusters[i]; i++){ - cluster.isReal() && count++; - } - return count; - }; - - /** - * @ignore - * Cluster - * @class 表示一个聚合对象,该聚合,包含有N个标记,这N个标记组成的范围,并有予以显示在Map上的TextIconOverlay等。 - * @constructor - * @param {MarkerClusterer} markerClusterer 一个标记聚合器示例。 - */ - function Cluster(markerClusterer){ - this._markerClusterer = markerClusterer; - this._map = markerClusterer.getMap(); - this._minClusterSize = markerClusterer.getMinClusterSize(); - this._isAverageCenter = markerClusterer.isAverageCenter(); - this._center = null;//落脚位置 - this._markers = [];//这个Cluster中所包含的markers - this._gridBounds = null;//以中心点为准,向四边扩大gridSize个像素的范围,也即网格范围 - this._isReal = false; //真的是个聚合 - - this._clusterMarker = new BMapLib.TextIconOverlay(this._center, this._markers.length, {"styles":this._markerClusterer.getStyles()}); - //this._map.addOverlay(this._clusterMarker); - } - - /** - * 向该聚合添加一个标记。 - * @param {Marker} marker 要添加的标记。 - * @return 无返回值。 - */ - Cluster.prototype.addMarker = function(marker){ - if(this.isMarkerInCluster(marker)){ - return false; - }//也可用marker.isInCluster判断,外面判断OK,这里基本不会命中 - - if (!this._center){ - this._center = marker.getPosition(); - this.updateGridBounds();// - } else { - if(this._isAverageCenter){ - var l = this._markers.length + 1; - var lat = (this._center.lat * (l - 1) + marker.getPosition().lat) / l; - var lng = (this._center.lng * (l - 1) + marker.getPosition().lng) / l; - this._center = new BMap.Point(lng, lat); - this.updateGridBounds(); - }//计算新的Center - } - - marker.isInCluster = true; - this._markers.push(marker); - /* - var len = this._markers.length; - if(len < this._minClusterSize ){ - this._map.addOverlay(marker); - //this.updateClusterMarker(); - return true; - } else if (len === this._minClusterSize) { - for (var i = 0; i < len; i++) { - this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]); - } - - } - this._map.addOverlay(this._clusterMarker); - this._isReal = true; - this.updateClusterMarker(); - return true; */ - }; - Cluster.prototype.render = function(){ - var len = this._markers.length; - - if (len < this._minClusterSize) { - for (var i = 0; i < len; i++) { - this._map.addOverlay(this._markers[i]); - } - } else { - this._map.addOverlay(this._clusterMarker); - this._isReal = true; - this.updateClusterMarker(); - } - } - /** - * 判断一个标记是否在该聚合中。 - * @param {Marker} marker 要判断的标记。 - * @return {Boolean} true或false。 - */ - Cluster.prototype.isMarkerInCluster= function(marker){ - if (this._markers.indexOf) { - return this._markers.indexOf(marker) != -1; - } else { - for (var i = 0, m; m = this._markers[i]; i++) { - if (m === marker) { - return true; - } - } - } - return false; - }; - - /** - * 判断一个标记是否在该聚合网格范围中。 - * @param {Marker} marker 要判断的标记。 - * @return {Boolean} true或false。 - */ - Cluster.prototype.isMarkerInClusterBounds = function(marker) { - return this._gridBounds.containsPoint(marker.getPosition()); - }; - - Cluster.prototype.isReal = function(marker) { - return this._isReal; - }; - - /** - * 更新该聚合的网格范围。 - * @return 无返回值。 - */ - Cluster.prototype.updateGridBounds = function() { - var bounds = new BMap.Bounds(this._center, this._center); - this._gridBounds = getExtendedBounds(this._map, bounds, this._markerClusterer.getGridSize()); - }; - - /** - * 更新该聚合的显示样式,也即TextIconOverlay。 - * @return 无返回值。 - */ - Cluster.prototype.updateClusterMarker = function () { - if (this._map.getZoom() > this._markerClusterer.getMaxZoom()) { - this._clusterMarker && this._map.removeOverlay(this._clusterMarker); - for (var i = 0, marker; marker = this._markers[i]; i++) { - this._map.addOverlay(marker); - } - return; - } - - if (this._markers.length < this._minClusterSize) { - this._clusterMarker.hide(); - return; - } - - this._clusterMarker.setPosition(this._center); - - this._clusterMarker.setText(this._markers.length); - - var thatMap = this._map; - var thatBounds = this.getBounds(); - this._clusterMarker.addEventListener("click", function(event){ - thatMap.setViewport(thatBounds); - }); - - }; - - /** - * 删除该聚合。 - * @return 无返回值。 - */ - Cluster.prototype.remove = function(){ - for (var i = 0, m; m = this._markers[i]; i++) { - this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]); - }//清除散的标记点 - this._map.removeOverlay(this._clusterMarker); - this._markers.length = 0; - delete this._markers; - } - - /** - * 获取该聚合所包含的所有标记的最小外接矩形的范围。 - * @return {BMap.Bounds} 计算出的范围。 - */ - Cluster.prototype.getBounds = function() { - var bounds = new BMap.Bounds(this._center,this._center); - for (var i = 0, marker; marker = this._markers[i]; i++) { - bounds.extend(marker.getPosition()); - } - return bounds; - }; - - /** - * 获取该聚合的落脚点。 - * @return {BMap.Point} 该聚合的落脚点。 - */ - Cluster.prototype.getCenter = function() { - return this._center; - }; - -})(); \ No newline at end of file diff --git a/app-ht/web/exts-src/baidumap/TextIconOverlay.js b/app-ht/web/exts-src/baidumap/TextIconOverlay.js deleted file mode 100644 index e121a11..0000000 --- a/app-ht/web/exts-src/baidumap/TextIconOverlay.js +++ /dev/null @@ -1,1046 +0,0 @@ -/** - * @fileoverview 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。 - * 主入口类是TextIconOverlay, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ - - -/** - * @namespace BMap的所有library类均放在BMapLib命名空间下 - */ -var BMapLib = window.BMapLib = BMapLib || {}; - -(function () { - - /** - * 声明baidu包 - */ - var T, - baidu = T = baidu || {version: "1.3.8"}; - - (function (){ - //提出guid,防止在与老版本Tangram混用时 - //在下一行错误的修改window[undefined] - baidu.guid = "$BAIDU$"; - - //Tangram可能被放在闭包中 - //一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = window[baidu.guid] || {}; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @shortcut g,T.G - * @meta standard - * @see baidu.dom.q - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - // 声明快捷方法 - baidu.g = baidu.G = baidu.dom.g; - - /** - * 获取目标元素所属的document对象 - * @name baidu.dom.getDocument - * @function - * @grammar baidu.dom.getDocument(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * @see baidu.dom.getWindow - * - * @returns {HTMLDocument} 目标元素所属的document对象 - */ - baidu.dom.getDocument = function (element) { - element = baidu.dom.g(element); - return element.nodeType == 9 ? element : element.ownerDocument || element.document; - }; - - /** - * @ignore - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - */ - baidu.lang = baidu.lang || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - // 声明快捷方法 - baidu.isString = baidu.lang.isString; - - /** - * 从文档中获取指定的DOM元素 - * **内部方法** - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - // 声明快捷方法 - baidu._g = baidu.dom._g; - - /** - * @ignore - * @namespace baidu.browser 判断浏览器类型和特性的属性。 - */ - baidu.browser = baidu.browser || {}; - - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241']; - } - - /** - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE) - * - * @author berg - * @name baidu.dom.getComputedStyle - * @function - * @grammar baidu.dom.getComputedStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * - * @see baidu.dom.getStyle - * - * @returns {string} 目标元素的computed style值 - */ - - baidu.dom.getComputedStyle = function(element, key){ - element = baidu.dom._g(element); - var doc = baidu.dom.getDocument(element), - styles; - if (doc.defaultView && doc.defaultView.getComputedStyle) { - styles = doc.defaultView.getComputedStyle(element, null); - if (styles) { - return styles[key] || styles.getPropertyValue(key); - } - } - return ''; - }; - - /** - * 提供给setStyle与getStyle使用 - */ - baidu.dom._styleFixer = baidu.dom._styleFixer || {}; - - /** - * 提供给setStyle与getStyle使用 - */ - baidu.dom._styleFilter = baidu.dom._styleFilter || []; - - /** - * 为获取和设置样式的过滤器 - * @private - * @meta standard - */ - baidu.dom._styleFilter.filter = function (key, value, method) { - for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) { - if (filter = filter[method]) { - value = filter(key, value); - } - } - return value; - }; - - /** - * @ignore - * @namespace baidu.string 操作字符串的方法。 - */ - baidu.string = baidu.string || {}; - - /** - * 将目标字符串进行驼峰化处理 - * @name baidu.string.toCamelCase - * @function - * @grammar baidu.string.toCamelCase(source) - * @param {string} source 目标字符串 - * @remark - * 支持单词以“-_”分隔 - * @meta standard - * - * @returns {string} 驼峰化处理后的字符串 - */ - baidu.string.toCamelCase = function (source) { - //提前判断,提高getStyle等的效率 thanks xianwei - if (source.indexOf('-') < 0 && source.indexOf('_') < 0) { - return source; - } - return source.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }; - - /** - * 获取目标元素的样式值 - * @name baidu.dom.getStyle - * @function - * @grammar baidu.dom.getStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * @remark - * - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。
- * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。
- * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。 - * @shortcut getStyle - * @meta standard - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle - * - * @returns {string} 目标元素的样式值 - */ - baidu.dom.getStyle = function (element, key) { - var dom = baidu.dom; - - element = dom.g(element); - key = baidu.string.toCamelCase(key); - //computed style, then cascaded style, then explicitly set style. - var value = element.style[key] || - (element.currentStyle ? element.currentStyle[key] : "") || - dom.getComputedStyle(element, key); - - // 在取不到值的时候,用fixer进行修正 - if (!value) { - var fixer = dom._styleFixer[key]; - if(fixer){ - value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer); - } - } - - /* 检查结果过滤器 */ - if (fixer = dom._styleFilter) { - value = fixer.filter(key, value, 'get'); - } - - return value; - }; - - // 声明快捷方法 - baidu.getStyle = baidu.dom.getStyle; - - - if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) { - /** - * 判断是否为opera浏览器 - * @property opera opera版本号 - * @grammar baidu.browser.opera - * @meta standard - * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome - */ - baidu.browser.opera = + RegExp['\x241']; - } - - /** - * 判断是否为webkit内核 - * @property isWebkit - * @grammar baidu.browser.isWebkit - * @meta standard - * @see baidu.browser.isGecko - */ - baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent); - - /** - * 判断是否为gecko内核 - * @property isGecko - * @grammar baidu.browser.isGecko - * @meta standard - * @see baidu.browser.isWebkit - */ - baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent); - - /** - * 判断是否严格标准的渲染模式 - * @property isStrict - * @grammar baidu.browser.isStrict - * @meta standard - */ - baidu.browser.isStrict = document.compatMode == "CSS1Compat"; - - /** - * 获取目标元素相对于整个文档左上角的位置 - * @name baidu.dom.getPosition - * @function - * @grammar baidu.dom.getPosition(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * - * @returns {Object} 目标元素的位置,键值为top和left的Object。 - */ - baidu.dom.getPosition = function (element) { - element = baidu.dom.g(element); - var doc = baidu.dom.getDocument(element), - browser = baidu.browser, - getStyle = baidu.dom.getStyle, - // Gecko 1.9版本以下用getBoxObjectFor计算位置 - // 但是某些情况下是有bug的 - // 对于这些有bug的情况 - // 使用递归查找的方式 - BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 && - doc.getBoxObjectFor && - getStyle(element, 'position') == 'absolute' && - (element.style.top === '' || element.style.left === ''), - pos = {"left":0,"top":0}, - viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement, - parent, - box; - - if(element == viewport){ - return pos; - } - - if(element.getBoundingClientRect){ // IE and Gecko 1.9+ - - //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的 - //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题. - box = element.getBoundingClientRect(); - - pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft); - pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop); - - // IE会给HTML元素添加一个border,默认是medium(2px) - // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖 - // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得 - // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium - // clientTop和clientLeft不会更新 - pos.left -= doc.documentElement.clientLeft; - pos.top -= doc.documentElement.clientTop; - - var htmlDom = doc.body, - // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的 - htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')), - htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth')); - if(browser.ie && !browser.isStrict){ - pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth; - pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth; - } - } else { - // safari/opera/firefox - parent = element; - - do { - pos.left += parent.offsetLeft; - pos.top += parent.offsetTop; - - // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了 - if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') { - pos.left += doc.body.scrollLeft; - pos.top += doc.body.scrollTop; - break; - } - - parent = parent.offsetParent; - } while (parent && parent != element); - - // 对body offsetTop的修正 - if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){ - pos.top -= doc.body.offsetTop; - } - - // 计算除了body的scroll - parent = element.offsetParent; - while (parent && parent != doc.body) { - pos.left -= parent.scrollLeft; - // see https://bugs.opera.com/show_bug.cgi?id=249965 - if (!browser.opera || parent.tagName != 'TR') { - pos.top -= parent.scrollTop; - } - parent = parent.offsetParent; - } - } - - return pos; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
- 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu.dom._g(element); - - var realListener = function (ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if(filter && filter[type]){ - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - // 声明快捷方法 - baidu.on = baidu.event.on; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @name baidu.lang.guid - * @function - * @grammar baidu.lang.guid() - * @version 1.1.1 - * @meta standard - * - * @returns {String} 当前页面的唯一标识字符串 - */ - - (function(){ - //不直接使用window,可以提高3倍左右性能 - var guid = window[baidu.guid]; - - baidu.lang.guid = function() { - return "TANGRAM__" + (guid._counter ++).toString(36); - }; - - guid._counter = guid._counter || 1; - })(); - - /** - * 所有类的实例的容器 - * key为每个实例的guid - * @meta standard - */ - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @version 1.2 - * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * @meta standard - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - // chrome下,'function' == typeof /a/ 为true. - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * - * @ignore - * @class Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - * @meta standard - * @see baidu.lang.inherits,baidu.lang.Event - */ - baidu.lang.Class = function(guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function(){ - delete window[baidu.guid]._instances[this.guid]; - - for(var property in this){ - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function(){ - return "[object " + (this._className || "Object" ) + "]"; - }; - - /** - * @ignore - * @class 自定义的事件对象。 - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - - !this.__listeners && (this.__listeners = {}); - - var t = this.__listeners, id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw("nonstandard key:" + key); - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - - typeof t[type] != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (typeof handler != "undefined") { - if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode)) - || (! baidu.lang.isString(handler)) - ){ - return; - } - } - - !this.__listeners && (this.__listeners = {}); - - type.indexOf("on") != 0 && (type = "on" + type); - - var t = this.__listeners; - if (!t[type]) { - return; - } - if (typeof handler != "undefined") { - t[type][handler] && delete t[type][handler]; - } else { - for(var guid in t[type]){ - delete t[type][guid]; - } - } - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:
- myobj.onMyEvent = function(){}
- myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - - // 20100603 添加本方法的第二个参数,将 options extend到event中去传递 - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - - var i, t = this.__listeners, p = event.type; - event.target = event.target || this; - event.currentTarget = this; - - p.indexOf("on") != 0 && (p = "on" + p); - - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - - if (typeof t[p] == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - - baidu.lang.inherits = function (subClass, superClass, className) { - var key, proto, - selfProps = subClass.prototype, - clazz = new Function(); - - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - // 类名标识,兼容Class的toString,基本没用 - if ("string" == typeof className) { - proto._className = className; - } - }; - // 声明快捷方法 - baidu.inherits = baidu.lang.inherits; - })(); - - - /** - - * 图片的路径 - - * @private - * @type {String} - - */ - var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m'; - - /** - - * 图片的后缀名 - - * @private - * @type {String} - - */ - var _IMAGE_EXTENSION = 'png'; - - /** - *@exports TextIconOverlay as BMapLib.TextIconOverlay - */ - var TextIconOverlay = - /** - * TextIconOverlay - * @class 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。文字通常是数字(0-9)或字母(A-Z ),而文字与图标之间有一定的映射关系。 - *该覆盖物适用于以下类似的场景:需要在地图上添加一系列覆盖物,这些覆盖物之间用不同的图标和文字来区分,文字可能表示了该覆盖物的某一属性值,根据该文字和一定的映射关系,自动匹配相应颜色和大小的图标。 - * - *@constructor - *@param {Point} position 表示一个经纬度坐标位置。 - *@param {String} text 表示该覆盖物显示的文字信息。 - *@param {Json Object} options 可选参数,可选项包括:
- *"styles":{Array} 一组图标风格。单个图表风格包括以下几个属性:
- * url {String} 图片的url地址。(必选)
- * size {Size} 图片的大小。(必选)
- * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值,默认偏移值为图标的中心位置。(可选)
- * offset {Size} 图片相对于可视区域的偏移值,此功能的作用等同于CSS中的background-position属性。(可选)
- * textSize {Number} 文字的大小。(可选,默认10)
- * textColor {String} 文字的颜色。(可选,默认black)
- */ - BMapLib.TextIconOverlay = function(position, text, options){ - this._position = position; - this._text = text; - this._options = options || {}; - this._styles = this._options['styles'] || []; - (!this._styles.length) && this._setupDefaultStyles(); - }; - - T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay"); - - TextIconOverlay.prototype._setupDefaultStyles = function(){ - var sizes = [53, 56, 66, 78, 90]; - for(var i = 0, size; size = sizes[i]; i++){ - this._styles.push({ - url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION, - size: new BMap.Size(size, size) - }); - }//for循环的简洁写法 - }; - - /** - *继承Overlay的intialize方法,自定义覆盖物时必须。 - *@param {Map} map BMap.Map的实例化对象。 - *@return {HTMLElement} 返回覆盖物对应的HTML元素。 - */ - TextIconOverlay.prototype.initialize = function(map){ - this._map = map; - - this._domElement = document.createElement('div'); - this._updateCss(); - this._updateText(); - this._updatePosition(); - - this._bind(); - - this._map.getPanes().markerMouseTarget.appendChild(this._domElement); - return this._domElement; - }; - - /** - *继承Overlay的draw方法,自定义覆盖物时必须。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.draw = function(){ - this._map && this._updatePosition(); - }; - - /** - *获取该覆盖物上的文字。 - *@return {String} 该覆盖物上的文字。 - */ - TextIconOverlay.prototype.getText = function(){ - return this._text; - }; - - /** - *设置该覆盖物上的文字。 - *@param {String} text 要设置的文字,通常是字母A-Z或数字0-9。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.setText = function(text){ - if(text && (!this._text || (this._text.toString() != text.toString()))){ - this._text = text; - this._updateText(); - this._updateCss(); - this._updatePosition(); - } - }; - - /** - *获取该覆盖物的位置。 - *@return {Point} 该覆盖物的经纬度坐标。 - */ - TextIconOverlay.prototype.getPosition = function () { - return this._position; - }; - - /** - *设置该覆盖物的位置。 - *@param {Point} position 要设置的经纬度坐标。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.setPosition = function (position) { - if(position && (!this._position || !this._position.equals(position))){ - this._position = position; - this._updatePosition(); - } - }; - - /** - *由文字信息获取风格数组的对应索引值。 - *内部默认的对应函数为文字转换为数字除以10的结果,比如文字8返回索引0,文字25返回索引2. - *如果需要自定义映射关系,请覆盖该函数。 - *@param {String} text 文字。 - *@param {Array} styles 一组图标风格。 - *@return {Number} 对应的索引值。 - */ - TextIconOverlay.prototype.getStyleByText = function(text, styles){ - var count = parseInt(text); - if (count < 0) { - count = 0; - } - var index = String(count).length; - return styles[index - 1]; - } - - /** - *更新相应的CSS。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updateCss = function(){ - var style = this.getStyleByText(this._text, this._styles); - this._domElement.style.cssText = this._buildCssText(style); - }; - - /** - *更新覆盖物的显示文字。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updateText = function(){ - if (this._domElement) { - this._domElement.innerHTML = this._text; - } - }; - - /** - *调整覆盖物在地图上的位置更新覆盖物的显示文字。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updatePosition = function(){ - if (this._domElement && this._position) { - var style = this._domElement.style; - var pixelPosition= this._map.pointToOverlayPixel(this._position); - pixelPosition.x -= Math.ceil(parseInt(style.width) / 2); - pixelPosition.y -= Math.ceil(parseInt(style.height) / 2); - style.left = pixelPosition.x + "px"; - style.top = pixelPosition.y + "px"; - } - }; - - /** - * 为该覆盖物的HTML元素构建CSS - * @param {IconStyle} 一个图标的风格。 - * @return {String} 构建完成的CSSTEXT。 - */ - TextIconOverlay.prototype._buildCssText = function(style) { - //根据style来确定一些默认值 - var url = style['url']; - var size = style['size']; - var anchor = style['anchor']; - var offset = style['offset']; - var textColor = style['textColor'] || 'black'; - var textSize = style['textSize'] || 10; - - var csstext = []; - if (T.browser["ie"] < 7) { - csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' + - 'sizingMethod=scale,src="' + url + '");'); - } else { - if(style['bgColor'] == '' || style['bgColor'] == undefined) { - csstext.push('background-image:url(' + url + ');'); - var backgroundPosition = '0 0'; - (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px'); - csstext.push('background-position:' + backgroundPosition + ';'); - } else { - var bgColor = style['bgColor']; - csstext.push('background-color:' + bgColor + '; border-radius: 51%; box-shadow:1px 0 38px 3px'+ bgColor + ';'); - } - } - - if (size instanceof BMap.Size){ - if (anchor instanceof BMap.Size) { - if (anchor.height > 0 && anchor.height < size.height) { - csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;'); - } - if(anchor.width > 0 && anchor.width < size.width){ - csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;'); - } - } else { - csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;'); - csstext.push('width:' + size.width + 'px; text-align:center;'); - } - } - - csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' + - textSize + 'px; font-family:Arial,sans-serif; font-weight:bold'); - return csstext.join(''); - }; - - - /** - - * 当鼠标点击该覆盖物时会触发该事件 - - * @name TextIconOverlay#click - - * @event - - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - * - - */ - - /** - - * 当鼠标进入该覆盖物区域时会触发该事件 - - * @name TextIconOverlay#mouseover - - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - *
"point : {BMap.Point} 最新添加上的节点BMap.Point对象 - - *
"pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象 - - * - - * @example 参考示例:
- - * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); }); - - */ - - /** - - * 当鼠标离开该覆盖物区域时会触发该事件 - - * @name TextIconOverlay#mouseout - - * @event - - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - *
"point : {BMap.Point} 最新添加上的节点BMap.Point对象 - - *
"pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象 - - * - - * @example 参考示例:
- - * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); }); - - */ - - - /** - * 为该覆盖物绑定一系列事件 - * 当前支持click mouseover mouseout - * @return 无返回值。 - */ - TextIconOverlay.prototype._bind = function(){ - if (!this._domElement){ - return; - } - - var me = this; - var map = this._map; - - var BaseEvent = T.lang.Event; - function eventExtend(e, be){ - var elem = e.srcElement || e.target; - var x = e.clientX || e.pageX; - var y = e.clientY || e.pageY; - if (e && be && x && y && elem){ - var offset = T.dom.getPosition(map.getContainer()); - be.pixel = new BMap.Pixel(x - offset.left, y - offset.top); - be.point = map.pixelToPoint(be.pixel); - } - return be; - }//给事件参数增加pixel和point两个值 - - T.event.on(this._domElement,"mouseover", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover"))); - }); - T.event.on(this._domElement,"mouseout", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout"))); - }); - T.event.on(this._domElement,"click", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onclick"))); - }); - }; - -})(); \ No newline at end of file diff --git a/app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm b/app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm deleted file mode 100644 index 71f48c3..0000000 Binary files a/app-ht/web/exts-src/dbr_wasm/dbr-6.3.0.1.wasm and /dev/null differ diff --git a/app-ht/web/exts-src/dbr_wasm/js/dbr.js b/app-ht/web/exts-src/dbr_wasm/js/dbr.js deleted file mode 100644 index 0c9fd13..0000000 --- a/app-ht/web/exts-src/dbr_wasm/js/dbr.js +++ /dev/null @@ -1,46 +0,0 @@ -var dynamsoft = self.dynamsoft || {}; -var reader; -dynamsoft.dbrEnv = dynamsoft.dbrEnv || {}; -dynamsoft.dbrEnv.resourcesPath = resourcesPath; -dynamsoft.dbrEnv.licenseKey = "t0126lQMAABEMyEq5ZCNu4lHp3c1/VEMaWC2WbZJyJxnhsk2pJ9iVDyTo8PzWY8fS6s4m6NWkhssycNi/ERwBjhoAUR5TsuIrS3c5XDC7YHbB7ILZBXMI5hDMIZhDMIdgpmCmYKZgpmDOd82fyM1Cw7wxZE281b9pnda68wJay7Ge"; // 2019-09-21日过期 -dynamsoft.dbrEnv.onAutoLoadWasmSuccess = function () { - $(".read_barcode_before").hide(); - $(".read_barcode").show(); - reader = new dynamsoft.BarcodeReader(); -}; -dynamsoft.dbrEnv.onAutoLoadWasmError = function (error) { - alert("加载失败: " + error); -}; - -function readDynamsoftBarcode() { - $(".show-barcode-name").empty(); - var currentShowImage = $("#device_img_list").attr("src"); - - if (isDownloadImgToLocalServer == 1) { - var index = currentShowImage .lastIndexOf("\/"); - currentShowImage = currentShowImage .substring(index + 1, currentShowImage .length); - - // 可以传入图片域名url - currentShowImage = baseUrl + "/tmp/barcode/" + currentShowImage; - } - - reader.decodeFileInMemory(currentShowImage).then(function (results) { - var txts = []; - for (var i = 0; i < results.length; ++i) { - txts.push(results[i].BarcodeText); - } - if (txts === undefined || txts.length == 0) { - $(".show-barcode-name").append("很抱歉,该图片条码无法识别"); - return; - } - $.each(txts, function (i, result) { - item = "" + "序列号" + (i+1) + ":  " + result + "    → 点击使用"; - item += "" + result + "
"; - $(".show-barcode-name").append(item); - }); - $(".show-barcode-name a").bind('click', function () { - var data_rel = $(this).find('span').html(); - $("#serial_no").val(data_rel); - }); - }); -} \ No newline at end of file diff --git a/app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js b/app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js deleted file mode 100644 index f03c474..0000000 --- a/app-ht/web/exts-src/dbr_wasm/js/dynamsoft.barcodereader.min.js +++ /dev/null @@ -1,235 +0,0 @@ -var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(f,t,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");f!=Array.prototype&&f!=Object.prototype&&(f[t]=d.value)};$jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; -$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(f){return $jscomp.SYMBOL_PREFIX+(f||"")+$jscomp.symbolCounter_++}; -$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var f=$jscomp.global.Symbol.iterator;f||(f=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[f]&&$jscomp.defineProperty(Array.prototype,f,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(f){var t=0;return $jscomp.iteratorPrototype(function(){return t=r.length?(v=t=0,K=N=d.videoWidth,ka=W=d.videoHeight):4>=r.length?(v=t=0,K=d.videoWidth,ka=d.videoHeight,N=r[1],W=r[2]):(v=r[1],t=r[2],K=r[3],ka=r[4],N=r[5],W=r[6]);f="string"==typeof r[r.length-1]?r[r.length-1]:"";var Z=document.createElement("canvas");Z.width=N;Z.height=W;Z.getContext("2d").drawImage(d,v,t,K,ka,0,0,N,W);h(Z)})).then(function(d){return h._decodeCanvas(d,f)})};f.prototype._decodeBase64=f.prototype.decodeBase64String= -function(d,h){var f=this;return(new Promise(function(f){if(!("string"==typeof d||"object"==typeof d&&d instanceof String))throw TypeError("'decodeBase64(base64Str, templateName)': Type of 'base64Str' should be 'String'.");"data:image/"==d.substring(0,11)&&(d=d.substring(d.indexOf(",")+1));h=h||"";for(var r=atob(d),v=r.length,t=new Uint8Array(v);v--;)t[v]=r.charCodeAt(v);f(new Blob([t]))})).then(function(d){return f._decodeBlob(d,h)})};f.prototype._decodeUrl=function(d,h){var f=this;return(new Promise(function(f, -v){if(!("string"==typeof d||"object"==typeof d&&d instanceof String))throw TypeError("'_decodeUrl(url, templateName)': Type of 'url' should be 'String'.");h=h||"";var r=new XMLHttpRequest;r.open("GET",d,!0);r.responseType="blob";r.send();r.onloadend=function(){f(this.response)};r.onerror=function(){v(r.error)}})).then(function(d){return f._decodeBlob(d,h)})};f.prototype._decodeRawImageBlob=function(d,f,v,r,t,C){var h=this;return(new Promise(function(f,h){if(!(d instanceof Blob))throw TypeError("'_decodeRawImageBlob(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'Blob'."); -C=C||"";var r=new FileReader;r.readAsArrayBuffer(d);r.onload=function(){f(r.result)};r.onerror=function(){h(r.error)}})).then(function(d){return h._decodeRawImageUint8Array(new Uint8Array(d),f,v,r,t,C)})};f.prototype._decodeRawImageArrayBuffer=function(d,f,v,r,t,C){var h=this;return(new Promise(function(f){if(!(d instanceof ArrayBuffer))throw TypeError("'_decodeRawImageArrayBuffer(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'ArrayBuffer'.");C=C|| -"";f()})).then(function(){return h._decodeRawImageUint8Array(new Uint8Array(d),f,v,r,t,C)})};f.prototype._decodeRawImageUint8Array=function(d,f,v,r,K,C){var h=this;return new Promise(function(O){if(!(d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray))throw TypeError("'_decodeRawImageUint8Array(buffer, width, height, stride, enumImagePixelFormat, templateName)': Type of 'buffer' should be 'Uint8Array'.");C=C||"";O(t(h._instance.DecodeBuffer(d,f,v,r,K,C)))})};f.prototype._decode= -f.prototype.decodeFileInMemory=function(d,f){return Blob&&d instanceof Blob?this._decodeBlob(d,f):self.ArrayBuffer&&d instanceof ArrayBuffer?this._decodeArrayBuffer(d,f):self.Uint8Array&&d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray?this._decodeUint8Array(d,f):self.HTMLImageElement&&d instanceof HTMLImageElement?this._decodeImage(d,f):self.HTMLCanvasElement&&d instanceof HTMLCanvasElement?this._decodeCanvas(d,f):self.HTMLVideoElement&&d instanceof HTMLVideoElement? -this._decodeVideo(d,f):"string"==typeof d||d instanceof String?"data:image/"==d.substring(0,11)?this._decodeBase64(d,f):this._decodeUrl(d,f):Promise.reject(TypeError("'_decode(source, templateName)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))};f.prototype._decodeRawImage=f.prototype.decodeBuffer=function(d,f,t,r,K,C){return Blob&&d instanceof Blob?this._decodeRawImageBlob(d, -f,t,r,K,C):ArrayBuffer&&d instanceof ArrayBuffer?this._decodeRawImageArrayBuffer(d,f,t,r,K,C):self.Uint8Array&&d instanceof Uint8Array||self.Uint8ClampedArray&&d instanceof Uint8ClampedArray?this._decodeRawImageUint8Array(d,f,t,r,K,C):Promise.reject(TypeError("'_decodeRawImage(source, width, height, stride, enumImagePixelFormat, templateName)': Type of 'source' should be 'Blob', 'ArrayBuffer' or 'Uint8Array'."))};var t=function(d){d="string"==typeof d||"object"==typeof d&&d instanceof String?JSON.parse(d): -d;var h=f.EnumErrorCode;switch(d.exception){case h.DBR_SUCCESS:case h.DBR_LICENSE_INVALID:case h.DBR_1D_LICENSE_INVALID:case h.DBR_QR_LICENSE_INVALID:case h.DBR_PDF417_LICENSE_INVALID:case h.DBR_DATAMATRIX_LICENSE_INVALID:case h.DBR_DBRERR_AZTEC_LICENSE_INVALID:case h.DBR_RECOGNITION_TIMEOUT:if(d.textResult)for(h=0;h>2];a=c+a+15&-16;p[aa>>2]=a;return a>=H&&!qc()?(p[aa>>2]=c,0):c}function v(a){var c;c||(c=16);return Math.ceil(a/c)*c}function O(a,c){a||E("Assertion failed: "+c)}function ka(a,c){if("number"===typeof a)var b=!0,e=a;else b=!1,e=a.length;c=4==c?k:["function"===typeof da?da:r,ld,r,t][void 0===c?2:c](Math.max(e,1));if(b){var k=c;O(0==(c&3));for(a=c+(e&-4);k>2]=0;for(a=c+e;k>0]=0;return c}a.subarray|| -a.slice?I.set(a,c):I.set(new Uint8Array(a),c);return c}function N(a){var c;if(0===c||!a)return"";for(var b=0,e,k=0;;){e=I[a+k>>0];b|=e;if(0==e&&!c)break;k++;if(c&&k==c)break}c||(c=k);e="";if(128>b){for(;0e?b+=String.fromCharCode(e):(e-=65536,b+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else b+=String.fromCharCode(e)}}function Z(a,c,b,e){if(!(0=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++l)&1023);if(127>=d){if(b>=e)break;c[b++]=d}else{if(2047>=d){if(b+1>=e)break;c[b++]=192|d>>6}else{if(65535>=d){if(b+2>=e)break;c[b++]=224|d>>12}else{if(2097151>=d){if(b+3>=e)break;c[b++]=240|d>>18}else{if(67108863>=d){if(b+4>=e)break;c[b++]=248|d>>24}else{if(b+5>=e)break;c[b++]=252|d>>30;c[b++]=128|d>>24&63}c[b++]=128|d>>18&63}c[b++]=128|d>>12&63}c[b++]=128|d>>6&63}c[b++]=128|d&63}}c[b]=0;return b-g}function wa(a){for(var c= -0,b=0;b=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++b)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}function Eb(a,c){0>2]>c)return!1;var g=H;for(H=Math.max(H,md);H>2];)536870912>=H?H=Eb(2*H,a):H=Math.min(Eb((3*H+2147483648)/4,a),c);a=b.reallocBuffer(H);if(!a||a.byteLength!=H)return H=g,!1;b.buffer=L=a;Fb();return!0}function Ia(a){for(;0>2]=a;for(var a=bb,k=0;k>2],c.Ia=a,(ab(e[k]),a)|0;a=p[a>>2];return(ab(g),a)|0}function Jb(a){b.___errno_location&&(p[b.___errno_location()>>2]=a);return a}function Kb(a,c){for(var b=0,e=a.length-1;0<=e;e--){var k=a[e];"."===k?a.splice(e,1):".."===k?(a.splice(e,1),b++):b&&(a.splice(e,1),b--)}if(c)for(;b;b--)a.unshift("..");return a}function Lb(a){var c="/"===a.charAt(0),b="/"===a.substr(-1);(a=Kb(a.split("/").filter(function(a){return!!a}),!c).join("/"))||c||(a=".");a&&b&&(a+="/");return(c?"/":"")+a}function od(a){var c= -/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=c[0];c=c[1];if(!a&&!c)return".";c&&(c=c.substr(0,c.length-1));return a+c}function yc(a){if("/"===a)return"/";var c=a.lastIndexOf("/");return-1===c?a:a.substr(c+1)}function pd(){var a=Array.prototype.slice.call(arguments,0);return Lb(a.join("/"))}function qa(a,c){return Lb(a+"/"+c)}function cb(){for(var a="",c=!1,b=arguments.length-1;-1<=b&&!c;b--){c=0<=b?arguments[b]:"/";if("string"!==typeof c)throw new TypeError("Arguments to path.resolve must be strings"); -if(!c)return"";a=c+"/"+a;c="/"===c.charAt(0)}a=Kb(a.split("/").filter(function(a){return!!a}),!c).join("/");return(c?"/":"")+a||"."}function zc(a,c){Ac[a]={input:[],output:[],W:c};Mb(a,qd)}function ra(a,c){a=cb("/",a);c=c||{};if(!a)return{path:"",node:null};var b={Qa:!0,Ba:0},e;for(e in b)void 0===c[e]&&(c[e]=b[e]);if(8>>0)%Ja.length}function rd(a){var c=Dc(a.parent.id,a.name);a.lb=Ja[c];Ja[c]=a}function db(a,c){var b;if(b= -(b=eb(a,"x"))?b:a.h.lookup?0:m.ra)throw new q(b,a);for(b=Ja[Dc(a.id,c)];b;b=b.lb){var e=b.name;if(b.parent.id===a.id&&e===c)return b}return a.h.lookup(a,c)}function Ob(a,c,b,e){Ka||(Ka=function(a,c,b,g){a||(a=this);this.parent=a;this.v=a.v;this.ma=null;this.id=sd++;this.name=c;this.mode=b;this.h={};this.g={};this.rdev=g},Ka.prototype={},Object.defineProperties(Ka.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146=== -(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}}));a=new Ka(a,c,b,e);rd(a);return a}function Ec(a){var c=["r","w","rw"][a&3];a&512&&(c+="w");return c}function eb(a,c){if(Fc)return 0;if(-1===c.indexOf("r")||a.mode&292){if(-1!==c.indexOf("w")&&!(a.mode&146)||-1!==c.indexOf("x")&&!(a.mode&73))return m.ra}else return m.ra;return 0}function Gc(a,c){try{return db(a,c),m.Ea}catch(g){}return eb(a,"wx")}function td(a){for(a=a||0;4096>=a;a++)if(!la[a])return a;throw new q(m.Xa);}function ud(a, -c){La||(La=function(){},La.prototype={},Object.defineProperties(La.prototype,{object:{get:function(){return this.node},set:function(a){this.node=a}}}));var b=new La,e;for(e in a)b[e]=a[e];a=b;c=td(c);a.fd=c;return la[c]=a}function Mb(a,c){Hc[a]={g:c}}function Ic(a,c){var b="/"===c,e=!c;if(b&&Nb)throw new q(m.Da);if(!b&&!e){var k=ra(c,{Qa:!1});c=k.path;k=k.node;if(k.ma)throw new q(m.Da);if(16384!==(k.mode&61440))throw new q(m.Fa);}c={type:a,za:{},Ua:c,kb:[]};a=a.v(c);a.v=c;c.root=a;b?Nb=a:k&&(k.ma= -c,k.v&&k.v.kb.push(c))}function Pb(a,c,b){var g=ra(a,{parent:!0}).node;a=yc(a);if(!a||"."===a||".."===a)throw new q(m.m);var k=Gc(g,a);if(k)throw new q(k);if(!g.h.$)throw new q(m.Y);return g.h.$(g,a,c,b)}function fa(a){Pb(a,16895,0)}function fb(a,c,b){"undefined"===typeof b&&(b=c,c=438);Pb(a,c|8192,b)}function Qb(a,c){if(!cb(a))throw new q(m.L);var b=ra(c,{parent:!0}).node;if(!b)throw new q(m.L);c=yc(c);var e=Gc(b,c);if(e)throw new q(e);if(!b.h.symlink)throw new q(m.Y);b.h.symlink(b,c,a)}function Bc(a){a= -ra(a).node;if(!a)throw new q(m.L);if(!a.h.readlink)throw new q(m.m);return cb(Cc(a.parent),a.h.readlink(a))}function Ma(a,c,g,e){if(""===a)throw new q(m.L);if("string"===typeof c){var k=vd[c];if("undefined"===typeof k)throw Error("Unknown file open mode: "+c);c=k}g=c&64?("undefined"===typeof g?438:g)&4095|32768:0;if("object"===typeof a)var l=a;else{a=Lb(a);try{l=ra(a,{Pa:!(c&131072)}).node}catch(n){}}k=!1;if(c&64)if(l){if(c&128)throw new q(m.Ea);}else l=Pb(a,g,0),k=!0;if(!l)throw new q(m.L);8192=== -(l.mode&61440)&&(c&=-513);if(c&65536&&16384!==(l.mode&61440))throw new q(m.Fa);if(!k&&(g=l?40960===(l.mode&61440)?m.sa:16384===(l.mode&61440)&&("r"!==Ec(c)||c&512)?m.ga:eb(l,Ec(c)):m.L))throw new q(g);if(c&512){g=l;var d;"string"===typeof g?d=ra(g,{Pa:!0}).node:d=g;if(!d.h.C)throw new q(m.Y);if(16384===(d.mode&61440))throw new q(m.ga);if(32768!==(d.mode&61440))throw new q(m.m);if(g=eb(d,"w"))throw new q(g);d.h.C(d,{size:0,timestamp:Date.now()})}c&=-641;e=ud({node:l,path:Cc(l),flags:c,seekable:!0, -position:0,g:l.g,zb:[],error:!1},e);e.g.open&&e.g.open(e);!b.logReadFiles||c&1||(gb||(gb={}),a in gb||(gb[a]=1,b.printErr("read file: "+a)));try{hb.onOpenFile&&(l=0,1!==(c&2097155)&&(l|=1),0!==(c&2097155)&&(l|=2),hb.onOpenFile(a,l))}catch(n){console.log("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+n.message)}return e}function Jc(a){a.wa&&(a.wa=null);try{a.g.close&&a.g.close(a)}catch(c){throw c;}finally{la[a.fd]=null}}function Kc(a,c,b){if(!a.seekable||!a.g.M)throw new q(m.ha); -a.position=a.g.M(a,c,b);a.zb=[]}function Lc(){q||(q=function(a,c){this.node=c;this.rb=function(a){this.J=a;for(var c in m)if(m[c]===a){this.code=c;break}};this.rb(a);this.message=wd[a];this.stack&&Object.defineProperty(this,"stack",{value:Error().stack,writable:!0})},q.prototype=Error(),q.prototype.constructor=q,[m.L].forEach(function(a){Rb[a]=new q(a);Rb[a].stack=""}))}function xd(a,c){var b=0;a&&(b|=365);c&&(b|=146);return b}function Na(a,c,b){a=qa("/dev",a);var g=xd(!!c, -!!b);Sb||(Sb=64);var k=Sb++<<8|0;Mb(k,{open:function(a){a.seekable=!1},close:function(){b&&b.buffer&&b.buffer.length&&b(10)},read:function(a,b,g,e){for(var k=0,l=0;l>2]}function za(){var a=la[D()];if(!a)throw new q(m.ea);return a}function Tb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}function T(a){for(var c="";I[a];)c+=Mc[I[a++]];return c}function Ub(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var c=a.charCodeAt(0);return 48<=c&&57>=c?"_"+a:a}function Vb(a,c){a=Ub(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(c)} -function Wb(a){var c=Error,b=Vb(a,function(c){this.name=a;this.message=c;c=Error(c).stack;void 0!==c&&(this.stack=this.toString()+"\n"+c.replace(/^Error(:[^\n]*)?\n/,""))});b.prototype=Object.create(c.prototype);b.prototype.constructor=b;b.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return b}function A(a){throw new Aa(a);}function ib(a){throw new Nc(a);}function Oa(a,c,b){function g(c){c=b(c);c.length!==a.length&&ib("Mismatched type converter count"); -for(var g=0;g> -2])}function Qc(a,c,b){if(c===b)return a;if(void 0===b.F)return null;a=Qc(a,c,b.F);return null===a?null:b.cb(a)}function Dd(a,c){for(void 0===c&&A("ptr should not be undefined");a.F;)c=a.da(c),a=a.F;return Qa[c]}function lb(a,c){c.o&&c.j||ib("makeClassHandle requires ptr and ptrType");!!c.D!==!!c.B&&ib("Both smartPtrType and smartPtr must be specified");c.count={value:1};return Object.create(a,{c:{value:c}})}function ha(a,c,b,e,k,d,x,f,h,u,w){this.name=a;this.i=c;this.ya=b;this.ja=e;this.ka=k;this.mb= -d;this.sb=x;this.Va=f;this.ob=h;this.pb=u;this.R=w;k||void 0!==c.F?this.toWireType=Bd:(this.toWireType=e?Ad:Cd,this.I=null)}function Ed(a,c){b.hasOwnProperty(a)||ib("Replacing nonexistant public symbol");b[a]=c;b[a].ia=void 0}function Ea(a,c){a=T(a);if(void 0!==b["FUNCTION_TABLE_"+a])var g=b["FUNCTION_TABLE_"+a][c];else if("undefined"!==typeof FUNCTION_TABLE)g=FUNCTION_TABLE[c];else{g=b.asm["dynCall_"+a];void 0===g&&(g=b.asm["dynCall_"+a.replace(/f/g,"d")],void 0===g&&A("No dynCall invoker for signature: "+ -a));for(var e=[],k=1;k>2)+e]);return b}function Tc(a){for(;a.length;){var c=a.pop();a.pop()(c)}}function Hd(a){var c=Function;if(!(c instanceof Function))throw new TypeError("new_ called with constructor type "+typeof c+" which is not a function");var b=Vb(c.name||"unknownFunctionName",function(){});b.prototype=c.prototype;b=new b;a=c.apply(b,a);return a instanceof Object?a:b}function Pc(a){switch(a){case void 0:return 1;case null:return 2; -case !0:return 3;case !1:return 4;default:var c=ac.length?ac.pop():ba.length;ba[c]={X:1,value:a};return c}}function Da(a){if(null===a)return"null";var c=typeof a;return"object"===c||"array"===c||"function"===c?a.toString():""+a}function Id(a,c){switch(c){case 2:return function(a){return this.fromWireType(sc[a>>2])};case 3:return function(a){return this.fromWireType(tc[a>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Jd(a,c,b){switch(c){case 0:return b?function(a){return P[a]}: -function(a){return I[a]};case 1:return b?function(a){return Ha[a>>1]}:function(a){return Gb[a>>1]};case 2:return b?function(a){return p[a>>2]}:function(a){return ea[a>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function Uc(){function a(a){return(a=a.toTimeString().match(/\(([A-Za-z ]+)\)$/))?a[1]:"GMT"}if(!Vc){Vc=!0;p[Kd>>2]=60*(new Date).getTimezoneOffset();var c=new Date(2E3,0,1),b=new Date(2E3,6,1);p[Ld>>2]=Number(c.getTimezoneOffset()!=b.getTimezoneOffset());var e=a(c),k=a(b), -e=ka(Ra(e),0),k=ka(Ra(k),0);b.getTimezoneOffset()>2]=e,p[Sa+4>>2]=k):(p[Sa>>2]=k,p[Sa+4>>2]=e)}}function mb(){void 0===mb.start&&(mb.start=Date.now());return 1E3*(Date.now()-mb.start)|0}function Y(a){a=eval(N(a))+"";var c=wa(a);if(!Y.u||Y.ue-a.getDate())c-=e-a.getDate()+1,a.setDate(1),11>b?a.setMonth(b+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+c);break}}return a}function Xc(a,c,b,e){function g(a,c,b){for(a="number"===typeof a?a.toString():a||"";a.lengtha?-1:0=f(n(new Date(a.getFullYear(),0,4)),a)?0>=f(c,a)?a.getFullYear()+1:a.getFullYear():a.getFullYear()-1}var u=p[e+40>>2];e={wb:p[e>>2],vb:p[e+4>>2],pa:p[e+ -8>>2],S:p[e+12>>2],N:p[e+16>>2],s:p[e+20>>2],Wa:p[e+24>>2],qa:p[e+28>>2],Dd:p[e+32>>2],ub:p[e+36>>2],xb:u?N(u):""};b=N(b);var u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"},w;for(w in u)b=b.replace(new RegExp(w,"g"),u[w]);var J="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "), -u={"%a":function(a){return J[a.Wa].substring(0,3)},"%A":function(a){return J[a.Wa]},"%b":function(a){return m[a.N].substring(0,3)},"%B":function(a){return m[a.N]},"%C":function(a){return d((a.s+1900)/100|0,2)},"%d":function(a){return d(a.S,2)},"%e":function(a){return g(a.S,2," ")},"%g":function(a){return h(a).toString().substring(2)},"%G":function(a){return h(a)},"%H":function(a){return d(a.pa,2)},"%I":function(a){a=a.pa;0==a?a=12:12a.pa?"AM":"PM"},"%S":function(a){return d(a.wb,2)},"%t":function(){return"\t"},"%u":function(a){return(new Date(a.s+1900,a.N+1,a.S,0,0,0,0)).getDay()||7},"%U":function(a){var c=new Date(a.s+1900,0,1),b=0===c.getDay()?c:ob(c,7-c.getDay());a=new Date(a.s+1900,a.N,a.S);return 0>f(b,a)?d(Math.ceil((31-b.getDate()+(bc(nb(a.getFullYear())?pb:qb,a.getMonth()- -1)-31)+a.getDate())/7),2):0===f(b,c)?"01":"00"},"%V":function(a){var c=n(new Date(a.s+1900,0,4)),b=n(new Date(a.s+1901,0,4)),e=ob(new Date(a.s+1900,0,1),a.qa);return 0>f(e,c)?"53":0>=f(b,e)?"01":d(Math.ceil((c.getFullYear()f(b,a)?d(Math.ceil((31- -b.getDate()+(bc(nb(a.getFullYear())?pb:qb,a.getMonth()-1)-31)+a.getDate())/7),2):0===f(b,c)?"01":"00"},"%y":function(a){return(a.s+1900).toString().substring(2)},"%Y":function(a){return a.s+1900},"%z":function(a){a=a.ub;var c=0<=a;a=Math.abs(a)/60;return(c?"+":"-")+String("0000"+(a/60*100+a%60)).slice(-4)},"%Z":function(a){return a.xb},"%%":function(){return"%"}};for(w in u)0<=b.indexOf(w)&&(b=b.replace(new RegExp(w,"g"),u[w](e)));w=Ra(b,!1);if(w.length>c)return 0;P.set(w,a);return w.length-1}function Ra(a, -c){var b=Array(wa(a)+1);a=Z(a,b,0,b.length);c&&(b.length=a);return b}function Va(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}function dc(){function a(){if(!b.calledRun&&(b.calledRun=!0,!Wa)){Yc||(Yc=!0,Ia(rb));Ia(Zc);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;){var a=b.postRun.shift();$c.unshift(a)}Ia($c)}}if(!(0a.f.length&&(a.f=y.gb(a),a.l=a.f.length);if(!a.f||a.f.subarray){var b=a.f?a.f.length:0;b>=c||(c=Math.max(c,b*(1048576>b?2:1.125)|0),0!=b&&(c=Math.max(c,256)),b=a.f,a.f=new Uint8Array(c),0c)a.f.length=c;else for(;a.f.length=a.node.l)return 0;a=Math.min(a.node.l-k,e);O(0<=a);if(8c)throw new q(m.m); -return c},Ja:function(a,c,b){y.Na(a.node,c+b);a.node.l=Math.max(a.node.l,c+b)},Ta:function(a,c,b,e,k,d,f){if(32768!==(a.node.mode&61440))throw new q(m.ta);b=a.node.f;if(f&2||b.buffer!==c&&b.buffer!==c.buffer){if(0>2)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}return b.mode},A:function(a){for(var b=[];a.parent!==a;)b.push(a.name),a=a.parent;b.push(a.v.za.root);b.reverse();return pd.apply(null,b)},eb:function(a){a&=-2656257;var b=0,g;for(g in B.Oa)a&g&&(b|=B.Oa[g],a^=g);if(a)throw new q(m.m);return b},h:{K:function(a){a=B.A(a);try{var b=F.lstatSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}B.la&&!b.O&&(b.O=4096);B.la&& -!b.blocks&&(b.blocks=(b.size+b.O-1)/b.O|0);return{dev:b.dev,ino:b.ino,mode:b.mode,nlink:b.nlink,uid:b.uid,gid:b.gid,rdev:b.rdev,size:b.size,atime:b.atime,mtime:b.mtime,ctime:b.ctime,O:b.O,blocks:b.blocks}},C:function(a,b){var c=B.A(a);try{void 0!==b.mode&&(F.chmodSync(c,b.mode),a.mode=b.mode),void 0!==b.size&&F.truncateSync(c,b.size)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},lookup:function(a,b){var c=qa(B.A(a),b),c=B.Ra(c);return B.createNode(a,b,c)},$:function(a,b,g,e){a=B.createNode(a, -b,g,e);b=B.A(a);try{16384===(a.mode&61440)?F.mkdirSync(b,a.mode):F.writeFileSync(b,"",{mode:a.mode})}catch(k){if(!k.code)throw k;throw new q(m[k.code]);}return a},rename:function(a,b,g){a=B.A(a);b=qa(B.A(b),g);try{F.renameSync(a,b)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},unlink:function(a,b){a=qa(B.A(a),b);try{F.unlinkSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}},rmdir:function(a,b){a=qa(B.A(a),b);try{F.rmdirSync(a)}catch(g){if(!g.code)throw g;throw new q(m[g.code]); -}},readdir:function(a){a=B.A(a);try{return F.readdirSync(a)}catch(c){if(!c.code)throw c;throw new q(m[c.code]);}},symlink:function(a,b,g){a=qa(B.A(a),b);try{F.symlinkSync(g,a)}catch(e){if(!e.code)throw e;throw new q(m[e.code]);}},readlink:function(a){var b=B.A(a);try{return b=F.readlinkSync(b),ad.relative(ad.resolve(a.v.za.root),b)}catch(g){if(!g.code)throw g;throw new q(m[g.code]);}}},g:{open:function(a){var b=B.A(a.node);try{32768===(a.node.mode&61440)&&(a.aa=F.openSync(b,B.eb(a.flags)))}catch(g){if(!g.code)throw g; -throw new q(m[g.code]);}},close:function(a){try{32768===(a.node.mode&61440)&&a.aa&&F.closeSync(a.aa)}catch(c){if(!c.code)throw c;throw new q(m[c.code]);}},read:function(a,b,g,e,d){if(0===e)return 0;try{return F.readSync(a.aa,B.Ka(b.buffer),g,e,d)}catch(l){throw new q(m[l.code]);}},write:function(a,b,g,e,d){try{return F.writeSync(a.aa,B.Ka(b.buffer),g,e,d)}catch(l){throw new q(m[l.code]);}},M:function(a,b,g){if(1===g)b+=a.position;else if(2===g&&32768===(a.node.mode&61440))try{b+=F.fstatSync(a.aa).size}catch(e){throw new q(m[e.code]); -}if(0>b)throw new q(m.m);return b}}};G+=16;G+=16;G+=16;var Nb=null,Hc={},la=[],sd=1,Ja=null,Fc=!0,hb={},q=null,Rb={},vd={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},lf={open:function(a){a.g=Hc[a.node.rdev].g;a.g.open&&a.g.open(a)},M:function(){throw new q(m.ha);}},vb,Sb,ja={},Ka,La,gb,bd={},S=0,Mc=void 0,Ca={},Ba={},jb={},Aa=void 0,Nc=void 0,Za=void 0,Pa=[],cd={},Qa={},Rc=void 0,ac=[],ba=[{},{value:void 0},{value:null}, -{value:!0},{value:!1}],dd=G,Sa=G+=48,Ld=G+=16,Kd=G+=16;G+=16;var Vc,ed=G;G+=16;var fd,U={},V=G;G+=48;ka(Ra("GMT"),2);var wb={},oc=1,pb=[31,29,31,30,31,30,31,31,30,31,30,31],qb=[31,28,31,30,31,30,31,31,30,31,30,31];Lc();Ja=Array(4096);Ic(y,"/");fa("/tmp");fa("/home");fa("/home/web_user");(function(){fa("/dev");Mb(259,{read:function(){return 0},write:function(a,b,c,d){return d}});fb("/dev/null",259);zc(1280,jf);zc(1536,kf);fb("/dev/tty",1280);fb("/dev/tty1",1536);if("undefined"!==typeof crypto)var a= -new Uint8Array(1),b=function(){crypto.getRandomValues(a);return a[0]};else b=ia?function(){return require("crypto").randomBytes(1)[0]}:function(){return 256*Math.random()|0};Na("random",b);Na("urandom",b);fa("/dev/shm");fa("/dev/shm/tmp")})();fa("/proc");fa("/proc/self");fa("/proc/self/fd");Ic({v:function(){var a=Ob("/proc/self","fd",16895,73);a.h={lookup:function(a,b){var c=la[+b];if(!c)throw new q(m.ea);a={parent:null,v:{Ua:"fake"},h:{readlink:function(){return c.path}}};return a.parent=a}};return a}}, -"/proc/self/fd");rb.unshift(function(){if(!b.noFSInit&&!vb){O(!vb,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");vb=!0;Lc();b.stdin=b.stdin;b.stdout=b.stdout;b.stderr=b.stderr;b.stdin?Na("stdin",b.stdin):Qb("/dev/tty","/dev/stdin");b.stdout?Na("stdout",null,b.stdout):Qb("/dev/tty","/dev/stdout");b.stderr?Na("stderr",null,b.stderr):Qb("/dev/tty1","/dev/stderr");var a=Ma("/dev/stdin", -"r");O(0===a.fd,"invalid handle for stdin ("+a.fd+")");a=Ma("/dev/stdout","w");O(1===a.fd,"invalid handle for stdout ("+a.fd+")");a=Ma("/dev/stderr","w");O(2===a.fd,"invalid handle for stderr ("+a.fd+")")}});Zc.push(function(){Fc=!1});mc.push(function(){vb=!1;var a=b._fflush;a&&a(0);for(a=0;axb;++xb)gd[xb]=String.fromCharCode(xb); -Mc=gd;Aa=b.BindingError=Wb("BindingError");Nc=b.InternalError=Wb("InternalError");na.prototype.isAliasOf=function(a){if(!(this instanceof na&&a instanceof na))return!1;var b=this.c.o.i,g=this.c.j,e=a.c.o.i;for(a=a.c.j;b.F;)g=b.da(g),b=b.F;for(;e.F;)a=e.da(a),e=e.F;return b===e&&g===a};na.prototype.clone=function(){this.c.j||Xb(this);if(this.c.ba)return this.c.count.value+=1,this;var a=this.c,a=Object.create(Object.getPrototypeOf(this),{c:{value:{count:a.count,U:a.U,ba:a.ba,j:a.j,o:a.o,B:a.B,D:a.D}}}); -a.c.count.value+=1;a.c.U=!1;return a};na.prototype["delete"]=function(){this.c.j||Xb(this);this.c.U&&!this.c.ba&&A("Object already scheduled for deletion");--this.c.count.value;if(0===this.c.count.value){var a=this.c;a.B?a.D.R(a.B):a.o.i.R(a.j)}this.c.ba||(this.c.B=void 0,this.c.j=void 0)};na.prototype.isDeleted=function(){return!this.c.j};na.prototype.deleteLater=function(){this.c.j||Xb(this);this.c.U&&!this.c.ba&&A("Object already scheduled for deletion");Pa.push(this);1===Pa.length&&Za&&Za(Yb); -this.c.U=!0;return this};ha.prototype.hb=function(a){this.Va&&(a=this.Va(a));return a};ha.prototype.Z=function(a){this.R&&this.R(a)};ha.prototype.argPackAdvance=8;ha.prototype.readValueFromPointer=kb;ha.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};ha.prototype.fromWireType=function(a){function b(){return this.ka?lb(this.i.V,{o:this.mb,j:g,D:this,B:a}):lb(this.i.V,{o:this,j:a})}var g=this.hb(a);if(!g)return this.Z(a),null;var e=Dd(this.i,g);if(void 0!==e){if(0===e.c.count.value)return e.c.j= -g,e.c.B=a,e.clone();e=e.clone();this.Z(a);return e}e=this.i.fb(g);e=cd[e];if(!e)return b.call(this);var e=this.ja?e.bb:e.pointerType,d=Qc(g,this.i,e.i);return null===d?b.call(this):this.ka?lb(e.i.V,{o:e,j:d,D:this,B:a}):lb(e.i.V,{o:e,j:d})};b.getInheritedInstanceCount=function(){return Object.keys(Qa).length};b.getLiveInheritedInstances=function(){var a=[],b;for(b in Qa)Qa.hasOwnProperty(b)&&a.push(Qa[b]);return a};b.flushPendingDeletes=Yb;b.setDelayFunction=function(a){Za=a;Pa.length&&Za&&Za(Yb)}; -Rc=b.UnboundTypeError=Wb("UnboundTypeError");b.count_emval_handles=function(){for(var a=0,b=5;b>2],Ga=p[ua>>2]):(fd=!0,U.USER=U.LOGNAME="web_user",U.PATH="/",U.PWD="/",U.HOME="/home/web_user",U.LANG="C.UTF-8",U._=b.thisProgram,Ga=r(1024),ua=r(256),p[ua>>2]=Ga,p[ed>>2]=ua);var yb=[],hd=0,zb;for(zb in U)if("string"===typeof U[zb]){var Ab= -zb+"="+U[zb];yb.push(Ab);hd+=Ab.length}if(1024>0]=id.charCodeAt(pc);P[jd>>0]=0;p[ua+4*Bb>>2]=Ga;Ga+=Ab.length+1}p[ua+4*yb.length>>2]=0;aa=r(4);hc=tb=v(G);ic=hc+lc;jc=v(ic);p[aa>>2]=jc;Db=!0;b.wasmTableSize=3583;b.wasmMaxTableSize=3583;b.$a={};b.ab={abort:E,enlargeMemory:qc,getTotalMemory:function(){return H},abortOnCannotGrowMemory:function(){E("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+ -H+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},invoke_di:function(a,c){try{return b.dynCall_di(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_dii:function(a,c,g){try{return b.dynCall_dii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_diiii:function(a,c,g,e,d){try{return b.dynCall_diiii(a, -c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_fi:function(a,c){try{return b.dynCall_fi(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_fii:function(a,c,g){try{return b.dynCall_fii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_fiifffi:function(a,c,g,e,d,l,f){try{return b.dynCall_fiifffi(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_fiii:function(a, -c,g,e){try{return b.dynCall_fiii(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_i:function(a){try{return b.dynCall_i(a)}catch(c){if("number"!==typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},invoke_ii:function(a,c){try{return b.dynCall_ii(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_iid:function(a,c,g){try{return b.dynCall_iid(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_iififi:function(a, -c,g,e,d,l){try{return b.dynCall_iififi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iii:function(a,c,g){try{return b.dynCall_iii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_iiifii:function(a,c,g,e,d,l){try{return b.dynCall_iiifii(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiifiiiiiii:function(a,c,g,e,d,l,f,n,h,u,w){try{return b.dynCall_iiifiiiiiii(a,c,g,e,d, -l,f,n,h,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_iiii:function(a,c,g,e){try{return b.dynCall_iiii(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_iiiidi:function(a,c,g,e,d,l){try{return b.dynCall_iiiidi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiiii:function(a,c,g,e,d){try{return b.dynCall_iiiii(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1, -0)}},invoke_iiiiifi:function(a,c,g,e,d,l,f){try{return b.dynCall_iiiiifi(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_iiiiii:function(a,c,g,e,d,l){try{return b.dynCall_iiiiii(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_iiiiiii:function(a,c,g,e,d,l,f){try{return b.dynCall_iiiiiii(a,c,g,e,d,l,f)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_iiiiiiii:function(a,c,g,e,d, -l,f,h){try{return b.dynCall_iiiiiiii(a,c,g,e,d,l,f,h)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_iiiiiiiif:function(a,c,g,e,d,l,f,h,z){try{return b.dynCall_iiiiiiiif(a,c,g,e,d,l,f,h,z)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_iiiiiiiii:function(a,c,g,e,d,l,f,h,z){try{return b.dynCall_iiiiiiiii(a,c,g,e,d,l,f,h,z)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_iiiiiiiiii:function(a,c,g,e,d,l, -f,h,z,u){try{return b.dynCall_iiiiiiiiii(a,c,g,e,d,l,f,h,z,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_iiiiiiiiiiii:function(a,c,g,e,d,l,f,h,z,u,w,m){try{return b.dynCall_iiiiiiiiiiii(a,c,g,e,d,l,f,h,z,u,w,m)}catch(ma){if("number"!==typeof ma&&"longjmp"!==ma)throw ma;b.setThrew(1,0)}},invoke_iiiiiiiiiiiiiiii:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v){try{return b.dynCall_iiiiiiiiiiiiiiii(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v)}catch(M){if("number"!==typeof M&&"longjmp"!== -M)throw M;b.setThrew(1,0)}},invoke_iiiiiiiiiiiiiiiiii:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y){try{return b.dynCall_iiiiiiiiiiiiiiiiii(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y)}catch(va){if("number"!==typeof va&&"longjmp"!==va)throw va;b.setThrew(1,0)}},invoke_v:function(a){try{b.dynCall_v(a)}catch(c){if("number"!==typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},invoke_vi:function(a,c){try{b.dynCall_vi(a,c)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},invoke_vidii:function(a, -c,g,e,d){try{b.dynCall_vidii(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_vif:function(a,c,g){try{b.dynCall_vif(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_viffffffff:function(a,c,g,e,d,l,f,h,m,u){try{b.dynCall_viffffffff(a,c,g,e,d,l,f,h,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viffffffffffffffff:function(a,c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y){try{b.dynCall_viffffffffffffffff(a, -c,g,e,d,l,f,h,m,u,w,q,p,r,t,v,M,y)}catch(va){if("number"!==typeof va&&"longjmp"!==va)throw va;b.setThrew(1,0)}},invoke_vii:function(a,c,g){try{b.dynCall_vii(a,c,g)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},invoke_viid:function(a,c,g,e){try{b.dynCall_viid(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiddi:function(a,c,g,e,d,l){try{b.dynCall_viiddi(a,c,g,e,d,l)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1, -0)}},invoke_viidi:function(a,c,g,e,d){try{b.dynCall_viidi(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viididii:function(a,c,g,e,d,l,f,h){try{b.dynCall_viididii(a,c,g,e,d,l,f,h)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viif:function(a,c,g,e){try{b.dynCall_viif(a,c,g,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiffff:function(a,c,g,e,d,f,h){try{b.dynCall_viiffff(a,c,g,e,d,f, -h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viifi:function(a,c,g,e,d){try{b.dynCall_viifi(a,c,g,e,d)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viifii:function(a,c,g,e,d,f){try{b.dynCall_viifii(a,c,g,e,d,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viifiif:function(a,c,g,e,d,f,h){try{b.dynCall_viifiif(a,c,g,e,d,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}}, -invoke_viii:function(a,c,d,e){try{b.dynCall_viii(a,c,d,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},invoke_viiid:function(a,c,d,e,k){try{b.dynCall_viiid(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiidd:function(a,c,d,e,k,f){try{b.dynCall_viiidd(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiddi:function(a,c,d,e,k,f,h){try{b.dynCall_viiiddi(a,c,d,e,k,f,h)}catch(n){if("number"!== -typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiidi:function(a,c,d,e,k,f){try{b.dynCall_viiidi(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiidii:function(a,c,d,e,k,f,h){try{b.dynCall_viiidii(a,c,d,e,k,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiif:function(a,c,d,e,k){try{b.dynCall_viiif(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiifiii:function(a, -c,d,e,k,f,h,n){try{b.dynCall_viiifiii(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiii:function(a,c,d,e,k){try{b.dynCall_viiii(a,c,d,e,k)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},invoke_viiiid:function(a,c,d,e,k,f){try{b.dynCall_viiiid(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiidi:function(a,c,d,e,k,f,h){try{b.dynCall_viiiidi(a,c,d,e,k,f,h)}catch(n){if("number"!== -typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiiidiii:function(a,c,d,e,k,f,h,n,m){try{b.dynCall_viiiidiii(a,c,d,e,k,f,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiii:function(a,c,d,e,k,f){try{b.dynCall_viiiii(a,c,d,e,k,f)}catch(x){if("number"!==typeof x&&"longjmp"!==x)throw x;b.setThrew(1,0)}},invoke_viiiiidi:function(a,c,d,e,k,f,h,n){try{b.dynCall_viiiiidi(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1, -0)}},invoke_viiiiifi:function(a,c,d,e,k,f,h,n){try{b.dynCall_viiiiifi(a,c,d,e,k,f,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiiiii:function(a,c,d,e,k,f,h){try{b.dynCall_viiiiii(a,c,d,e,k,f,h)}catch(n){if("number"!==typeof n&&"longjmp"!==n)throw n;b.setThrew(1,0)}},invoke_viiiiiiddi:function(a,c,d,e,f,l,h,n,m,u){try{b.dynCall_viiiiiiddi(a,c,d,e,f,l,h,n,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viiiiiidi:function(a, -c,d,e,f,l,h,n,m){try{b.dynCall_viiiiiidi(a,c,d,e,f,l,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiiiii:function(a,c,d,e,f,l,h,n){try{b.dynCall_viiiiiii(a,c,d,e,f,l,h,n)}catch(z){if("number"!==typeof z&&"longjmp"!==z)throw z;b.setThrew(1,0)}},invoke_viiiiiiiddi:function(a,c,d,e,f,l,h,n,m,u,w){try{b.dynCall_viiiiiiiddi(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiii:function(a,c,d,e,f,l,h, -n,m){try{b.dynCall_viiiiiiii(a,c,d,e,f,l,h,n,m)}catch(u){if("number"!==typeof u&&"longjmp"!==u)throw u;b.setThrew(1,0)}},invoke_viiiiiiiifi:function(a,c,d,e,f,l,h,n,m,u,w){try{b.dynCall_viiiiiiiifi(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiiii:function(a,c,d,e,f,l,h,n,m,u){try{b.dynCall_viiiiiiiii(a,c,d,e,f,l,h,n,m,u)}catch(w){if("number"!==typeof w&&"longjmp"!==w)throw w;b.setThrew(1,0)}},invoke_viiiiiiiiii:function(a,c,d,e,f,l, -h,n,m,u,w){try{b.dynCall_viiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w)}catch(J){if("number"!==typeof J&&"longjmp"!==J)throw J;b.setThrew(1,0)}},invoke_viiiiiiiiiiddi:function(a,c,d,e,f,l,h,n,m,u,w,q,p,r){try{b.dynCall_viiiiiiiiiiddi(a,c,d,e,f,l,h,n,m,u,w,q,p,r)}catch(Q){if("number"!==typeof Q&&"longjmp"!==Q)throw Q;b.setThrew(1,0)}},invoke_viiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q){try{b.dynCall_viiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q)}catch(ma){if("number"!==typeof ma&&"longjmp"!==ma)throw ma;b.setThrew(1, -0)}},invoke_viiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q,p){try{b.dynCall_viiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q,p)}catch(ca){if("number"!==typeof ca&&"longjmp"!==ca)throw ca;b.setThrew(1,0)}},invoke_viiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,w,q,p,r){try{b.dynCall_viiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,w,q,p,r)}catch(Q){if("number"!==typeof Q&&"longjmp"!==Q)throw Q;b.setThrew(1,0)}},invoke_viiiiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y){try{b.dynCall_viiiiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u, -q,p,r,t,v,y)}catch(M){if("number"!==typeof M&&"longjmp"!==M)throw M;b.setThrew(1,0)}},invoke_viiiiiiiiiiiiiiii:function(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y,M){try{b.dynCall_viiiiiiiiiiiiiiii(a,c,d,e,f,l,h,n,m,u,q,p,r,t,v,y,M)}catch(cc){if("number"!==typeof cc&&"longjmp"!==cc)throw cc;b.setThrew(1,0)}},invoke_vij:function(a,c,d,e){try{b.dynCall_vij(a,c,d,e)}catch(k){if("number"!==typeof k&&"longjmp"!==k)throw k;b.setThrew(1,0)}},_DMImage_Save:function(){b.printErr("missing function: DMImage_Save");E(-1)}, -__ZSt18uncaught_exceptionv:xa,___assert_fail:function(a,b,d,e){E("Assertion failed: "+N(a)+", at: "+[b?N(b):"unknown filename",d,e?N(e):"unknown function"])},___cxa_allocate_exception:function(a){return da(a)},___cxa_begin_catch:function(a){var b=X[a];b&&!b.La&&(b.La=!0,xa.u--);b&&(b.oa=!1);ub.push(a);(b=wc(a))&&X[b].X++;return a},___cxa_call_unexpected:function(a){b.printErr("Unexpected exception thrown, this is not properly supported - aborting");Wa=!0;throw a;},___cxa_end_catch:function(){b.setThrew(0); -var a=ub.pop();if(a){if(a=wc(a)){var c=X[a];O(0>2]=c.position;c.wa&&0===e&&0===f&&(c.wa=null);return 0}catch(x){return"undefined"!==typeof ja&&x instanceof -q||E(x),-x.J}},___syscall145:function(a,b){S=b;try{var c=za(),e=D();a:{var d=D();for(b=a=0;b>2],h=c,n=p[e+8*b>>2],r=f,u=void 0,w=P;if(0>r||0>u)throw new q(m.m);if(1===(h.flags&2097155))throw new q(m.ea);if(16384===(h.node.mode&61440))throw new q(m.ga);if(!h.g.read)throw new q(m.m);var t="undefined"!==typeof u;if(!t)u=h.position;else if(!h.seekable)throw new q(m.ha);var v=h.g.read(h,w,n,r,u);t||(h.position+=v);h=v;if(0>h){var y=-1;break a}a+=h;if(h>2],n=p[e+(8*b+4)>>2],r=P,u=void 0;if(0>n||0>u)throw new q(m.m);if(0===(f.flags&2097155))throw new q(m.ea);if(16384===(f.node.mode&61440))throw new q(m.ga);if(!f.g.write)throw new q(m.m);f.flags&1024&&Kc(f,0,2);var w="undefined"!==typeof u;if(!w)u=f.position;else if(!f.seekable)throw new q(m.ha);var t=f.g.write(f,r,h,n,u,void 0);w||(f.position+=t);try{if(f.path&& -hb.onWriteToFile)hb.onWriteToFile(f.path)}catch(ca){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+ca.message)}f=t;if(0>f){var v=-1;break a}a+=f}v=a}return v}catch(ca){return"undefined"!==typeof ja&&ca instanceof q||E(ca),-ca.J}},___syscall20:function(a,b){S=b;return 42},___syscall221:function(a,b){S=b;try{var c=za();switch(D()){case 0:var e=D();return 0>e?-m.m:Ma(c.path,c.flags,0,e).fd;case 1:case 2:return 0;case 3:return c.flags;case 4:return e=D(),c.flags|= -e,0;case 12:case 12:return e=D(),Ha[e+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-m.m;case 9:return Jb(m.m),-1;default:return-m.m}}catch(k){return"undefined"!==typeof ja&&k instanceof q||E(k),-k.J}},___syscall5:function(a,b){S=b;try{var c=N(D()),e=D(),d=D();return Ma(c,e,d).fd}catch(l){return"undefined"!==typeof ja&&l instanceof q||E(l),-l.J}},___syscall54:function(a,b){S=b;try{var c=za(),e=D();switch(e){case 21509:case 21505:return c.tty?0:-m.T;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return c.tty? -0:-m.T;case 21519:if(!c.tty)return-m.T;var d=D();return p[d>>2]=0;case 21520:return c.tty?-m.m:-m.T;case 21531:a=D();if(!c.g.jb)throw new q(m.T);return c.g.jb(c,e,a);case 21523:return c.tty?0:-m.T;default:E("bad ioctl syscall "+e)}}catch(l){return"undefined"!==typeof ja&&l instanceof q||E(l),-l.J}},___syscall6:function(a,b){S=b;try{var c=za();Jc(c);return 0}catch(e){return"undefined"!==typeof ja&&e instanceof q||E(e),-e.J}},___syscall85:function(a,b){S=b;try{var c=N(D()),e=D(),d=D();if(0>=d)var f= --m.m;else{var h=Bc(c),n=Math.min(d,wa(h)),p=P[e+n];Z(h,I,e,d+1);P[e+n]=p;f=n}return f}catch(u){return"undefined"!==typeof ja&&u instanceof q||E(u),-u.J}},___syscall91:function(a,b){S=b;try{var c=D(),e=D(),d=bd[c];if(!d)return 0;if(e===d.Bd){var f=la[d.fd],h=d.flags,n=new Uint8Array(I.subarray(c,c+e));f&&f.g.na&&f.g.na(f,n,0,e,h);bd[c]=null;d.Za&&R(d.Cd)}return 0}catch(z){return"undefined"!==typeof ja&&z instanceof q||E(z),-z.J}},___unlock:function(){},__embind_register_bool:function(a,b,d,e,f){var c= -Tb(d);b=T(b);ga(a,{name:b,fromWireType:function(a){return!!a},toWireType:function(a,b){return b?e:f},argPackAdvance:8,readValueFromPointer:function(a){if(1===d)var e=P;else if(2===d)e=Ha;else if(4===d)e=p;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(e[a>>c])},I:null})},__embind_register_class:function(a,b,d,e,f,h,m,n,q,u,p,r,t){p=T(p);h=Ea(f,h);n&&(n=Ea(m,n));u&&(u=Ea(q,u));t=Ea(r,t);var c=Ub(p);yd(c,function(){$b("Cannot construct "+p+" due to unbound types", -[e])});Oa([a,b,d],e?[e]:[],function(b){b=b[0];if(e)var d=b.i,f=d.V;else f=na.prototype;b=Vb(c,function(){if(Object.getPrototypeOf(this)!==g)throw new Aa("Use 'new' to construct "+p);if(void 0===k.P)throw new Aa(p+" has no accessible constructor");var a=k.P[arguments.length];if(void 0===a)throw new Aa("Tried to invoke ctor of "+p+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(k.P).toString()+") parameters instead!");return a.apply(this,arguments)});var g=Object.create(f, -{constructor:{value:b}});b.prototype=g;var k=new zd(p,b,g,t,d,h,n,u),d=new ha(p,k,!0,!1,!1),f=new ha(p+"*",k,!1,!1,!1),l=new ha(p+" const*",k,!1,!0,!1);cd[a]={pointerType:f,bb:l};Ed(c,b);return[d,f,l]})},__embind_register_class_constructor:function(a,b,d,e,f,h){var c=Sc(b,d);f=Ea(e,f);Oa([],[a],function(a){a=a[0];var e="constructor "+a.name;void 0===a.i.P&&(a.i.P=[]);if(void 0!==a.i.P[b-1])throw new Aa("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+ -a.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");a.i.P[b-1]=function(){$b("Cannot construct "+a.name+" due to unbound types",c)};Oa([],c,function(c){a.i.P[b-1]=function(){arguments.length!==b-1&&A(e+" called with "+arguments.length+" arguments, expected "+(b-1));var a=[],d=Array(b);d[0]=h;for(var g=1;gn&&A("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var p=null!==c[1]&&null!==k,q=!1,k=1;k>>k};var h=-1!=b.indexOf("unsigned");ga(a,{name:b,fromWireType:c,toWireType:function(a,c){if("number"!==typeof c&& -"boolean"!==typeof c)throw new TypeError('Cannot convert "'+Da(c)+'" to '+this.name);if(cf)throw new TypeError('Passing a number "'+Da(c)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?c>>>0:c|0},argPackAdvance:8,readValueFromPointer:Jd(b,g,0!==e),I:null})},__embind_register_memory_view:function(a,b,d){function c(a){a>>=2;var b=ea;return new f(b.buffer,b[a+1],b[a])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array, -Uint32Array,Float32Array,Float64Array][b];d=T(d);ga(a,{name:d,fromWireType:c,argPackAdvance:8,readValueFromPointer:c},{ib:!0})},__embind_register_std_string:function(a,b){b=T(b);ga(a,{name:b,fromWireType:function(a){for(var b=ea[a>>2],c=Array(b),d=0;d>2]=f;for(var h=0;h>2],e=Array(d),g=a+4>>f,h=0;h>2]=g;for(var k=h+4>>f,l=0;l>2],d=p[a+4>>2],e=p[a+8>>2],f=p[a+12>>2];Z("Sun Mon Tue Wed Thu Fri Sat".split(" ")[p[a+24>>2]]+" "+"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")[p[a+16>>2]]+(10>f?" ":" ")+f+(10>e?" 0":" ")+e+(10>d?":0":":")+d+(10>b?":0":":")+b+" "+(1900+p[a+20>>2])+"\n",I,dd,26);return dd},_clock:mb,_emscripten_memcpy_big:function(a,b,d){I.set(I.subarray(b,b+d),a);return a},_emscripten_run_script_string:Y,_getenv:Ta,_llvm_eh_typeid_for:function(a){return a}, -_llvm_exp2_f64:function(){return Md.apply(null,arguments)},_llvm_trap:function(){E("trap!")},_localtime:function(a){Uc();a=new Date(1E3*p[a>>2]);p[V>>2]=a.getSeconds();p[V+4>>2]=a.getMinutes();p[V+8>>2]=a.getHours();p[V+12>>2]=a.getDate();p[V+16>>2]=a.getMonth();p[V+20>>2]=a.getFullYear()-1900;p[V+24>>2]=a.getDay();var b=new Date(a.getFullYear(),0,1);p[V+28>>2]=(a.getTime()-b.getTime())/864E5|0;p[V+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(2E3,6,1)).getTimezoneOffset(),b=b.getTimezoneOffset(); -a=(d!=b&&a.getTimezoneOffset()==Math.min(b,d))|0;p[V+32>>2]=a;p[V+40>>2]=p[Sa+(a?4:0)>>2];return V},_mktime:function(a){Uc();var b=new Date(p[a+20>>2]+1900,p[a+16>>2],p[a+12>>2],p[a+8>>2],p[a+4>>2],p[a>>2],0),d=p[a+32>>2],e=b.getTimezoneOffset(),f=new Date(b.getFullYear(),0,1),h=(new Date(2E3,6,1)).getTimezoneOffset(),m=f.getTimezoneOffset(),n=Math.min(m,h);0>d?p[a+32>>2]=Number(h!=m&&n==e):0>2]=b.getDay();p[a+28>>2]=(b.getTime()- -f.getTime())/864E5|0;return b.getTime()/1E3|0},_nanosleep:function(a,b){var c=p[a>>2];a=p[a+4>>2];0!==b&&(p[b>>2]=0,p[b+4>>2]=0);return Wc(1E6*c+a/1E3)},_pthread_cond_wait:function(){return 0},_pthread_detach:function(){},_pthread_getspecific:function(a){return wb[a]||0},_pthread_key_create:function(a){if(0==a)return m.m;p[a>>2]=oc;wb[oc]=0;oc++;return 0},_pthread_mutex_destroy:function(){},_pthread_mutex_init:function(){},_pthread_mutexattr_destroy:function(){},_pthread_mutexattr_init:function(){}, -_pthread_mutexattr_settype:function(){},_pthread_once:Ua,_pthread_setspecific:function(a,b){if(!(a in wb))return m.m;wb[a]=b;return 0},_pthread_spin_destroy:function(){return 0},_pthread_spin_init:function(){return 0},_pthread_spin_lock:function(){return 0},_pthread_spin_unlock:function(){return 0},_sem_close:function(){b.printErr("missing function: sem_close");E(-1)},_sem_destroy:function(){},_sem_open:function(){b.printErr("missing function: sem_open");E(-1)},_sem_post:function(){},_sem_trywait:function(){}, -_sem_unlink:function(){b.printErr("missing function: sem_unlink");E(-1)},_strftime:Xc,_strftime_l:function(a,b,d,e){return Xc(a,b,d,e)},_time:function(a){var b=Date.now()/1E3|0;a&&(p[a>>2]=b);return b},_usleep:Wc,DYNAMICTOP_PTR:aa,STACKTOP:tb};var kd=b.asm(b.$a,b.ab,L);b.asm=kd;var Pd=b.__GLOBAL__I_000101=function(){return b.asm.__GLOBAL__I_000101.apply(null,arguments)},Ke=b.__GLOBAL__sub_I_AztecReader_cpp=function(){return b.asm.__GLOBAL__sub_I_AztecReader_cpp.apply(null,arguments)},Qe=b.__GLOBAL__sub_I_BarcodeLocationOnSite_cpp= -function(){return b.asm.__GLOBAL__sub_I_BarcodeLocationOnSite_cpp.apply(null,arguments)},$e=b.__GLOBAL__sub_I_BarcodeLocation_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeLocation_cpp.apply(null,arguments)},Rd=b.__GLOBAL__sub_I_BarcodeReaderCore_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeReaderCore_cpp.apply(null,arguments)},Td=b.__GLOBAL__sub_I_BarcodeReaderInner_cpp=function(){return b.asm.__GLOBAL__sub_I_BarcodeReaderInner_cpp.apply(null,arguments)},af=b.__GLOBAL__sub_I_CharacterSetECI_cpp= -function(){return b.asm.__GLOBAL__sub_I_CharacterSetECI_cpp.apply(null,arguments)},Ge=b.__GLOBAL__sub_I_CodaBarReader_cpp=function(){return b.asm.__GLOBAL__sub_I_CodaBarReader_cpp.apply(null,arguments)},Fe=b.__GLOBAL__sub_I_Code128Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code128Reader_cpp.apply(null,arguments)},Ee=b.__GLOBAL__sub_I_Code39Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code39Reader_cpp.apply(null,arguments)},De=b.__GLOBAL__sub_I_Code93Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Code93Reader_cpp.apply(null, -arguments)},ee=b.__GLOBAL__sub_I_Common_cpp=function(){return b.asm.__GLOBAL__sub_I_Common_cpp.apply(null,arguments)},Pe=b.__GLOBAL__sub_I_CropImage_cpp=function(){return b.asm.__GLOBAL__sub_I_CropImage_cpp.apply(null,arguments)},Sd=b.__GLOBAL__sub_I_DMBarcodeDecoder_cpp=function(){return b.asm.__GLOBAL__sub_I_DMBarcodeDecoder_cpp.apply(null,arguments)},Wd=b.__GLOBAL__sub_I_DMFindlineByContours_cpp=function(){return b.asm.__GLOBAL__sub_I_DMFindlineByContours_cpp.apply(null,arguments)},Xd=b.__GLOBAL__sub_I_DMFindline_cpp= -function(){return b.asm.__GLOBAL__sub_I_DMFindline_cpp.apply(null,arguments)},de=b.__GLOBAL__sub_I_DMLicenseInfo_cpp=function(){return b.asm.__GLOBAL__sub_I_DMLicenseInfo_cpp.apply(null,arguments)},se=b.__GLOBAL__sub_I_DMLog_cpp=function(){return b.asm.__GLOBAL__sub_I_DMLog_cpp.apply(null,arguments)},Ye=b.__GLOBAL__sub_I_DMVersion_cpp=function(){return b.asm.__GLOBAL__sub_I_DMVersion_cpp.apply(null,arguments)},Se=b.__GLOBAL__sub_I_DataMask_cpp=function(){return b.asm.__GLOBAL__sub_I_DataMask_cpp.apply(null, -arguments)},Ze=b.__GLOBAL__sub_I_DataMatrixReader_cpp=function(){return b.asm.__GLOBAL__sub_I_DataMatrixReader_cpp.apply(null,arguments)},Je=b.__GLOBAL__sub_I_Deblur_cpp=function(){return b.asm.__GLOBAL__sub_I_Deblur_cpp.apply(null,arguments)},Vd=b.__GLOBAL__sub_I_DecodeInner_cpp=function(){return b.asm.__GLOBAL__sub_I_DecodeInner_cpp.apply(null,arguments)},ke=b.__GLOBAL__sub_I_DynamsoftBarcodeReader_wasm_cpp=function(){return b.asm.__GLOBAL__sub_I_DynamsoftBarcodeReader_wasm_cpp.apply(null,arguments)}, -Ce=b.__GLOBAL__sub_I_EAN13Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_EAN13Reader_cpp.apply(null,arguments)},Be=b.__GLOBAL__sub_I_EAN8Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_EAN8Reader_cpp.apply(null,arguments)},ye=b.__GLOBAL__sub_I_ErrorCorrectionLevel_cpp=function(){return b.asm.__GLOBAL__sub_I_ErrorCorrectionLevel_cpp.apply(null,arguments)},Oe=b.__GLOBAL__sub_I_FindBound_cpp=function(){return b.asm.__GLOBAL__sub_I_FindBound_cpp.apply(null,arguments)},Ne=b.__GLOBAL__sub_I_Fluctuation_cpp= -function(){return b.asm.__GLOBAL__sub_I_Fluctuation_cpp.apply(null,arguments)},ce=b.__GLOBAL__sub_I_FormatParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_FormatParameters_cpp.apply(null,arguments)},Re=b.__GLOBAL__sub_I_GenericGF_cpp=function(){return b.asm.__GLOBAL__sub_I_GenericGF_cpp.apply(null,arguments)},be=b.__GLOBAL__sub_I_GlobalParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_GlobalParameters_cpp.apply(null,arguments)},Ae=b.__GLOBAL__sub_I_ITFReader_cpp=function(){return b.asm.__GLOBAL__sub_I_ITFReader_cpp.apply(null, -arguments)},ae=b.__GLOBAL__sub_I_ImageParameters_cpp=function(){return b.asm.__GLOBAL__sub_I_ImageParameters_cpp.apply(null,arguments)},Ie=b.__GLOBAL__sub_I_Industry2of5Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Industry2of5Reader_cpp.apply(null,arguments)},qe=b.__GLOBAL__sub_I_JsonParser_cpp=function(){return b.asm.__GLOBAL__sub_I_JsonParser_cpp.apply(null,arguments)},Qd=b.__GLOBAL__sub_I_JsonReader_cpp=function(){return b.asm.__GLOBAL__sub_I_JsonReader_cpp.apply(null,arguments)},Me=b.__GLOBAL__sub_I_LineStatistics_cpp= -function(){return b.asm.__GLOBAL__sub_I_LineStatistics_cpp.apply(null,arguments)},$d=b.__GLOBAL__sub_I_LogParamUtil_cpp=function(){return b.asm.__GLOBAL__sub_I_LogParamUtil_cpp.apply(null,arguments)},ge=b.__GLOBAL__sub_I_Mode_cpp=function(){return b.asm.__GLOBAL__sub_I_Mode_cpp.apply(null,arguments)},Ue=b.__GLOBAL__sub_I_ModulusGF_cpp=function(){return b.asm.__GLOBAL__sub_I_ModulusGF_cpp.apply(null,arguments)},hf=b.__GLOBAL__sub_I_MultiFormatOneDReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatOneDReader_cpp.apply(null, -arguments)},Ud=b.__GLOBAL__sub_I_MultiFormatReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatReader_cpp.apply(null,arguments)},gf=b.__GLOBAL__sub_I_MultiFormatUPCEANReader_cpp=function(){return b.asm.__GLOBAL__sub_I_MultiFormatUPCEANReader_cpp.apply(null,arguments)},ff=b.__GLOBAL__sub_I_OneDReader_cpp=function(){return b.asm.__GLOBAL__sub_I_OneDReader_cpp.apply(null,arguments)},xe=b.__GLOBAL__sub_I_OneD_StandardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_OneD_StandardLization_cpp.apply(null, -arguments)},We=b.__GLOBAL__sub_I_PDF417CodewordDecoder_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417CodewordDecoder_cpp.apply(null,arguments)},Ve=b.__GLOBAL__sub_I_PDF417DecodedBitStreamParser_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417DecodedBitStreamParser_cpp.apply(null,arguments)},Xe=b.__GLOBAL__sub_I_PDF417Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417Reader_cpp.apply(null,arguments)},He=b.__GLOBAL__sub_I_PDF417_Deblur_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417_Deblur_cpp.apply(null, -arguments)},we=b.__GLOBAL__sub_I_PDF417_standardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_PDF417_standardLization_cpp.apply(null,arguments)},Zd=b.__GLOBAL__sub_I_ParameterPool_cpp=function(){return b.asm.__GLOBAL__sub_I_ParameterPool_cpp.apply(null,arguments)},Le=b.__GLOBAL__sub_I_QRBarcodeLocation_cpp=function(){return b.asm.__GLOBAL__sub_I_QRBarcodeLocation_cpp.apply(null,arguments)},Te=b.__GLOBAL__sub_I_QRCodeReader_cpp=function(){return b.asm.__GLOBAL__sub_I_QRCodeReader_cpp.apply(null, -arguments)},fe=b.__GLOBAL__sub_I_QRVersion_cpp=function(){return b.asm.__GLOBAL__sub_I_QRVersion_cpp.apply(null,arguments)},ve=b.__GLOBAL__sub_I_QR_StandardLization_cpp=function(){return b.asm.__GLOBAL__sub_I_QR_StandardLization_cpp.apply(null,arguments)},bf=b.__GLOBAL__sub_I_Reader_cpp=function(){return b.asm.__GLOBAL__sub_I_Reader_cpp.apply(null,arguments)},Yd=b.__GLOBAL__sub_I_RegionDefinition_cpp=function(){return b.asm.__GLOBAL__sub_I_RegionDefinition_cpp.apply(null,arguments)},ze=b.__GLOBAL__sub_I_RestoreColor_cpp= -function(){return b.asm.__GLOBAL__sub_I_RestoreColor_cpp.apply(null,arguments)},ue=b.__GLOBAL__sub_I_TextFilter_cpp=function(){return b.asm.__GLOBAL__sub_I_TextFilter_cpp.apply(null,arguments)},ef=b.__GLOBAL__sub_I_UPCAReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCAReader_cpp.apply(null,arguments)},df=b.__GLOBAL__sub_I_UPCEANReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCEANReader_cpp.apply(null,arguments)},cf=b.__GLOBAL__sub_I_UPCEReader_cpp=function(){return b.asm.__GLOBAL__sub_I_UPCEReader_cpp.apply(null, -arguments)},je=b.__GLOBAL__sub_I_bind_cpp=function(){return b.asm.__GLOBAL__sub_I_bind_cpp.apply(null,arguments)},oe=b.__GLOBAL__sub_I_clahe_cpp=function(){return b.asm.__GLOBAL__sub_I_clahe_cpp.apply(null,arguments)},re=b.__GLOBAL__sub_I_dsGlobalMem_cpp=function(){return b.asm.__GLOBAL__sub_I_dsGlobalMem_cpp.apply(null,arguments)},ne=b.__GLOBAL__sub_I_generalized_hough_cpp=function(){return b.asm.__GLOBAL__sub_I_generalized_hough_cpp.apply(null,arguments)},me=b.__GLOBAL__sub_I_histogram_cpp=function(){return b.asm.__GLOBAL__sub_I_histogram_cpp.apply(null, -arguments)},le=b.__GLOBAL__sub_I_imgwarp_cpp=function(){return b.asm.__GLOBAL__sub_I_imgwarp_cpp.apply(null,arguments)},ie=b.__GLOBAL__sub_I_iostream_cpp=function(){return b.asm.__GLOBAL__sub_I_iostream_cpp.apply(null,arguments)},te=b.__GLOBAL__sub_I_json_value_cpp=function(){return b.asm.__GLOBAL__sub_I_json_value_cpp.apply(null,arguments)},he=b.__GLOBAL__sub_I_persistence_cpp=function(){return b.asm.__GLOBAL__sub_I_persistence_cpp.apply(null,arguments)},pe=b.__GLOBAL__sub_I_system_cpp=function(){return b.asm.__GLOBAL__sub_I_system_cpp.apply(null, -arguments)};b.___cxa_can_catch=function(){return b.asm.___cxa_can_catch.apply(null,arguments)};b.___cxa_is_pointer_type=function(){return b.asm.___cxa_is_pointer_type.apply(null,arguments)};b.___errno_location=function(){return b.asm.___errno_location.apply(null,arguments)};var Gd=b.___getTypeName=function(){return b.asm.___getTypeName.apply(null,arguments)},Od=b._emscripten_replace_memory=function(){return b.asm._emscripten_replace_memory.apply(null,arguments)},R=b._free=function(){return b.asm._free.apply(null, -arguments)},da=b._malloc=function(){return b.asm._malloc.apply(null,arguments)},ab=b.setTempRet0=function(){return b.asm.setTempRet0.apply(null,arguments)};b.setThrew=function(){return b.asm.setThrew.apply(null,arguments)};var ld=b.stackAlloc=function(){return b.asm.stackAlloc.apply(null,arguments)};b.dynCall_di=function(){return b.asm.dynCall_di.apply(null,arguments)};b.dynCall_dii=function(){return b.asm.dynCall_dii.apply(null,arguments)};b.dynCall_diiid=function(){return b.asm.dynCall_diiid.apply(null, -arguments)};b.dynCall_diiii=function(){return b.asm.dynCall_diiii.apply(null,arguments)};b.dynCall_fi=function(){return b.asm.dynCall_fi.apply(null,arguments)};b.dynCall_fii=function(){return b.asm.dynCall_fii.apply(null,arguments)};b.dynCall_fiifffi=function(){return b.asm.dynCall_fiifffi.apply(null,arguments)};b.dynCall_fiii=function(){return b.asm.dynCall_fiii.apply(null,arguments)};b.dynCall_i=function(){return b.asm.dynCall_i.apply(null,arguments)};b.dynCall_idd=function(){return b.asm.dynCall_idd.apply(null, -arguments)};b.dynCall_ii=function(){return b.asm.dynCall_ii.apply(null,arguments)};b.dynCall_iid=function(){return b.asm.dynCall_iid.apply(null,arguments)};b.dynCall_iififi=function(){return b.asm.dynCall_iififi.apply(null,arguments)};b.dynCall_iii=function(){return b.asm.dynCall_iii.apply(null,arguments)};b.dynCall_iiifii=function(){return b.asm.dynCall_iiifii.apply(null,arguments)};b.dynCall_iiifiiiiiii=function(){return b.asm.dynCall_iiifiiiiiii.apply(null,arguments)};b.dynCall_iiii=function(){return b.asm.dynCall_iiii.apply(null, -arguments)};b.dynCall_iiiidi=function(){return b.asm.dynCall_iiiidi.apply(null,arguments)};b.dynCall_iiiii=function(){return b.asm.dynCall_iiiii.apply(null,arguments)};b.dynCall_iiiiid=function(){return b.asm.dynCall_iiiiid.apply(null,arguments)};b.dynCall_iiiiifi=function(){return b.asm.dynCall_iiiiifi.apply(null,arguments)};b.dynCall_iiiiii=function(){return b.asm.dynCall_iiiiii.apply(null,arguments)};b.dynCall_iiiiiid=function(){return b.asm.dynCall_iiiiiid.apply(null,arguments)};b.dynCall_iiiiiii= -function(){return b.asm.dynCall_iiiiiii.apply(null,arguments)};b.dynCall_iiiiiiii=function(){return b.asm.dynCall_iiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiif=function(){return b.asm.dynCall_iiiiiiiif.apply(null,arguments)};b.dynCall_iiiiiiiii=function(){return b.asm.dynCall_iiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiiiiiii= -function(){return b.asm.dynCall_iiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiiiiiiiiiiiiiii=function(){return b.asm.dynCall_iiiiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_iiiiij=function(){return b.asm.dynCall_iiiiij.apply(null,arguments)};b.dynCall_ji=function(){return b.asm.dynCall_ji.apply(null,arguments)};b.dynCall_v=function(){return b.asm.dynCall_v.apply(null,arguments)};b.dynCall_vi=function(){return b.asm.dynCall_vi.apply(null,arguments)};b.dynCall_vid=function(){return b.asm.dynCall_vid.apply(null, -arguments)};b.dynCall_vidii=function(){return b.asm.dynCall_vidii.apply(null,arguments)};b.dynCall_vif=function(){return b.asm.dynCall_vif.apply(null,arguments)};b.dynCall_viffffffff=function(){return b.asm.dynCall_viffffffff.apply(null,arguments)};b.dynCall_viffffffffffffffff=function(){return b.asm.dynCall_viffffffffffffffff.apply(null,arguments)};b.dynCall_vii=function(){return b.asm.dynCall_vii.apply(null,arguments)};b.dynCall_viid=function(){return b.asm.dynCall_viid.apply(null,arguments)};b.dynCall_viiddi= -function(){return b.asm.dynCall_viiddi.apply(null,arguments)};b.dynCall_viidi=function(){return b.asm.dynCall_viidi.apply(null,arguments)};b.dynCall_viididii=function(){return b.asm.dynCall_viididii.apply(null,arguments)};b.dynCall_viif=function(){return b.asm.dynCall_viif.apply(null,arguments)};b.dynCall_viiffff=function(){return b.asm.dynCall_viiffff.apply(null,arguments)};b.dynCall_viiffi=function(){return b.asm.dynCall_viiffi.apply(null,arguments)};b.dynCall_viifi=function(){return b.asm.dynCall_viifi.apply(null, -arguments)};b.dynCall_viifii=function(){return b.asm.dynCall_viifii.apply(null,arguments)};b.dynCall_viifiif=function(){return b.asm.dynCall_viifiif.apply(null,arguments)};b.dynCall_viii=function(){return b.asm.dynCall_viii.apply(null,arguments)};b.dynCall_viiid=function(){return b.asm.dynCall_viiid.apply(null,arguments)};b.dynCall_viiidd=function(){return b.asm.dynCall_viiidd.apply(null,arguments)};b.dynCall_viiiddi=function(){return b.asm.dynCall_viiiddi.apply(null,arguments)};b.dynCall_viiidi= -function(){return b.asm.dynCall_viiidi.apply(null,arguments)};b.dynCall_viiidii=function(){return b.asm.dynCall_viiidii.apply(null,arguments)};b.dynCall_viiif=function(){return b.asm.dynCall_viiif.apply(null,arguments)};b.dynCall_viiifiii=function(){return b.asm.dynCall_viiifiii.apply(null,arguments)};b.dynCall_viiii=function(){return b.asm.dynCall_viiii.apply(null,arguments)};b.dynCall_viiiid=function(){return b.asm.dynCall_viiiid.apply(null,arguments)};b.dynCall_viiiidi=function(){return b.asm.dynCall_viiiidi.apply(null, -arguments)};b.dynCall_viiiidiii=function(){return b.asm.dynCall_viiiidiii.apply(null,arguments)};b.dynCall_viiiii=function(){return b.asm.dynCall_viiiii.apply(null,arguments)};b.dynCall_viiiiidi=function(){return b.asm.dynCall_viiiiidi.apply(null,arguments)};b.dynCall_viiiiifi=function(){return b.asm.dynCall_viiiiifi.apply(null,arguments)};b.dynCall_viiiiii=function(){return b.asm.dynCall_viiiiii.apply(null,arguments)};b.dynCall_viiiiiiddi=function(){return b.asm.dynCall_viiiiiiddi.apply(null,arguments)}; -b.dynCall_viiiiiidi=function(){return b.asm.dynCall_viiiiiidi.apply(null,arguments)};b.dynCall_viiiiiii=function(){return b.asm.dynCall_viiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiddi=function(){return b.asm.dynCall_viiiiiiiddi.apply(null,arguments)};b.dynCall_viiiiiiii=function(){return b.asm.dynCall_viiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiifi=function(){return b.asm.dynCall_viiiiiiiifi.apply(null,arguments)};b.dynCall_viiiiiiiii=function(){return b.asm.dynCall_viiiiiiiii.apply(null, -arguments)};b.dynCall_viiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiddi=function(){return b.asm.dynCall_viiiiiiiiiiddi.apply(null,arguments)};b.dynCall_viiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiiiii= -function(){return b.asm.dynCall_viiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viiiiiiiiiiiiiiii=function(){return b.asm.dynCall_viiiiiiiiiiiiiiii.apply(null,arguments)};b.dynCall_viijii=function(){return b.asm.dynCall_viijii.apply(null,arguments)};b.dynCall_vij=function(){return b.asm.dynCall_vij.apply(null,arguments)};b.asm=kd;Va.prototype=Error();Va.prototype.constructor=Va;Ya=function c(){b.calledRun||dc();b.calledRun||(Ya=c)};b.run=dc;b.exit=function(c,d){if(!d||!b.noExitRuntime||0!==c){if(!b.noExitRuntime&& -(Wa=!0,tb=void 0,Ia(mc),b.onExit))b.onExit(c);ia&&process.exit(c);b.quit(c,new Va(c))}};b.abort=E;if(b.preInit)for("function"==typeof b.preInit&&(b.preInit=[b.preInit]);0this._markerClusterer.getMaxZoom()){this._clusterMarker&&this._map.removeOverlay(this._clusterMarker);for(var marker,i=0;marker=this._markers[i];i++)this._map.addOverlay(marker)}else{if(this._markers.lengthTextIconOverlay, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ - - -/** - * @namespace BMap的所有library类均放在BMapLib命名空间下 - */ -var BMapLib = window.BMapLib = BMapLib || {}; - -(function () { - - /** - * 声明baidu包 - */ - var T, - baidu = T = baidu || {version: "1.3.8"}; - - (function (){ - //提出guid,防止在与老版本Tangram混用时 - //在下一行错误的修改window[undefined] - baidu.guid = "$BAIDU$"; - - //Tangram可能被放在闭包中 - //一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = window[baidu.guid] || {}; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @shortcut g,T.G - * @meta standard - * @see baidu.dom.q - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - // 声明快捷方法 - baidu.g = baidu.G = baidu.dom.g; - - /** - * 获取目标元素所属的document对象 - * @name baidu.dom.getDocument - * @function - * @grammar baidu.dom.getDocument(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * @see baidu.dom.getWindow - * - * @returns {HTMLDocument} 目标元素所属的document对象 - */ - baidu.dom.getDocument = function (element) { - element = baidu.dom.g(element); - return element.nodeType == 9 ? element : element.ownerDocument || element.document; - }; - - /** - * @ignore - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - */ - baidu.lang = baidu.lang || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - // 声明快捷方法 - baidu.isString = baidu.lang.isString; - - /** - * 从文档中获取指定的DOM元素 - * **内部方法** - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - // 声明快捷方法 - baidu._g = baidu.dom._g; - - /** - * @ignore - * @namespace baidu.browser 判断浏览器类型和特性的属性。 - */ - baidu.browser = baidu.browser || {}; - - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241']; - } - - /** - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE) - * - * @author berg - * @name baidu.dom.getComputedStyle - * @function - * @grammar baidu.dom.getComputedStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * - * @see baidu.dom.getStyle - * - * @returns {string} 目标元素的computed style值 - */ - - baidu.dom.getComputedStyle = function(element, key){ - element = baidu.dom._g(element); - var doc = baidu.dom.getDocument(element), - styles; - if (doc.defaultView && doc.defaultView.getComputedStyle) { - styles = doc.defaultView.getComputedStyle(element, null); - if (styles) { - return styles[key] || styles.getPropertyValue(key); - } - } - return ''; - }; - - /** - * 提供给setStyle与getStyle使用 - */ - baidu.dom._styleFixer = baidu.dom._styleFixer || {}; - - /** - * 提供给setStyle与getStyle使用 - */ - baidu.dom._styleFilter = baidu.dom._styleFilter || []; - - /** - * 为获取和设置样式的过滤器 - * @private - * @meta standard - */ - baidu.dom._styleFilter.filter = function (key, value, method) { - for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) { - if (filter = filter[method]) { - value = filter(key, value); - } - } - return value; - }; - - /** - * @ignore - * @namespace baidu.string 操作字符串的方法。 - */ - baidu.string = baidu.string || {}; - - /** - * 将目标字符串进行驼峰化处理 - * @name baidu.string.toCamelCase - * @function - * @grammar baidu.string.toCamelCase(source) - * @param {string} source 目标字符串 - * @remark - * 支持单词以“-_”分隔 - * @meta standard - * - * @returns {string} 驼峰化处理后的字符串 - */ - baidu.string.toCamelCase = function (source) { - //提前判断,提高getStyle等的效率 thanks xianwei - if (source.indexOf('-') < 0 && source.indexOf('_') < 0) { - return source; - } - return source.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }; - - /** - * 获取目标元素的样式值 - * @name baidu.dom.getStyle - * @function - * @grammar baidu.dom.getStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * @remark - * - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。
- * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。
- * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。 - * @shortcut getStyle - * @meta standard - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle - * - * @returns {string} 目标元素的样式值 - */ - baidu.dom.getStyle = function (element, key) { - var dom = baidu.dom; - - element = dom.g(element); - key = baidu.string.toCamelCase(key); - //computed style, then cascaded style, then explicitly set style. - var value = element.style[key] || - (element.currentStyle ? element.currentStyle[key] : "") || - dom.getComputedStyle(element, key); - - // 在取不到值的时候,用fixer进行修正 - if (!value) { - var fixer = dom._styleFixer[key]; - if(fixer){ - value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer); - } - } - - /* 检查结果过滤器 */ - if (fixer = dom._styleFilter) { - value = fixer.filter(key, value, 'get'); - } - - return value; - }; - - // 声明快捷方法 - baidu.getStyle = baidu.dom.getStyle; - - - if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) { - /** - * 判断是否为opera浏览器 - * @property opera opera版本号 - * @grammar baidu.browser.opera - * @meta standard - * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome - */ - baidu.browser.opera = + RegExp['\x241']; - } - - /** - * 判断是否为webkit内核 - * @property isWebkit - * @grammar baidu.browser.isWebkit - * @meta standard - * @see baidu.browser.isGecko - */ - baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent); - - /** - * 判断是否为gecko内核 - * @property isGecko - * @grammar baidu.browser.isGecko - * @meta standard - * @see baidu.browser.isWebkit - */ - baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent); - - /** - * 判断是否严格标准的渲染模式 - * @property isStrict - * @grammar baidu.browser.isStrict - * @meta standard - */ - baidu.browser.isStrict = document.compatMode == "CSS1Compat"; - - /** - * 获取目标元素相对于整个文档左上角的位置 - * @name baidu.dom.getPosition - * @function - * @grammar baidu.dom.getPosition(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * - * @returns {Object} 目标元素的位置,键值为top和left的Object。 - */ - baidu.dom.getPosition = function (element) { - element = baidu.dom.g(element); - var doc = baidu.dom.getDocument(element), - browser = baidu.browser, - getStyle = baidu.dom.getStyle, - // Gecko 1.9版本以下用getBoxObjectFor计算位置 - // 但是某些情况下是有bug的 - // 对于这些有bug的情况 - // 使用递归查找的方式 - BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 && - doc.getBoxObjectFor && - getStyle(element, 'position') == 'absolute' && - (element.style.top === '' || element.style.left === ''), - pos = {"left":0,"top":0}, - viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement, - parent, - box; - - if(element == viewport){ - return pos; - } - - if(element.getBoundingClientRect){ // IE and Gecko 1.9+ - - //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的 - //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题. - box = element.getBoundingClientRect(); - - pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft); - pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop); - - // IE会给HTML元素添加一个border,默认是medium(2px) - // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖 - // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得 - // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium - // clientTop和clientLeft不会更新 - pos.left -= doc.documentElement.clientLeft; - pos.top -= doc.documentElement.clientTop; - - var htmlDom = doc.body, - // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的 - htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')), - htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth')); - if(browser.ie && !browser.isStrict){ - pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth; - pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth; - } - } else { - // safari/opera/firefox - parent = element; - - do { - pos.left += parent.offsetLeft; - pos.top += parent.offsetTop; - - // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了 - if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') { - pos.left += doc.body.scrollLeft; - pos.top += doc.body.scrollTop; - break; - } - - parent = parent.offsetParent; - } while (parent && parent != element); - - // 对body offsetTop的修正 - if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){ - pos.top -= doc.body.offsetTop; - } - - // 计算除了body的scroll - parent = element.offsetParent; - while (parent && parent != doc.body) { - pos.left -= parent.scrollLeft; - // see https://bugs.opera.com/show_bug.cgi?id=249965 - if (!browser.opera || parent.tagName != 'TR') { - pos.top -= parent.scrollTop; - } - parent = parent.offsetParent; - } - } - - return pos; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
- 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu.dom._g(element); - - var realListener = function (ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if(filter && filter[type]){ - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - // 声明快捷方法 - baidu.on = baidu.event.on; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @name baidu.lang.guid - * @function - * @grammar baidu.lang.guid() - * @version 1.1.1 - * @meta standard - * - * @returns {String} 当前页面的唯一标识字符串 - */ - - (function(){ - //不直接使用window,可以提高3倍左右性能 - var guid = window[baidu.guid]; - - baidu.lang.guid = function() { - return "TANGRAM__" + (guid._counter ++).toString(36); - }; - - guid._counter = guid._counter || 1; - })(); - - /** - * 所有类的实例的容器 - * key为每个实例的guid - * @meta standard - */ - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @version 1.2 - * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * @meta standard - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - // chrome下,'function' == typeof /a/ 为true. - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * - * @ignore - * @class Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - * @meta standard - * @see baidu.lang.inherits,baidu.lang.Event - */ - baidu.lang.Class = function(guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function(){ - delete window[baidu.guid]._instances[this.guid]; - - for(var property in this){ - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function(){ - return "[object " + (this._className || "Object" ) + "]"; - }; - - /** - * @ignore - * @class 自定义的事件对象。 - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - - !this.__listeners && (this.__listeners = {}); - - var t = this.__listeners, id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw("nonstandard key:" + key); - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - - typeof t[type] != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (typeof handler != "undefined") { - if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode)) - || (! baidu.lang.isString(handler)) - ){ - return; - } - } - - !this.__listeners && (this.__listeners = {}); - - type.indexOf("on") != 0 && (type = "on" + type); - - var t = this.__listeners; - if (!t[type]) { - return; - } - if (typeof handler != "undefined") { - t[type][handler] && delete t[type][handler]; - } else { - for(var guid in t[type]){ - delete t[type][guid]; - } - } - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:
- myobj.onMyEvent = function(){}
- myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - - // 20100603 添加本方法的第二个参数,将 options extend到event中去传递 - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - - var i, t = this.__listeners, p = event.type; - event.target = event.target || this; - event.currentTarget = this; - - p.indexOf("on") != 0 && (p = "on" + p); - - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - - if (typeof t[p] == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - - baidu.lang.inherits = function (subClass, superClass, className) { - var key, proto, - selfProps = subClass.prototype, - clazz = new Function(); - - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - // 类名标识,兼容Class的toString,基本没用 - if ("string" == typeof className) { - proto._className = className; - } - }; - // 声明快捷方法 - baidu.inherits = baidu.lang.inherits; - })(); - - - /** - - * 图片的路径 - - * @private - * @type {String} - - */ - var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m'; - - /** - - * 图片的后缀名 - - * @private - * @type {String} - - */ - var _IMAGE_EXTENSION = 'png'; - - /** - *@exports TextIconOverlay as BMapLib.TextIconOverlay - */ - var TextIconOverlay = - /** - * TextIconOverlay - * @class 此类表示地图上的一个覆盖物,该覆盖物由文字和图标组成,从Overlay继承。文字通常是数字(0-9)或字母(A-Z ),而文字与图标之间有一定的映射关系。 - *该覆盖物适用于以下类似的场景:需要在地图上添加一系列覆盖物,这些覆盖物之间用不同的图标和文字来区分,文字可能表示了该覆盖物的某一属性值,根据该文字和一定的映射关系,自动匹配相应颜色和大小的图标。 - * - *@constructor - *@param {Point} position 表示一个经纬度坐标位置。 - *@param {String} text 表示该覆盖物显示的文字信息。 - *@param {Json Object} options 可选参数,可选项包括:
- *"styles":{Array} 一组图标风格。单个图表风格包括以下几个属性:
- * url {String} 图片的url地址。(必选)
- * size {Size} 图片的大小。(必选)
- * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值,默认偏移值为图标的中心位置。(可选)
- * offset {Size} 图片相对于可视区域的偏移值,此功能的作用等同于CSS中的background-position属性。(可选)
- * textSize {Number} 文字的大小。(可选,默认10)
- * textColor {String} 文字的颜色。(可选,默认black)
- */ - BMapLib.TextIconOverlay = function(position, text, options){ - this._position = position; - this._text = text; - this._options = options || {}; - this._styles = this._options['styles'] || []; - (!this._styles.length) && this._setupDefaultStyles(); - }; - - T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay"); - - TextIconOverlay.prototype._setupDefaultStyles = function(){ - var sizes = [53, 56, 66, 78, 90]; - for(var i = 0, size; size = sizes[i]; i++){ - this._styles.push({ - url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION, - size: new BMap.Size(size, size) - }); - }//for循环的简洁写法 - }; - - /** - *继承Overlay的intialize方法,自定义覆盖物时必须。 - *@param {Map} map BMap.Map的实例化对象。 - *@return {HTMLElement} 返回覆盖物对应的HTML元素。 - */ - TextIconOverlay.prototype.initialize = function(map){ - this._map = map; - - this._domElement = document.createElement('div'); - this._updateCss(); - this._updateText(); - this._updatePosition(); - - this._bind(); - - this._map.getPanes().markerMouseTarget.appendChild(this._domElement); - return this._domElement; - }; - - /** - *继承Overlay的draw方法,自定义覆盖物时必须。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.draw = function(){ - this._map && this._updatePosition(); - }; - - /** - *获取该覆盖物上的文字。 - *@return {String} 该覆盖物上的文字。 - */ - TextIconOverlay.prototype.getText = function(){ - return this._text; - }; - - /** - *设置该覆盖物上的文字。 - *@param {String} text 要设置的文字,通常是字母A-Z或数字0-9。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.setText = function(text){ - if(text && (!this._text || (this._text.toString() != text.toString()))){ - this._text = text; - this._updateText(); - this._updateCss(); - this._updatePosition(); - } - }; - - /** - *获取该覆盖物的位置。 - *@return {Point} 该覆盖物的经纬度坐标。 - */ - TextIconOverlay.prototype.getPosition = function () { - return this._position; - }; - - /** - *设置该覆盖物的位置。 - *@param {Point} position 要设置的经纬度坐标。 - *@return 无返回值。 - */ - TextIconOverlay.prototype.setPosition = function (position) { - if(position && (!this._position || !this._position.equals(position))){ - this._position = position; - this._updatePosition(); - } - }; - - /** - *由文字信息获取风格数组的对应索引值。 - *内部默认的对应函数为文字转换为数字除以10的结果,比如文字8返回索引0,文字25返回索引2. - *如果需要自定义映射关系,请覆盖该函数。 - *@param {String} text 文字。 - *@param {Array} styles 一组图标风格。 - *@return {Number} 对应的索引值。 - */ - TextIconOverlay.prototype.getStyleByText = function(text, styles){ - var count = parseInt(text); - if (count < 0) { - count = 0; - } - var index = String(count).length; - return styles[index-1]; - } - - /** - *更新相应的CSS。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updateCss = function(){ - var style = this.getStyleByText(this._text, this._styles); - this._domElement.style.cssText = this._buildCssText(style); - }; - - /** - *更新覆盖物的显示文字。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updateText = function(){ - if (this._domElement) { - this._domElement.innerHTML = this._text; - } - }; - - /** - *调整覆盖物在地图上的位置更新覆盖物的显示文字。 - *@return 无返回值。 - */ - TextIconOverlay.prototype._updatePosition = function(){ - if (this._domElement && this._position) { - var style = this._domElement.style; - var pixelPosition= this._map.pointToOverlayPixel(this._position); - pixelPosition.x -= Math.ceil(parseInt(style.width) / 2); - pixelPosition.y -= Math.ceil(parseInt(style.height) / 2); - style.left = pixelPosition.x + "px"; - style.top = pixelPosition.y + "px"; - } - }; - - /** - * 为该覆盖物的HTML元素构建CSS - * @param {IconStyle} 一个图标的风格。 - * @return {String} 构建完成的CSSTEXT。 - */ - TextIconOverlay.prototype._buildCssText = function(style) { - //根据style来确定一些默认值 - var url = style['url']; - var size = style['size']; - var anchor = style['anchor']; - var offset = style['offset']; - var textColor = style['textColor'] || 'black'; - var textSize = style['textSize'] || 10; - - var csstext = []; - if (T.browser["ie"] < 7) { - csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' + - 'sizingMethod=scale,src="' + url + '");'); - } else { - if(style['bgColor'] == '' || style['bgColor'] == undefined) { - csstext.push('background-image:url(' + url + ');'); - var backgroundPosition = '0 0'; - (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px'); - csstext.push('background-position:' + backgroundPosition + ';'); - } else { - var bgColor = style['bgColor']; - csstext.push('background-color:' + bgColor + '; border-radius: 51%;'); - } - } - - if (size instanceof BMap.Size){ - if (anchor instanceof BMap.Size) { - if (anchor.height > 0 && anchor.height < size.height) { - csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;'); - } - if(anchor.width > 0 && anchor.width < size.width){ - csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;'); - } - } else { - csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;'); - csstext.push('width:' + size.width + 'px; text-align:center;'); - } - } - - csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' + - textSize + 'px; font-family:Arial,sans-serif; font-weight:bold'); - return csstext.join(''); - }; - - - /** - - * 当鼠标点击该覆盖物时会触发该事件 - - * @name TextIconOverlay#click - - * @event - - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - * - - */ - - /** - - * 当鼠标进入该覆盖物区域时会触发该事件 - - * @name TextIconOverlay#mouseover - - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - *
"point : {BMap.Point} 最新添加上的节点BMap.Point对象 - - *
"pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象 - - * - - * @example 参考示例:
- - * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); }); - - */ - - /** - - * 当鼠标离开该覆盖物区域时会触发该事件 - - * @name TextIconOverlay#mouseout - - * @event - - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - - *
"type : {String} 事件类型 - - *
"target:{BMapLib.TextIconOverlay} 事件目标 - - *
"point : {BMap.Point} 最新添加上的节点BMap.Point对象 - - *
"pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象 - - * - - * @example 参考示例:
- - * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); }); - - */ - - - /** - * 为该覆盖物绑定一系列事件 - * 当前支持click mouseover mouseout - * @return 无返回值。 - */ - TextIconOverlay.prototype._bind = function(){ - if (!this._domElement){ - return; - } - - var me = this; - var map = this._map; - - var BaseEvent = T.lang.Event; - function eventExtend(e, be){ - var elem = e.srcElement || e.target; - var x = e.clientX || e.pageX; - var y = e.clientY || e.pageY; - if (e && be && x && y && elem){ - var offset = T.dom.getPosition(map.getContainer()); - be.pixel = new BMap.Pixel(x - offset.left, y - offset.top); - be.point = map.pixelToPoint(be.pixel); - } - return be; - }//给事件参数增加pixel和point两个值 - - T.event.on(this._domElement,"mouseover", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover"))); - }); - T.event.on(this._domElement,"mouseout", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout"))); - }); - T.event.on(this._domElement,"click", function(e){ - me.dispatchEvent(eventExtend(e, new BaseEvent("onclick"))); - }); - }; - -})(); \ No newline at end of file diff --git a/common/helpers/Utils.php b/common/helpers/Utils.php index b37ce2a..47017ac 100644 --- a/common/helpers/Utils.php +++ b/common/helpers/Utils.php @@ -2,7 +2,7 @@ namespace common\helpers; -use common\exts\wechat\Http; +use common\exts\Http; use Faker\Provider\Uuid; class Utils @@ -169,22 +169,6 @@ class Utils return round($number ,2); } - /** - * @param $avatar - * @return bool|string - */ - public static function getUserAvatar($avatar, $WX_STYLE = 96 ) - { - if(false !== strpos($avatar,'http')){ - if(false !== strpos($avatar,'.jpg')){ - return $avatar; - } else { - return \common\helpers\WxHelper::exchangeHeadImgSize($avatar, $WX_STYLE); - } - }else{ - return $avatar; - } - } /** 经纬度检测是否合格 * @param $latitude diff --git a/console/controllers/TestController.php b/console/controllers/TestController.php index bc5d48d..9f2dbcb 100644 --- a/console/controllers/TestController.php +++ b/console/controllers/TestController.php @@ -8,7 +8,9 @@ namespace console\controllers; */ +use app\api\helpers\Aes; use common\exts\Http; +use domain\device\Device; use GuzzleHttp\Psr7; use yii\console\Controller; use GuzzleHttp\Psr7\Request; @@ -27,7 +29,7 @@ class TestController extends Controller { $url = 'http://kingb:8012/app-api/web/authDevice'; $manufactureNo = '0002'; - $device_id = 'SZDEVICE000036'; + $device_id = 'SZDEVICE000037'; $projectNo = '002'; $modelNo = '002'; $productionNo = '0001'; @@ -49,5 +51,59 @@ class TestController extends Controller } + public function actionUpgrade() + { + $url = 'http://kingb:8012/app-api/web/reportDeviceVersion'; + $params = [ + 'barcode' => '00001', + 'device_id' => 'DEVICE001', + 'software_version' => 'V1.0.1', + 'hardware_version' => 'V1.0.2', + 'timestamp' => 1500000000 + ]; + + $postResult = Http::POST($url, $params); + echo $postResult; + } + + public function actionAec() + { + $aes = new Aes('12345678'); + $encrypted = $aes->encrypt('this is en AES testing'); + echo '要加密的字符串:this is en AES testing
加密后的字符串:'. $encrypted. '
'; + $decrypted = $aes->decrypt($encrypted); + echo '要解密的字符串:'. $encrypted, '
解密后的字符串:'. $decrypted; + } + + public function actionDeviceSt() + { + $url = 'http://kingb:8012/app-api/web/reportDeviceVersion'; + $params = [ + 'barcode' => '0001000100010001', + 'device_id' => 'DEVICE003', + 'software_version' => 'V1.0.1', + 'hardware_version' => 'V1.0.2', + 'timestamp' => 1500000000 + ]; + + $postResult = Http::POST($url, json_encode($params)); + echo $postResult; + } + + public function actionCheckAppUpdate() + { + //actionCheckAppVersion + $url = 'http://kingb:8012/app-api/web/checkAppVersion'; + $params = [ + 'barcode' => '0001000100010001', + 'device_id' => 'DEVICE000001', + 'current_version' => 'V1.0.1', + 'package_name' => 'com.ota.app.pro', + ]; + + $postResult = Http::POST($url, json_encode($params)); + echo $postResult; + } + } diff --git a/domain/device/Device.php b/domain/device/Device.php index a6413b2..74486ba 100644 --- a/domain/device/Device.php +++ b/domain/device/Device.php @@ -18,6 +18,22 @@ class Device return $manufacture. $project. $model. $production; } + static function explodeBarcode($barcode) + { + //建议格式: 0001 0001 0001 0001 + //供参考 厂商ID 项目ID 型号ID 生产日期ID + $len = mb_strlen($barcode); + if ($len != 16) { + return null; + } + $manufactureNo = mb_substr($barcode, 0, 4, 'utf-8'); + $projectNo = mb_substr($barcode, 4, 4, 'utf-8'); + $modelNo = mb_substr($barcode, 8, 4, 'utf-8'); + $productionNo = mb_substr($barcode, 12, 4, 'utf-8'); + + return [$manufactureNo, $projectNo, $modelNo, $productionNo]; + } + /** * @param $deviceId * @param $manufactureNo @@ -41,7 +57,7 @@ class Device return $e; } $batchId = $batchModel->id; - $count = DeviceRepository::rowsCount(['batch_id' => $batchId, 'is_delete' => 0]); + $count = DeviceRepository::rowsCount(['batch_id' => $batchId, 'status' => DeviceStatus::HAS_AUTH, 'is_delete' => 0]); if (($count *1) >= ($batchModel->num * 1)) { // 超过了限制数,记录到另外一个表里面 diff --git a/domain/device/DeviceAuthFailRepository.php b/domain/device/DeviceAuthFailRepository.php index d310585..16c50c6 100644 --- a/domain/device/DeviceAuthFailRepository.php +++ b/domain/device/DeviceAuthFailRepository.php @@ -16,4 +16,50 @@ class DeviceAuthFailRepository return DeviceAuthFailModel::findOne($condition); } + + /** + * @param $where + * @return array|\yii\db\ActiveRecord[] + */ + static function getList($where, $limit = 0, $offset = 0) + { + $deviceFind = DeviceAuthFailModel::find(); + $deviceFind->alias('a'); + $deviceFind->select(['a.*', 'm.name as manufacture','p.name as project','pd.name as production','mo.name as model']); + $deviceFind->leftJoin('manufacture as m', 'm.manufacture_no = a.manufacture_no'); + $deviceFind->leftJoin('project as p', 'p.project_no = a.project_no'); + $deviceFind->leftJoin('model as mo', 'mo.model_no = a.model_no'); + $deviceFind->leftJoin('production as pd', 'pd.production_no = a.production_no'); + + $deviceFind->where($where); + $deviceFind->orderBy('created_at desc'); + $deviceFind->asArray(); + if ($offset) { + $deviceFind->offset($offset); + } + if ($limit) { + $deviceFind->limit($limit); + } + $all = $deviceFind->all(); + + return $all; + } + + /** + * @param $where + * @return int|string + */ + static function getListCount($where) + { + $deviceFind = DeviceAuthFailModel::find(); + $deviceFind->alias('a'); + $deviceFind->leftJoin('manufacture as m', 'm.manufacture_no = a.manufacture_no'); + $deviceFind->leftJoin('project as p', 'p.project_no = a.project_no'); + $deviceFind->leftJoin('model as mo', 'mo.model_no = a.model_no'); + $deviceFind->leftJoin('production as pd', 'pd.production_no = a.production_no'); + $deviceFind->where($where); + $all = $deviceFind->count(); + + return $all; + } } \ No newline at end of file diff --git a/domain/device/DeviceRepository.php b/domain/device/DeviceRepository.php index 557c70e..108d3d4 100644 --- a/domain/device/DeviceRepository.php +++ b/domain/device/DeviceRepository.php @@ -23,6 +23,7 @@ class DeviceRepository $deviceFind->leftJoin('production as pd', 'pd.id = b.production_id'); $deviceFind->where($where); + $deviceFind->orderBy('created_at desc'); $deviceFind->asArray(); if ($offset) { $deviceFind->offset($offset); diff --git a/domain/device/DeviceStats.php b/domain/device/DeviceStats.php new file mode 100644 index 0000000..6d3fc66 --- /dev/null +++ b/domain/device/DeviceStats.php @@ -0,0 +1,35 @@ + DeviceStatsModel::className(), + 'barcode' => $item['barcode'], + 'device_id' => $item['device_id'], + 'manufacture_id' => $item['manufacture_id'], + 'project_id' => $item['project_id'], + 'model_id' => $item['model_id'], + 'software_version' => $item['software_version'], + 'hardware_version' => $item['hardware_version'], + 'timestamp' => $item['timestamp'], + 'city' => $item['city'], + 'ip' => $item['ip'] + ]); + if ($createModel->save()) { + return $createModel; + } else { + return null; + } + } +} \ No newline at end of file diff --git a/domain/device/DeviceStatsRepository.php b/domain/device/DeviceStatsRepository.php new file mode 100644 index 0000000..51250a3 --- /dev/null +++ b/domain/device/DeviceStatsRepository.php @@ -0,0 +1,81 @@ +alias("ds") + ->select([ + "ds.*", + "mf.name as manufacture_name", + 'de.serial_no', + 'de.device_id as device_device_id', + 'pj.name as project_name', + 'md.name as model_name', + ]); + $upgradeFind->leftJoin(ManufacturerModel::tableName() . " mf", "mf.id = ds.manufacture_id"); + $upgradeFind->leftJoin(DeviceModel::tableName() . " de", "de.id = ds.device_id"); + $upgradeFind->leftJoin(ProjectModel::tableName() . " pj", "pj.id = ds.project_id"); + $upgradeFind->leftJoin(ModelModel::tableName() . " md", "md.id = ds.model_id"); + + if (!empty($where)) { + $upgradeFind->where($where); + } + if ($offset) { + $upgradeFind->offset($offset); + } + if ($limit) { + $upgradeFind->limit($limit); + } + $upgradeFind->orderBy("ds.id desc"); + $upgradeFind->asArray(); + $dataList = $upgradeFind->all(); + + return $dataList; + } + + /** + * 列表页面分页器数量 + * @param string $map + */ + static function getPageCount($map = '') + { + $DeviceStatsFind = DeviceStatsModel::find()->alias("ds"); + $DeviceStatsFind->leftJoin(ManufacturerModel::tableName() . " mf", "mf.id = ds.manufacture_id"); + $DeviceStatsFind->leftJoin(DeviceModel::tableName() . " de", "de.id = ds.device_id"); + $DeviceStatsFind->leftJoin(ProjectModel::tableName() . " pj", "pj.id = ds.project_id"); + $DeviceStatsFind->leftJoin(ModelModel::tableName() . " md", "md.id = ds.model_id"); + if (!empty($map)) { + $DeviceStatsFind->where($map); + } + $pageCount = $DeviceStatsFind->count(); + + return $pageCount; + } + +} \ No newline at end of file diff --git a/domain/device/models/DeviceStats.php b/domain/device/models/DeviceStats.php new file mode 100644 index 0000000..e611b47 --- /dev/null +++ b/domain/device/models/DeviceStats.php @@ -0,0 +1,28 @@ + [ + 'class' => TimestampBehavior::className(), + 'createdAtAttribute' => 'created_at', + 'updatedAtAttribute' => 'updated_at', + ] + ]; + } +} \ No newline at end of file diff --git a/domain/upgrade/Upgrade.php b/domain/upgrade/Upgrade.php index 333c86f..5bf4568 100644 --- a/domain/upgrade/Upgrade.php +++ b/domain/upgrade/Upgrade.php @@ -20,7 +20,7 @@ class Upgrade static function create($item) { try { - $findUpgradeModel = UpgradeModel::findOne(['version' => $item["version"], 'type' => $item["type"]]); + $findUpgradeModel = UpgradeModel::findOne(['version' => $item["version"], 'manufacture_id' => $item["manufacture_id"], 'type' => $item["type"]]); if (!empty($findUpgradeModel)) { return -1; } diff --git a/domain/upgrade/UpgradeLog.php b/domain/upgrade/UpgradeLog.php index e82b022..a25d307 100644 --- a/domain/upgrade/UpgradeLog.php +++ b/domain/upgrade/UpgradeLog.php @@ -48,6 +48,9 @@ class UpgradeLog if (isset($item["error_code"])) { $upgradeLogModel->error_code = $item["error_code"]; // 错误码 } + if (isset($item["timestamp"])) { + $upgradeLogModel->timestamp = $item["timestamp"]; // + } if (isset($item["type"])) { $upgradeLogModel->type = $item["type"]; // 日志类型 1 app 2.ota整机 } -- libgit2 0.21.0