npm install crypto-js var CryptoJS = require("crypto-js"); CryptoJS.HmacSHA1("Message", "Key")
var crypto = require('crypto'); 无效?做腾讯云的OCR识别,把腾讯云demo里的这段代码丢进js里,第一句就不跑,为啥? [代码]auth () { [代码] [代码] var[代码] [代码]crypto = require([代码][代码]'crypto'[代码][代码]);[代码] [代码] var[代码] [代码]secretId = [代码][代码]'YOUR SECRET_ID'[代码][代码],[代码][代码] [代码][代码]secretKey = [代码][代码]'YOUR SECRET_KEY'[代码][代码],[代码][代码] [代码][代码]appid = [代码][代码]'APPID'[代码][代码],[代码][代码] [代码][代码]pexpired = 86400,[代码][代码] [代码][代码]userid = 0;[代码] [代码] var[代码] [代码]now = parseInt(Date.now() / 1000),[代码][代码] [代码][代码]rdm = parseInt(Math.random() * Math.pow(2, 32)),[代码][代码] [代码][代码]plainText = [代码][代码]'a='[代码] [代码]+ appid + [代码][代码]'&k='[代码] [代码]+ secretId + [代码][代码]'&e='[代码] [代码]+ (now+pexpired) + [代码][代码]'&t='[代码] [代码]+ now + [代码][代码]'&r='[代码] [代码]+ rdm + userid + [代码][代码]'&f='[代码][代码],[代码][代码] [代码][代码]data = [代码][代码]new[代码] [代码]Buffer(plainText,[代码][代码]'utf8'[代码][代码]),[代码][代码] [代码][代码]res = crypto.createHmac([代码][代码]'sha1'[代码][代码],secretKey).update(data).digest(),[代码][代码] [代码][代码]bin = Buffer.concat([res,data]);[代码] [代码] var[代码] [代码]sign = bin.toString([代码][代码]'base64'[代码][代码]);[代码] [代码] [代码] return sign; } js有点菜,请赐教!
2021-03-08昨天问题解决了,1、查表条件不能用where,2、循环改for of ,希望碰到类似问题的,这样解决
循环+事务,操作减库存,存在多减,不减问题,请教解决一下?[图片]
2021-03-08