You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1684 lines
78 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. // pagesA/facepeople/facepeople.js
  2. import moment from '../../utils/moment'
  3. function CurentTime() {
  4. var now = new Date();
  5. var year = now.getFullYear(); //年
  6. var month = now.getMonth() + 1; //月
  7. var day = now.getDate(); //日
  8. var hh = now.getHours(); //时
  9. var mm = now.getMinutes(); //分
  10. var clock = year + "-";
  11. if (month < 10)
  12. clock += "0";
  13. clock += month + "-";
  14. if (day < 10)
  15. clock += "0";
  16. clock += day + " ";
  17. // if (hh < 10)
  18. // clock += "0";
  19. // clock += '00' + ":";
  20. // // if (mm < 10) clock += '0';
  21. clock += '00:00:00';
  22. return (clock);
  23. }
  24. function CurentTime1() {
  25. var now = new Date();
  26. var year = now.getFullYear() + 3; //年
  27. var month = now.getMonth() + 1; //月
  28. var day = now.getDate(); //日
  29. var hh = now.getHours(); //时
  30. var mm = now.getMinutes(); //分
  31. var clock = year + "-";
  32. if (month < 10)
  33. clock += "0";
  34. clock += month + "-";
  35. if (day < 10)
  36. clock += "0";
  37. clock += day + " ";
  38. // if (hh < 10)
  39. // clock += "0";
  40. // clock += hh + ":";
  41. // if (mm < 10) clock += '0';
  42. // clock += mm;
  43. clock += '23:59:59';
  44. return (clock);
  45. }
  46. const app = getApp()
  47. const WXAPI = require("../../utils/request")
  48. const util = require("../../utils/util")
  49. const plugin = requirePlugin("myPlugin")
  50. var methods = require('../../utils/methods');
  51. var md5 = require('../../utils/md5.js');
  52. var bleall = require('../../utils/bleall');
  53. var util1 = require('../../utils/util1');
  54. const config = require('../../config')
  55. const ADD_NFC_MODE = 10
  56. var date = new Date()
  57. var isConnected = false
  58. var connectedDeviceId = ''
  59. var basecode = 29283991
  60. var lockId = 1
  61. var lockManagerId = 1
  62. var lockMac = ''
  63. var isInitReady = false
  64. var lockModel
  65. var lockDevice
  66. var taskId = 0
  67. var pincode = -1
  68. var pincodeIndex = -1
  69. var rfCardId = -1
  70. var rfCardIndex = -1
  71. var fingerprintIndex = -1
  72. var passwordLiAll = {
  73. id: ''
  74. }
  75. var isLockLogin = false
  76. var serialNumber = ''
  77. Page({
  78. /**
  79. * 页面的初始数据
  80. */
  81. data: {
  82. date: moment().format('YYYY-MM-DD HH:mm:ss'),
  83. show: false,
  84. value: '',
  85. show2: false,
  86. facename: '',
  87. minDate: '',
  88. minDate1: '',
  89. endtime: '',
  90. starttime: '',
  91. datetimerange: [CurentTime(), CurentTime1()],
  92. chooseface: false,
  93. avatarPath: "", // 上传的图片数据
  94. isSearch: app.globalData.isSearch,
  95. cgInfo: {},
  96. deviceinfo: {},
  97. personLi: {},
  98. faceList: [],
  99. },
  100. /**
  101. * 生命周期函数--监听页面加载
  102. */
  103. onLoad: function (options) {
  104. var cgInfo = wx.getStorageSync('cgInfo')
  105. var deviceinfo = wx.getStorageSync('deviceinfo')
  106. var personLi = wx.getStorageSync('personLi')
  107. let minDate = wx.getStorageSync('minDate')
  108. let minDate1 = wx.getStorageSync('minDate1')
  109. console.log(cgInfo, deviceinfo, personLi, minDate, minDate1);
  110. this.setData({
  111. isSearch: false,
  112. cgInfo: cgInfo,
  113. minDate,
  114. minDate1,
  115. starttime: minDate,
  116. endtime: minDate1,
  117. deviceinfo: deviceinfo,
  118. personLi: personLi,
  119. })
  120. if (this.data.avatarPath) {
  121. this.setData({
  122. show2: true
  123. })
  124. }
  125. },
  126. CurentTime() {
  127. var now = new Date();
  128. var year = now.getFullYear(); //年
  129. var month = now.getMonth() + 1; //月
  130. var day = now.getDate(); //日
  131. var hh = now.getHours(); //时
  132. var mm = now.getMinutes(); //分
  133. var clock = year + "-";
  134. if (month < 10)
  135. clock += "0";
  136. clock += month + "-";
  137. if (day < 10)
  138. clock += "0";
  139. clock += day + " ";
  140. // if (hh < 10)
  141. // clock += "0";
  142. // clock += '00' + ":";
  143. // // if (mm < 10) clock += '0';
  144. clock += '00:00:00';
  145. return (clock);
  146. },
  147. changeshow2() {
  148. this.setData({
  149. show2: true
  150. })
  151. },
  152. onChange2(e) {
  153. this.setData({
  154. facename: e.detail
  155. })
  156. },
  157. bindDateChange: function (e) {
  158. var str = e.detail.value + " 00:00:00"
  159. this.data.datetimerange[0] = str
  160. this.setData({
  161. starttime: str,
  162. })
  163. },
  164. bindDateChange1: function (e) {
  165. var str = e.detail.value + " 23:59:59"
  166. this.data.datetimerange[1] = str
  167. this.setData({
  168. endtime: str
  169. })
  170. },
  171. onSearch() {
  172. },
  173. onCancel() {
  174. },
  175. // 新增人脸
  176. addFace() {
  177. // wx.chooseImage({
  178. // count: 1,
  179. // sizeType: ['original', 'compressed'],
  180. // success: function (res) {
  181. // console.log(res)
  182. // wx.getImageInfo({
  183. // src: res.tempFilePaths[0],
  184. // success(res) {
  185. // wx.navigateTo({
  186. // url: '/pagesA/selectFace/selectFace?data=' + JSON.stringify(res)
  187. // })
  188. // }
  189. // })
  190. // }
  191. // });
  192. wx.navigateTo({
  193. url: '/pagesA/selectFace/selectFace',
  194. })
  195. },
  196. // 弹出框
  197. changeshow() {
  198. this.setData({
  199. show: true
  200. })
  201. },
  202. onClose() {
  203. this.setData({
  204. show: false,
  205. show2: false
  206. })
  207. },
  208. // 跳转详情页
  209. gotoinfo() {
  210. wx.navigateTo({
  211. url: '/pagesA/faceinfo/faceinfo',
  212. })
  213. },
  214. // 增加人脸
  215. sendface() {
  216. var time3 = new Date(this.data.datetimerange[0].replace(/-/g, '/'))
  217. var time4 = new Date(this.data.datetimerange[1].replace(/-/g, '/'))
  218. var passwordStartTimecontrast = time3.getTime() / 1000
  219. var passwordEndTimecontrast = time4.getTime() / 1000
  220. if (passwordStartTimecontrast > passwordEndTimecontrast) {
  221. wx.showToast({
  222. title: '开始时间不能大于结束时间',
  223. duration: 2000,
  224. mask: true,
  225. icon: 'none'
  226. })
  227. return
  228. }
  229. wx.showLoading({
  230. title: '正在添加人脸',
  231. mask: true
  232. })
  233. var _this = this
  234. var deviceinfo = this.data.deviceinfo
  235. var info = JSON.parse(this.data.personLi.info)
  236. if (deviceinfo.manufactureId == 1241) {
  237. if (this.data.isSearch) {
  238. var time1 = new Date(_this.data.datetimerange[0].replace(/-/g, '/'))
  239. var time2 = new Date(_this.data.datetimerange[1].replace(/-/g, '/'))
  240. var passwordStartTime = time1.getTime() / 1000
  241. var passwordEndTime = time2.getTime() / 1000
  242. var facepic = ""
  243. var cardName = "",
  244. pzname = ""
  245. if(this.data.pzname) {
  246. cardName = _this.data.personLi.name + '-蓝牙-' + _this.data.pzname,
  247. pzname = '蓝牙-' + _this.data.pzname
  248. }else{
  249. cardName = _this.data.personLi.name + '-蓝牙-人脸' + (_this.data.faceList.length + 1)
  250. pzname = '蓝牙-人脸' + (_this.data.faceList.length + 1)
  251. }
  252. // 修改图片格式
  253. // wx.readFile({
  254. // filePath: _this.data.avatarPath,
  255. // encoding: 'base64',
  256. // success: function(res) {
  257. // console.log(res);
  258. // const base64Img = res.data
  259. // facepic = base64Img
  260. // },
  261. // fail: function(res) {
  262. // console.log('读取文件失败', res);
  263. // }
  264. // })
  265. facepic = wx.getFileSystemManager().readFileSync(_this.data.avatarPath, "base64")
  266. var dataface = {
  267. code: "lwj/faceOperate",
  268. data: {
  269. action: 1,
  270. endTime: passwordEndTime,
  271. faceData: facepic,
  272. lockerId: deviceinfo.deviceNum,
  273. lockerUserId: info.userPassword,
  274. startTime: passwordStartTime,
  275. }
  276. }
  277. console.log(facepic, dataface);
  278. // WXAPI.sendCommand(dataface).then(res => {
  279. // console.log(res);
  280. // if(res.success){
  281. _this.onAddFace()
  282. // }
  283. // })
  284. } else {
  285. this.searchDevicesMethods()
  286. }
  287. }
  288. },
  289. onAddFace() {
  290. var that = this
  291. wx.showLoading({
  292. title: '添加人脸中',
  293. })
  294. var startTime = new Date(Number(moment(that.data.starttime).format('x')))
  295. var endTime = new Date(Number(moment(that.data.endtime).format('x')))
  296. // var bytes = plugin.faceOperate()
  297. },
  298. sendBytes(bytes) {
  299. setTimeout(() => {
  300. wx.writeBLECharacteristicValue({
  301. deviceId: lockDevice.deviceId,
  302. serviceId: config.uuid.serviceUuid.toUpperCase(),
  303. characteristicId: config.uuid.writeUuid.toUpperCase(),
  304. value: bytes,
  305. success: function (res) {
  306. },
  307. })
  308. }, 50)
  309. },
  310. searchDevicesMethods() {
  311. var that = this;
  312. wx.showLoading({
  313. title: '正在搜索',
  314. // mask: true
  315. })
  316. this.setData({
  317. searchClick: false
  318. })
  319. wx.openBluetoothAdapter({
  320. success: function (res) {
  321. wx.startBluetoothDevicesDiscovery({
  322. success: function (res) {
  323. wx.getBluetoothDevices({
  324. success: function (res) {
  325. res.devices.map(it => {
  326. var status = it.name.indexOf('WSL_')
  327. if (status != -1) {
  328. if (it.RSSI != 127) {
  329. if (it.advertisData != null) {
  330. it.adData = util1.ab2hex(it.advertisData)
  331. if (it.adData.length > 10) {
  332. var macStr = it.adData.substring(4, 16).toUpperCase()
  333. //console.log('macStr', macStr)
  334. it.mac = macStr.substr(10, 2) + ':' + macStr.substr(8, 2) + ':' + macStr.substr(6, 2) + ':' + macStr.substr(4, 2) + ':' + macStr.substr(2, 2) + ':' + macStr.substr(0, 2)
  335. if (it.adData.substring(1, 2) == '1') {
  336. it.isLightOn = true
  337. it.textColor = 'green'
  338. } else {
  339. it.isLightOn = false
  340. it.textColor = 'black'
  341. }
  342. if (it.adData.substring(3, 4) == '1') {
  343. it.textColor = 'pink'
  344. it.isBind = true
  345. } else {
  346. it.isBind = false
  347. }
  348. }
  349. } else {
  350. it.textColor = 'black'
  351. }
  352. lockModel = util1.getLockModel(it.name)
  353. it.lockType = util1.getLockType(lockModel)
  354. if (it.name == that.data.deviceinfo.deviceNum) {
  355. app.addDeviceWithDevName(it.name, it)
  356. lockDevice = it
  357. connectedDeviceId = it.deviceId
  358. that.setData({
  359. isSearch: true
  360. })
  361. that.initBluetooth()
  362. }
  363. }
  364. }
  365. })
  366. if (!that.data.isSearch) {
  367. that.searchDevicesMethods()
  368. }
  369. }
  370. })
  371. },
  372. fail: function (res) {
  373. wx.hideLoading({
  374. success: (res) => {
  375. wx.showToast({
  376. title: res.errMsg,
  377. duration: 2000,
  378. icon: 'none'
  379. })
  380. },
  381. })
  382. }
  383. })
  384. },
  385. fail: function (res) {
  386. console.log('请打开蓝牙和定位功能')
  387. wx.hideLoading({
  388. success: (res) => {
  389. wx.showToast({
  390. title: '请打开蓝牙和定位功能',
  391. duration: 2000,
  392. icon: 'none'
  393. })
  394. },
  395. })
  396. }
  397. })
  398. },
  399. initBluetooth: function () {
  400. var that = this
  401. wx.getConnectedBluetoothDevices({
  402. services: [config.uuid.serviceUuid],
  403. success: function (res) {
  404. res.devices.map(function (it) {
  405. if (it.deviceId == connectedDeviceId || it.name == that.data.deviceinfo.deviceNum) {
  406. isConnected = true
  407. }
  408. })
  409. that.setData({
  410. isConnected: isConnected
  411. })
  412. console.log(isInitReady, 'isConnected', isConnected)
  413. if (isConnected) {
  414. console.log("2144");
  415. if (isInitReady) {
  416. console.log("2146");
  417. that.doWork()
  418. } else {
  419. that.setupConnection()
  420. }
  421. } else {
  422. that.connectTo()
  423. }
  424. },
  425. })
  426. },
  427. connectTo: function () {
  428. var that = this
  429. wx.showLoading({
  430. title: '连接中',
  431. })
  432. wx.createBLEConnection({
  433. deviceId: lockDevice.deviceId,
  434. timeout: config.ble.connectTimeOut,
  435. success: function (res) {
  436. console.log('connectTo', res)
  437. isConnected = true
  438. // app.globalData.isConnected = true
  439. wx.hideLoading()
  440. setTimeout(function () {
  441. that.setupConnection()
  442. }, 500)
  443. },
  444. fail: function (e) {
  445. console.debug('connectTo', e)
  446. wx.hideLoading()
  447. switch (e.errCode) {
  448. case 10003: {
  449. wx.showModal({
  450. title: '连接失败',
  451. content: '是否重新连接?',
  452. success: function (res) {
  453. if (res.confirm) {
  454. that.connectTo()
  455. }
  456. }
  457. })
  458. break
  459. }
  460. case 10012: {
  461. wx.showModal({
  462. title: '连接失败',
  463. content: '蓝牙连接超时',
  464. showCancel: false
  465. })
  466. break
  467. }
  468. case 10002: {
  469. wx.showModal({
  470. title: '连接失败',
  471. content: '没有找到指定设备',
  472. showCancel: false
  473. })
  474. break
  475. }
  476. }
  477. }
  478. })
  479. },
  480. setupConnection: function () {
  481. var that = this
  482. wx.showLoading({
  483. title: '初始化连接中',
  484. })
  485. wx.getBLEDeviceServices({
  486. deviceId: lockDevice.deviceId,
  487. success: function (res) {
  488. console.log('Services', res)
  489. wx.getBLEDeviceCharacteristics({
  490. deviceId: lockDevice.deviceId,
  491. serviceId: config.uuid.serviceUuid.toUpperCase(),
  492. success: function (res) {
  493. console.log('Characteristics', res)
  494. wx.showToast({
  495. title: '连接成功',
  496. duration: 1000,
  497. icon: 'none'
  498. })
  499. wx.onBLECharacteristicValueChange(function (res) {
  500. console.log(res, 'reslllllll')
  501. var bytes = new Uint8Array(res.value)
  502. console.log('bytes', bytes)
  503. var data = plugin.parseBytes(lockDevice.name, basecode, bytes)
  504. console.log('data', data)
  505. switch (data.cmd) {
  506. case 'reportLockBattery': {
  507. if (data.data.battery < 10) {
  508. wx.showModal({
  509. title: '电量报警',
  510. content: `门锁当前电量${data.data.battery}%!\n电量严重不足,请立即更换电池!`,
  511. showCancel: false
  512. })
  513. } else if (data.data.battery < 30) {
  514. wx.showModal({
  515. title: '电量预警',
  516. content: `门锁当前电量${data.data.battery}%!\n请及时更换电池!`,
  517. showCancel: false
  518. })
  519. }
  520. break
  521. }
  522. case 'reportRfCardResult': {
  523. if (taskId == 61) {
  524. wx.showModal({
  525. title: '检测到新卡',
  526. content: `是否添加此房卡,卡号:${data.data.cardId}`,
  527. success: function (res) {
  528. if (res.confirm) {
  529. console.log(data.data, 'rfCardIdrfCardId')
  530. // rfCardId = randomMethods()//data.data.cardId
  531. that.onAddRfCard()
  532. }
  533. }
  534. })
  535. } else {
  536. if (lockModel > 70) {
  537. if (data.data.isValid) {
  538. wx.showModal({
  539. title: '提示',
  540. content: `房卡开锁成功,序号:${data.data.index}`,
  541. showCancel: false
  542. })
  543. } else {
  544. wx.showModal({
  545. title: '提示',
  546. content: `多次刷房卡开锁失败!`,
  547. showCancel: false
  548. })
  549. }
  550. } else {
  551. if (data.data.isValid) {
  552. wx.showModal({
  553. title: '提示',
  554. content: `房卡开锁成功,卡号:${data.data.cardId}`,
  555. showCancel: false
  556. })
  557. } else {
  558. wx.showModal({
  559. title: '提示',
  560. content: `房卡未授权,卡号:${data.data.cardId}`,
  561. showCancel: false
  562. })
  563. }
  564. }
  565. }
  566. break
  567. }
  568. case 'reportPincodeResult': {
  569. if (lockModel > 70) {
  570. if (data.data.isValid) {
  571. wx.showModal({
  572. title: '提示',
  573. content: `密码开锁成功,序号:${data.data.index}`,
  574. showCancel: false
  575. })
  576. } else {
  577. wx.showModal({
  578. title: '提示',
  579. content: `多次密码开锁失败!`,
  580. showCancel: false
  581. })
  582. }
  583. } else {
  584. if (data.data.isValid) {
  585. wx.showModal({
  586. title: '提示',
  587. content: `密码:${data.data.pincode}开锁成功!`,
  588. showCancel: false
  589. })
  590. } else {
  591. wx.showModal({
  592. title: '提示',
  593. content: `密码:${data.data.pincode}未授权!`,
  594. showCancel: false
  595. })
  596. }
  597. }
  598. break
  599. }
  600. case 'reportFingerprintResult': {
  601. if (data.data.isValid) {
  602. wx.showModal({
  603. title: '提示',
  604. content: `指纹开锁成功,序号:${data.data.index}`,
  605. showCancel: false
  606. })
  607. } else {
  608. wx.showModal({
  609. title: '提示',
  610. content: `多次指纹开锁失败!`,
  611. showCancel: false
  612. })
  613. }
  614. break
  615. }
  616. case 'queryLockState': {
  617. wx.hideLoading()
  618. if (data.code != 200) {
  619. wx.showModal({
  620. title: '提示',
  621. content: '查询失败!',
  622. showCancel: false,
  623. success: function (res) {}
  624. })
  625. break
  626. }
  627. that.setData({
  628. lock: {
  629. mac: data.data.mac,
  630. lockType: util1.getLockType(lockModel),
  631. },
  632. isBindLock: data.data.isBind
  633. })
  634. lockMac = data.data.mac
  635. if (taskId > 0) {
  636. if (data.data.isBind) {
  637. // wx.showModal({
  638. // title: data.data.mac,
  639. // content: '此设备已经硬件绑定!',
  640. // showCancel: false,
  641. // success: function (res) {}
  642. // })
  643. } else {
  644. wx.showModal({
  645. title: data.data.mac,
  646. content: '此设备硬件未绑定!',
  647. showCancel: false,
  648. success: function (res) {}
  649. })
  650. }
  651. }
  652. taskId = 0
  653. break
  654. }
  655. case 'queryLockBattery': {
  656. wx.hideLoading()
  657. if (data.code != 200) {
  658. wx.showModal({
  659. title: '提示',
  660. content: '查询失败!',
  661. showCancel: false,
  662. success: function (res) {}
  663. })
  664. break
  665. }
  666. taskId = 0
  667. wx.showModal({
  668. title: '提示',
  669. content: `此门锁电量为${data.data.battery}%`,
  670. showCancel: false,
  671. success: function (res) {}
  672. })
  673. break
  674. }
  675. case 'queryNbImei': {
  676. wx.hideLoading()
  677. if (data.code != 200) {
  678. wx.showModal({
  679. title: '提示',
  680. content: '查询失败!',
  681. showCancel: false,
  682. success: function (res) {}
  683. })
  684. break
  685. }
  686. taskId = 0
  687. wx.showModal({
  688. title: '提示',
  689. content: `此NB设备IMEI为${data.data.imei}`,
  690. showCancel: false,
  691. success: function (res) {}
  692. })
  693. break
  694. }
  695. case 'setNbFun': {
  696. wx.hideLoading()
  697. if (data.code != 200) {
  698. wx.showModal({
  699. title: '提示',
  700. content: '设置Nb功能失败!',
  701. showCancel: false,
  702. success: function (res) {}
  703. })
  704. break
  705. }
  706. taskId = 0
  707. wx.showModal({
  708. title: '提示',
  709. content: that.data.isNbEnable ? 'NB功能已禁用' : 'NB功能已打开',
  710. showCancel: false,
  711. })
  712. that.setData({
  713. isNbEnable: !that.data.isNbEnable
  714. })
  715. break
  716. }
  717. case 'sendBindLock': {
  718. wx.hideLoading()
  719. if (data.code != 200) {
  720. wx.showModal({
  721. title: '提示',
  722. content: '绑定失败!',
  723. showCancel: false,
  724. success: function (res) {}
  725. })
  726. break
  727. }
  728. taskId = 0
  729. that.setData({
  730. isBindLock: data.data.isBind
  731. })
  732. if (data.data.isBind) {
  733. wx.showToast({
  734. title: '绑定成功!',
  735. })
  736. } else {
  737. wx.showToast({
  738. title: '绑定失败!',
  739. })
  740. }
  741. break
  742. }
  743. case 'sendUnbindLock': {
  744. wx.hideLoading()
  745. if (data.code != 200) {
  746. wx.showModal({
  747. title: '提示',
  748. content: '解绑失败!',
  749. showCancel: false,
  750. success: function (res) {}
  751. })
  752. break
  753. }
  754. taskId = 0
  755. that.setData({
  756. isBindLock: data.data.isBind
  757. })
  758. if (data.data.isBind) {
  759. wx.showToast({
  760. title: '解绑失败!',
  761. })
  762. } else {
  763. wx.showToast({
  764. title: '解绑成功!',
  765. })
  766. }
  767. break
  768. }
  769. case 'login1':
  770. case 'sendOpenLockP1': {
  771. if (data.code != 200) {
  772. wx.hideLoading()
  773. if (taskId == 41) {
  774. wx.showModal({
  775. title: '提示',
  776. content: that.data.isJack ? '上电失败!' : '解锁失败!',
  777. showCancel: false,
  778. success: function (res) {}
  779. })
  780. } else if (taskId == 32) {
  781. wx.showModal({
  782. title: '提示',
  783. content: '登录失败!',
  784. showCancel: false,
  785. success: function (res) {}
  786. })
  787. }
  788. break
  789. }
  790. if (taskId == 41) {
  791. var bytes = plugin.sendOpenLockP2(lockDevice.name, basecode, data.data.randomN)
  792. console.debug('bytes', bytes)
  793. that.sendBytes(bytes)
  794. } else if (taskId == 32) {
  795. var bytes = plugin.login2(lockDevice.name, basecode, data.data.randomN)
  796. console.debug('bytes', bytes)
  797. that.sendBytes(bytes)
  798. }
  799. break;
  800. }
  801. case 'login':
  802. case 'sendOpenLockP2': {
  803. wx.hideLoading()
  804. if (data.code != 200) {
  805. if (taskId == 41) {
  806. wx.showModal({
  807. title: '提示',
  808. content: that.data.isJack ? '上电失败!' : '解锁失败!',
  809. showCancel: false,
  810. success: function (res) {}
  811. })
  812. } else if (taskId == 32) {
  813. wx.showModal({
  814. title: '提示',
  815. content: '登录失败!',
  816. showCancel: false,
  817. success: function (res) {}
  818. })
  819. }
  820. break
  821. }
  822. isLockLogin = true
  823. if (taskId == 41) {
  824. // var data = {
  825. // code: "zg/bleUnlockRecord",
  826. // data: {
  827. // lockerId: that.data.deviceinfo.deviceNum,
  828. // roomId:that.data.deviceinfo.roomId,
  829. // roomName:that.data.deviceinfo.roomName,
  830. // cardName:that.data.userInfo.username
  831. // }
  832. // }
  833. var data = {
  834. code: "ble/bleUnlockRecord",
  835. data: {
  836. deviceNum: that.data.deviceinfo.deviceNum,
  837. roomId: that.data.deviceinfo.roomId,
  838. roomName: that.data.deviceinfo.roomName,
  839. cardName: that.data.userInfo.username,
  840. productId: that.data.deviceinfo.manufactureId,
  841. userId: '29283991'
  842. }
  843. }
  844. WXAPI.sendCommand(data).then(res => {
  845. console.log(res)
  846. })
  847. wx.showToast({
  848. title: that.data.isJack ? '上电成功!' : '解锁成功!',
  849. })
  850. } else if (taskId == 32) {
  851. wx.showToast({
  852. title: '登录成功!',
  853. })
  854. }
  855. taskId = 0
  856. break;
  857. }
  858. case 'syncClock': {
  859. wx.hideLoading()
  860. if (data.code != 200) {
  861. wx.showModal({
  862. title: '提示',
  863. content: '同步时间失败!' + data.data.msg,
  864. showCancel: false,
  865. success: function (res) {}
  866. })
  867. break
  868. }
  869. taskId = 0
  870. wx.showModal({
  871. title: '提示',
  872. content: '时间更新成功!',
  873. showCancel: false
  874. })
  875. break;
  876. }
  877. case 'addPincode': {
  878. // console.log(data.data,'data.data')
  879. // wx.hideLoading()
  880. let data2 = {
  881. "code": "ble/bleSendVoucherReply",
  882. "data": {
  883. "deviceNum": that.data.deviceinfo.deviceNum,
  884. "serialNumber": serialNumber,
  885. "index": pincodeIndex,
  886. "type": 7,
  887. "result": 1,
  888. "productId": that.data.deviceinfo.manufactureId
  889. }
  890. }
  891. if (data.code != 200) {
  892. data2 = {
  893. "code": "ble/bleSendVoucherReply",
  894. "data": {
  895. "deviceNum": that.data.deviceinfo.deviceNum,
  896. "serialNumber": serialNumber,
  897. "index": pincodeIndex,
  898. "type": 7,
  899. "result": 0,
  900. "productId": that.data.deviceinfo.manufactureId
  901. }
  902. }
  903. WXAPI.sendCommand(data2).then(res => {
  904. })
  905. wx.showModal({
  906. title: '提示',
  907. content: '添加密码失败!' + data.data.msg,
  908. showCancel: false,
  909. success: function (res) {}
  910. })
  911. break
  912. }
  913. var time1 = new Date(that.data.starttime.replace(/-/g, '/'))
  914. var time2 = new Date(that.data.endtime.replace(/-/g, '/'))
  915. var passwordStartTime = time1.getTime() / 1000
  916. var passwordEndTime = time2.getTime() / 1000
  917. var pzname = '',
  918. cardName = '';
  919. pzname = '蓝牙-密码' + (that.data.passwordList.length + 1)
  920. cardName = that.data.personLi.name + '-蓝牙-密码' + (that.data.passwordList.length + 1)
  921. var str = {
  922. // cardId: this.personInfo.cardId,
  923. imei: that.data.deviceinfo.imei,
  924. pzname: pzname,
  925. password: that.data.password.toString(),
  926. userTelephone: JSON.parse(that.data.personLi.info).userTelephone,
  927. operateMode: 7,
  928. userPassword: JSON.parse(that.data.personLi.info).userPassword,
  929. passwordStartTime: passwordStartTime,
  930. passwordEndTime: passwordEndTime,
  931. index: pincodeIndex,
  932. is: false,
  933. pass: true
  934. }
  935. var data1 = {
  936. cardId: that.data.personLi.cardId,
  937. content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1
  938. deviceNum: that.data.deviceinfo.deviceNum,
  939. type: 4,
  940. imei: that.data.deviceinfo.imei,
  941. serial: serialNumber,
  942. startTime: passwordStartTime,
  943. endTime: passwordEndTime,
  944. };
  945. var datalist = {
  946. cardId: that.data.personLi.cardId,
  947. content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1
  948. type: 14,
  949. startTime: passwordStartTime,
  950. endTime: passwordEndTime,
  951. };
  952. WXAPI.addCertificates(datalist).then(res6 => {
  953. console.log(datalist, '密码22', res6)
  954. })
  955. WXAPI.addCertificates(data1).then(res3 => {
  956. if (res3.success) {
  957. var updatedata = {
  958. id: res3.data,
  959. status: 1
  960. };
  961. WXAPI.updateCertificates(updatedata).then((res2) => {});
  962. WXAPI.sendCommand(data2).then(res => {
  963. })
  964. that.getPassword()
  965. that.setData({
  966. show: false
  967. })
  968. wx.hideLoading()
  969. wx.showToast({
  970. title: '添加成功',
  971. mask: true,
  972. icon: 'none',
  973. duration: 2000
  974. })
  975. } else {
  976. wx.hideLoading()
  977. wx.showToast({
  978. title: '添加失败',
  979. mask: true,
  980. icon: 'none',
  981. duration: 2000
  982. })
  983. }
  984. })
  985. taskId = 0
  986. that.setData({
  987. isPincodeAdd: true,
  988. show: false
  989. })
  990. wx.showModal({
  991. title: '提示',
  992. content: `添加密码${pincode}成功!`,
  993. showCancel: false
  994. })
  995. break
  996. }
  997. case 'delPincode': {
  998. wx.hideLoading()
  999. if (data.code != 200) {
  1000. var datacom = {
  1001. code: "lwj/passwordOperate",
  1002. data: {
  1003. lockerId: that.data.deviceinfo.deviceNum,
  1004. serialNumber: serialNumber,
  1005. index: pincodeIndex,
  1006. action: 2,
  1007. type: 9,
  1008. result: 0
  1009. }
  1010. }
  1011. WXAPI.sendCommand(datacom).then(res2 => {
  1012. console.log(res2, '失败')
  1013. })
  1014. wx.showModal({
  1015. title: '提示',
  1016. content: '删除密码失败!',
  1017. showCancel: false,
  1018. success: function (res) {}
  1019. })
  1020. break
  1021. }
  1022. taskId = 0
  1023. wx.showModal({
  1024. title: '提示',
  1025. content: `删除密码成功!`,
  1026. showCancel: false,
  1027. })
  1028. var datacom = {
  1029. code: "lwj/passwordOperate",
  1030. data: {
  1031. lockerId: that.data.deviceinfo.deviceNum,
  1032. serialNumber: serialNumber,
  1033. index: pincodeIndex,
  1034. action: 2,
  1035. type: 9,
  1036. result: 1
  1037. }
  1038. }
  1039. WXAPI.sendCommand(datacom).then(res2 => {
  1040. if (res2.success) {}
  1041. })
  1042. var data = {
  1043. ids: [passwordLiAll.id]
  1044. }
  1045. WXAPI.deleteCertificates(data).then(res1 => {
  1046. if (res1.success) {
  1047. that.getPassword()
  1048. wx.hideLoading()
  1049. wx.showToast({
  1050. title: '删除成功',
  1051. mask: true,
  1052. icon: 'none',
  1053. duration: 2000
  1054. })
  1055. } else {
  1056. wx.hideLoading()
  1057. wx.showToast({
  1058. title: '删除失败',
  1059. mask: true,
  1060. icon: 'none',
  1061. duration: 2000
  1062. })
  1063. }
  1064. })
  1065. that.setData({
  1066. isPincodeAdd: false
  1067. })
  1068. pincode = -1
  1069. pincodeIndex = -1
  1070. break
  1071. }
  1072. case 'addRfCard': {
  1073. wx.hideLoading()
  1074. if (data.code == 100) {
  1075. wx.showLoading({
  1076. title: data.data.msg,
  1077. })
  1078. break
  1079. } else if (data.code != 200) {
  1080. var datacom = {
  1081. code: "ble/bleSendVoucherReply",
  1082. data: {
  1083. deviceNum: that.data.deviceinfo.deviceNum,
  1084. serialNumber: serialNumber,
  1085. index: rfCardIndex,
  1086. type: ADD_NFC_MODE,
  1087. cardNo: '',
  1088. result: 0,
  1089. productId: that.data.deviceinfo.manufactureId
  1090. }
  1091. }
  1092. WXAPI.sendCommand(datacom).then(res2 => {})
  1093. wx.showModal({
  1094. title: '提示',
  1095. content: '添加房卡失败!' + data.data.msg,
  1096. showCancel: false,
  1097. success: function (res) {}
  1098. })
  1099. break
  1100. }
  1101. taskId = 0
  1102. that.setData({
  1103. isRfCardAdd: true
  1104. })
  1105. if (lockModel > 70) {
  1106. console.log(data.data, 'rfCardIndexrfCardIndex')
  1107. // rfCardId = randomMethods()
  1108. wx.showModal({
  1109. title: '提示',
  1110. content: `添加房卡成功,序号${rfCardIndex}`,
  1111. showCancel: false
  1112. })
  1113. that.addRfcardCertificates()
  1114. } else {
  1115. console.log(data.data, 'rfCardIndexrfCardIndex1')
  1116. // rfCardId = randomMethods()
  1117. wx.showModal({
  1118. title: '提示',
  1119. content: `添加房卡成功,卡号${rfCardId}`,
  1120. showCancel: false
  1121. })
  1122. that.addRfcardCertificates()
  1123. }
  1124. break
  1125. }
  1126. case 'delRfCard': {
  1127. wx.hideLoading()
  1128. if (data.code != 200) {
  1129. var datacom = {
  1130. code: "lwj/c",
  1131. data: {
  1132. lockerId: that.data.deviceinfo.deviceNum,
  1133. serialNumber: serialNumber,
  1134. index: rfCardIndex,
  1135. action: 2,
  1136. type: 12,
  1137. result: 0
  1138. }
  1139. }
  1140. WXAPI.sendCommand(datacom).then(res2 => {
  1141. console.log(res2, '失败')
  1142. })
  1143. wx.showModal({
  1144. title: '提示',
  1145. content: '删除房卡失败!',
  1146. showCancel: false,
  1147. success: function (res) {}
  1148. })
  1149. break
  1150. }
  1151. taskId = 0
  1152. that.setData({
  1153. isRfCardAdd: false
  1154. })
  1155. if (lockModel > 70) {
  1156. wx.showModal({
  1157. title: '提示',
  1158. content: `删除房卡成功,序号${rfCardIndex}`,
  1159. showCancel: false,
  1160. })
  1161. } else {
  1162. wx.showModal({
  1163. title: '提示',
  1164. content: `删除房卡成功,卡号${rfCardId}`,
  1165. showCancel: false,
  1166. })
  1167. }
  1168. var datacom = {
  1169. code: "lwj/c",
  1170. data: {
  1171. lockerId: that.data.deviceinfo.deviceNum,
  1172. serialNumber: serialNumber,
  1173. index: rfCardIndex,
  1174. action: 2,
  1175. type: 12,
  1176. result: 1
  1177. }
  1178. }
  1179. WXAPI.sendCommand(datacom).then(res2 => {
  1180. console.log(res2, '失败')
  1181. })
  1182. var data = {
  1183. ids: [passwordLiAll.id]
  1184. }
  1185. WXAPI.deleteCertificates(data).then(res1 => {
  1186. console.log(res1, '2936');
  1187. if (res1.success) {
  1188. that.getNfc()
  1189. wx.showToast({
  1190. title: '删除成功',
  1191. mask: true,
  1192. icon: 'none',
  1193. duration: 2000
  1194. })
  1195. } else {
  1196. wx.showToast({
  1197. title: '删除失败',
  1198. mask: true,
  1199. icon: 'none',
  1200. duration: 2000
  1201. })
  1202. }
  1203. })
  1204. rfCardId = -1
  1205. rfCardIndex = -1
  1206. break
  1207. }
  1208. case 'addFingerprint': {
  1209. wx.hideLoading()
  1210. if (data.code == 100) {
  1211. wx.showLoading({
  1212. title: data.data.msg,
  1213. })
  1214. break
  1215. } else if (data.code != 200) {
  1216. wx.showModal({
  1217. title: '提示',
  1218. content: '添加指纹失败!' + data.data.msg,
  1219. showCancel: false,
  1220. success: function (res) {}
  1221. })
  1222. var datacom = {
  1223. code: "ble/bleSendVoucherReply",
  1224. data: {
  1225. deviceNum: that.data.deviceinfo.deviceNum,
  1226. serialNumber: serialNumber,
  1227. index: 0,
  1228. type: 16,
  1229. result: 0,
  1230. productId: that.data.deviceinfo.manufactureId
  1231. }
  1232. }
  1233. WXAPI.sendCommand(datacom).then(res2 => {
  1234. if (res2.success) {}
  1235. })
  1236. break
  1237. }
  1238. taskId = 0
  1239. that.setData({
  1240. isFingerprintAdd: true
  1241. })
  1242. wx.showModal({
  1243. title: '提示',
  1244. content: `添加指纹成功,序号${fingerprintIndex}`,
  1245. showCancel: false
  1246. })
  1247. var time1 = new Date(that.data.starttime.replace(/-/g, '/'))
  1248. var time2 = new Date(that.data.endtime.replace(/-/g, '/'))
  1249. var passwordStartTime = time1.getTime() / 1000
  1250. var passwordEndTime = time2.getTime() / 1000
  1251. var cardName = '',
  1252. pzname = ''
  1253. if (that.data.pzname) {
  1254. cardName = that.data.personLi.name + '-蓝牙-' + that.data.pzname
  1255. pzname = '蓝牙-' + that.data.pzname
  1256. } else {
  1257. cardName = that.data.personLi.name + '-蓝牙-指纹' + (that.data.FpList.length + 1)
  1258. pzname = '蓝牙-指纹' + (that.data.FpList.length + 1)
  1259. }
  1260. var str = {
  1261. // cardId: this.personInfo.cardId,
  1262. imei: that.data.deviceinfo.imei,
  1263. pzname: pzname,
  1264. password: '',
  1265. fingerprintAlias: that.data.radioDetil,
  1266. userTelephone: JSON.parse(that.data.personLi.info).userTelephone,
  1267. operateMode: 16,
  1268. userPassword: JSON.parse(that.data.personLi.info).userPassword,
  1269. passwordStartTime: passwordStartTime,
  1270. passwordEndTime: passwordEndTime,
  1271. index: fingerprintIndex,
  1272. is: false,
  1273. pass: true
  1274. }
  1275. var data2 = {
  1276. cardId: that.data.personLi.cardId,
  1277. content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1
  1278. deviceNum: that.data.deviceinfo.deviceNum,
  1279. type: 1,
  1280. imei: that.data.deviceinfo.imei,
  1281. serial: serialNumber,
  1282. startTime: passwordStartTime,
  1283. endTime: passwordEndTime,
  1284. status: 1
  1285. };
  1286. var datalist = {
  1287. cardId: that.data.personLi.cardId,
  1288. content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1
  1289. type: 11,
  1290. startTime: passwordStartTime,
  1291. endTime: passwordEndTime
  1292. };
  1293. var datacom = {
  1294. code: "ble/bleSendVoucherReply",
  1295. data: {
  1296. deviceNum: that.data.deviceinfo.deviceNum,
  1297. serialNumber: serialNumber,
  1298. index: fingerprintIndex,
  1299. type: 16,
  1300. result: 1,
  1301. productId: that.data.deviceinfo.manufactureId
  1302. }
  1303. }
  1304. WXAPI.addCertificates(datalist).then(res6 => {})
  1305. console.log(data, '添加凭证')
  1306. WXAPI.addCertificates(data2).then(res3 => {
  1307. if (res3.success) {
  1308. var updatedata = {
  1309. id: res3.data,
  1310. status: 1
  1311. };
  1312. WXAPI.updateCertificates(updatedata).then((res2) => {});
  1313. WXAPI.sendCommand(datacom).then(res2 => {
  1314. if (res2.success) {}
  1315. })
  1316. console.log(res3, '添加凭证成功')
  1317. that.getFp()
  1318. that.setData({
  1319. show: false
  1320. })
  1321. wx.hideLoading()
  1322. wx.showToast({
  1323. title: '添加成功',
  1324. mask: true,
  1325. icon: 'none',
  1326. duration: 2000
  1327. })
  1328. } else {
  1329. wx.hideLoading()
  1330. wx.showToast({
  1331. title: '添加失败',
  1332. mask: true,
  1333. icon: 'none',
  1334. duration: 2000
  1335. })
  1336. }
  1337. })
  1338. break
  1339. }
  1340. case 'delFingerprint': {
  1341. wx.hideLoading()
  1342. if (data.code != 200) {
  1343. wx.showModal({
  1344. title: '提示',
  1345. content: '删除指纹失败!',
  1346. showCancel: false,
  1347. success: function (res) {}
  1348. })
  1349. break
  1350. }
  1351. taskId = 0
  1352. wx.showModal({
  1353. title: '提示',
  1354. content: `删除指纹成功,序号${fingerprintIndex}`,
  1355. showCancel: false,
  1356. })
  1357. that.setData({
  1358. isFingerprintAdd: false
  1359. })
  1360. fingerprintIndex = -1
  1361. break
  1362. }
  1363. case 'changeAdminPincode': {
  1364. wx.hideLoading()
  1365. if (data.code != 200) {
  1366. wx.showModal({
  1367. title: '提示',
  1368. content: '修改管理密码失败!',
  1369. showCancel: false,
  1370. success: function (res) {}
  1371. })
  1372. break
  1373. }
  1374. taskId = 0
  1375. wx.showToast({
  1376. title: '修改管理密码成功!',
  1377. })
  1378. }
  1379. case 'queryLockSlotState': {
  1380. wx.hideLoading()
  1381. if (data.code != 200) {
  1382. wx.showModal({
  1383. title: '提示',
  1384. content: '查询失败!',
  1385. showCancel: false,
  1386. success: function (res) {}
  1387. })
  1388. break
  1389. }
  1390. taskId = 0
  1391. wx.showModal({
  1392. title: '提示',
  1393. content: data.data.state == 0 ? '此门锁方舌关闭' : '此门锁方舌打开',
  1394. showCancel: false,
  1395. success: function (res) {}
  1396. })
  1397. break
  1398. }
  1399. case 'queryLockUnlockState': {
  1400. wx.hideLoading()
  1401. if (data.code != 200) {
  1402. wx.showModal({
  1403. title: '提示',
  1404. content: '查询失败!',
  1405. showCancel: false,
  1406. success: function (res) {}
  1407. })
  1408. break
  1409. }
  1410. taskId = 0
  1411. wx.showModal({
  1412. title: '提示',
  1413. content: data.data.state == 0 ? '此门锁已关闭' : '此门锁已打开',
  1414. showCancel: false,
  1415. success: function (res) {}
  1416. })
  1417. break
  1418. }
  1419. case 'setLockUnlockState': {
  1420. wx.hideLoading()
  1421. if (data.code != 200) {
  1422. wx.showModal({
  1423. title: '提示',
  1424. content: '设置常开指令失败!',
  1425. showCancel: false,
  1426. success: function (res) {}
  1427. })
  1428. break
  1429. }
  1430. taskId = 0
  1431. wx.showModal({
  1432. title: '提示',
  1433. content: data.data.state == 0 ? '常开模式已退出' : '常开模式已开启',
  1434. showCancel: false,
  1435. })
  1436. that.setData({
  1437. isUnloked: data.data.state == 1
  1438. })
  1439. break
  1440. }
  1441. case 'setLockMuteState': {
  1442. wx.hideLoading()
  1443. if (data.code != 200) {
  1444. wx.showModal({
  1445. title: '提示',
  1446. content: '设置静音指令失败!',
  1447. showCancel: false,
  1448. success: function (res) {}
  1449. })
  1450. break
  1451. }
  1452. taskId = 0
  1453. wx.showModal({
  1454. title: '提示',
  1455. content: data.data.state == 1 ? '静音模式已退出' : '静音模式已开启',
  1456. showCancel: false,
  1457. })
  1458. that.setData({
  1459. isMuted: data.data.state == 0
  1460. })
  1461. break
  1462. }
  1463. }
  1464. })
  1465. wx.notifyBLECharacteristicValueChange({
  1466. deviceId: lockDevice.deviceId,
  1467. serviceId: config.uuid.serviceUuid.toUpperCase(),
  1468. characteristicId: config.uuid.notifyUuid.toUpperCase(),
  1469. state: true,
  1470. success: function (res) {
  1471. console.log('setupNotify', res)
  1472. isInitReady = true
  1473. setTimeout(function () {
  1474. wx.hideLoading()
  1475. // that.onQueryBindState()
  1476. that.login()
  1477. }, 500)
  1478. },
  1479. })
  1480. },
  1481. })
  1482. },
  1483. })
  1484. },
  1485. doWork: function () {
  1486. var that = this
  1487. console.log(taskId);
  1488. switch (taskId) {
  1489. case 11: {
  1490. that.onBindLock()
  1491. break
  1492. }
  1493. case 12: {
  1494. that.onUnbindLock()
  1495. break
  1496. }
  1497. case 21: {
  1498. that.onQueryBindState()
  1499. break
  1500. }
  1501. case 22: {
  1502. that.onQueryBattery()
  1503. break
  1504. }
  1505. case 31: {
  1506. that.onQueryNbImei()
  1507. break
  1508. }
  1509. case 32: {
  1510. that.onLogin()
  1511. break
  1512. }
  1513. case 41: {
  1514. that.LwjonOpenLock()
  1515. break
  1516. }
  1517. case 42: {
  1518. that.onSyncClock()
  1519. break
  1520. }
  1521. case 51: {
  1522. that.onAddPincode()
  1523. break
  1524. }
  1525. case 52: {
  1526. that.onDelPincode()
  1527. break
  1528. }
  1529. case 61: {
  1530. // that.onAddRfCard()
  1531. // if (lockModel > 70) {
  1532. that.sendAddRfcard()
  1533. // } else {
  1534. // wx.showModal({
  1535. // title: '提示',
  1536. // content: '请刷卡!',
  1537. // showCancel: false
  1538. // })
  1539. // }
  1540. break
  1541. }
  1542. case 62: {
  1543. that.onDelRfCard()
  1544. break
  1545. }
  1546. case 71: {
  1547. that.onAddFingerprint()
  1548. break
  1549. }
  1550. case 72: {
  1551. that.onDelFingerprint()
  1552. break
  1553. }
  1554. case 81: {
  1555. that.onChangeAdminPincode()
  1556. break
  1557. }
  1558. case 91: {
  1559. that.onQueryLockSlotState()
  1560. break
  1561. }
  1562. case 92: {
  1563. that.onQueryLockUnlockState()
  1564. break
  1565. }
  1566. case 101: {
  1567. that.onChangeLockUnlockState()
  1568. break
  1569. }
  1570. case 102: {
  1571. that.onChangeLockMutedState()
  1572. break
  1573. }
  1574. case 111: {
  1575. this.onChangeLockNbState()
  1576. }
  1577. default: {
  1578. }
  1579. }
  1580. },
  1581. login: function () {
  1582. var that = this
  1583. taskId = 32
  1584. that.initBluetooth()
  1585. },
  1586. onLogin: function () {
  1587. var that = this
  1588. wx.showLoading({
  1589. title: '登录中',
  1590. })
  1591. var bytes = plugin.login1(lockDevice.name, basecode)
  1592. console.debug('bytes', bytes)
  1593. that.sendBytes(bytes)
  1594. },
  1595. /**
  1596. * 生命周期函数--监听页面初次渲染完成
  1597. */
  1598. onReady: function () {
  1599. },
  1600. /**
  1601. * 生命周期函数--监听页面显示
  1602. */
  1603. onShow: function () {
  1604. },
  1605. /**
  1606. * 生命周期函数--监听页面隐藏
  1607. */
  1608. onHide: function () {
  1609. },
  1610. /**
  1611. * 生命周期函数--监听页面卸载
  1612. */
  1613. onUnload: function () {
  1614. },
  1615. /**
  1616. * 页面相关事件处理函数--监听用户下拉动作
  1617. */
  1618. onPullDownRefresh: function () {
  1619. },
  1620. /**
  1621. * 页面上拉触底事件的处理函数
  1622. */
  1623. onReachBottom: function () {
  1624. },
  1625. /**
  1626. * 用户点击右上角分享
  1627. */
  1628. onShareAppMessage: function () {
  1629. }
  1630. })