├── .DS_Store ├── README.md ├── cloudfunctions ├── addUser │ ├── index.js │ ├── package-lock.json │ └── package.json ├── imageCompose │ ├── config.json │ ├── index.js │ ├── package-lock.json │ └── package.json ├── imageDivision │ ├── config.json │ ├── index.js │ ├── package-lock.json │ └── package.json ├── setUserInfo │ ├── config.json │ ├── index.js │ ├── package-lock.json │ └── package.json ├── timingDelete │ ├── config.json │ ├── index.js │ └── package.json └── userFile │ ├── config.json │ ├── index.js │ └── package.json ├── miniprogram ├── .DS_Store ├── app.js ├── app.json ├── app.wxss ├── images │ ├── .DS_Store │ ├── index-active.png │ ├── index.png │ ├── me-active.png │ ├── me.png │ ├── noUser.png │ ├── person.png │ └── take.png ├── pages │ ├── .DS_Store │ ├── autoCamera │ │ ├── autoCamera.js │ │ ├── autoCamera.json │ │ ├── autoCamera.wxml │ │ └── autoCamera.wxss │ ├── editPhoto │ │ ├── complete │ │ │ ├── complete.js │ │ │ ├── complete.json │ │ │ ├── complete.wxml │ │ │ └── complete.wxss │ │ ├── editPhoto.js │ │ ├── editPhoto.json │ │ ├── editPhoto.wxml │ │ ├── editPhoto.wxss │ │ ├── hex-rgb.js │ │ └── images │ │ │ ├── move-white.png │ │ │ ├── move.png │ │ │ ├── use.png │ │ │ ├── zoom-white.png │ │ │ └── zoom.png │ ├── index │ │ ├── .DS_Store │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── mein │ │ ├── mein.js │ │ ├── mein.json │ │ ├── mein.wxml │ │ └── mein.wxss │ ├── preImgEdit │ │ ├── preImgEdit.js │ │ ├── preImgEdit.json │ │ ├── preImgEdit.wxml │ │ └── preImgEdit.wxss │ └── user-file │ │ ├── user-file.js │ │ ├── user-file.json │ │ ├── user-file.wxml │ │ └── user-file.wxss ├── sitemap.json └── tools │ └── dateFormatter.js ├── project.config.json └── project.private.config.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # photoEdit 2 | 微信小程序云开发,证件照小程序 3 | 微信搜索小程序,“AUTO证照”即可预览 4 | 5 | 6 | ![gh_c2c5344cd5d3_258](https://user-images.githubusercontent.com/29347995/147029972-4a52d2a6-85a2-4950-8a10-dc33360df087.jpg) 7 | 8 | 9 | 数据集合为: 10 | 11 | user 12 | 13 | user-file 14 | 15 | tmp-file 16 | 17 | preImgInfoList 18 | 19 | bannerList-simple 20 | 21 | -------------------------------------------------------------------------------- /cloudfunctions/addUser/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | 6 | const db = cloud.database() 7 | 8 | 9 | // 云函数入口函数 10 | exports.main = async (event, context) => { 11 | const wxContext = cloud.getWXContext() 12 | 13 | const openid = wxContext.OPENID 14 | 15 | const { data } = await db.collection('user').where({ openid }).get() 16 | 17 | if (data.length) return { openid } 18 | 19 | await db.collection('user').add({ 20 | data: { 21 | openid, 22 | create_time: db.serverDate(), 23 | signInDate: '' 24 | } 25 | }) 26 | 27 | return { 28 | openid: wxContext.OPENID, 29 | unionid: wxContext.UNIONID 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cloudfunctions/addUser/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "getBaiduToken", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@cloudbase/database": { 8 | "version": "0.9.10", 9 | "resolved": "https://registry.npmjs.org/@cloudbase/database/-/database-0.9.10.tgz", 10 | "integrity": "sha512-U640CrPVX3E+wAVqQqmsLankndmvYseepWMD5w6uStxSlr8s4jF7og7iL1dsxrfxA5iQ65vumYW7/yHreVL80Q==", 11 | "requires": { 12 | "bson": "^4.0.2", 13 | "lodash.clonedeep": "4.5.0", 14 | "lodash.set": "4.3.2", 15 | "lodash.unset": "4.5.2" 16 | } 17 | }, 18 | "@protobufjs/aspromise": { 19 | "version": "1.1.2", 20 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", 21 | "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" 22 | }, 23 | "@protobufjs/base64": { 24 | "version": "1.1.2", 25 | "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", 26 | "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" 27 | }, 28 | "@protobufjs/codegen": { 29 | "version": "2.0.4", 30 | "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", 31 | "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" 32 | }, 33 | "@protobufjs/eventemitter": { 34 | "version": "1.1.0", 35 | "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", 36 | "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" 37 | }, 38 | "@protobufjs/fetch": { 39 | "version": "1.1.0", 40 | "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", 41 | "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", 42 | "requires": { 43 | "@protobufjs/aspromise": "^1.1.1", 44 | "@protobufjs/inquire": "^1.1.0" 45 | } 46 | }, 47 | "@protobufjs/float": { 48 | "version": "1.0.2", 49 | "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", 50 | "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" 51 | }, 52 | "@protobufjs/inquire": { 53 | "version": "1.1.0", 54 | "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", 55 | "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" 56 | }, 57 | "@protobufjs/path": { 58 | "version": "1.1.2", 59 | "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", 60 | "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" 61 | }, 62 | "@protobufjs/pool": { 63 | "version": "1.1.0", 64 | "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", 65 | "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" 66 | }, 67 | "@protobufjs/utf8": { 68 | "version": "1.1.0", 69 | "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", 70 | "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" 71 | }, 72 | "@types/long": { 73 | "version": "4.0.1", 74 | "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", 75 | "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" 76 | }, 77 | "@types/node": { 78 | "version": "10.17.13", 79 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.13.tgz", 80 | "integrity": "sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==" 81 | }, 82 | "ajv": { 83 | "version": "6.11.0", 84 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", 85 | "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", 86 | "requires": { 87 | "fast-deep-equal": "^3.1.1", 88 | "fast-json-stable-stringify": "^2.0.0", 89 | "json-schema-traverse": "^0.4.1", 90 | "uri-js": "^4.2.2" 91 | } 92 | }, 93 | "asn1": { 94 | "version": "0.2.4", 95 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 96 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 97 | "requires": { 98 | "safer-buffer": "~2.1.0" 99 | } 100 | }, 101 | "assert-plus": { 102 | "version": "1.0.0", 103 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 104 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 105 | }, 106 | "asynckit": { 107 | "version": "0.4.0", 108 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 109 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 110 | }, 111 | "aws-sign2": { 112 | "version": "0.7.0", 113 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 114 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 115 | }, 116 | "aws4": { 117 | "version": "1.9.1", 118 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", 119 | "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" 120 | }, 121 | "base64-js": { 122 | "version": "1.3.1", 123 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", 124 | "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" 125 | }, 126 | "bcrypt-pbkdf": { 127 | "version": "1.0.2", 128 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 129 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 130 | "requires": { 131 | "tweetnacl": "^0.14.3" 132 | } 133 | }, 134 | "bson": { 135 | "version": "4.0.3", 136 | "resolved": "https://registry.npmjs.org/bson/-/bson-4.0.3.tgz", 137 | "integrity": "sha512-7uBjjxwOSuGLmoqGI1UXWpDGc0K2WjR7dC6iaOg4iriNZo6M2EEBb8co4dEPJ5ArYCebPMie0ecgX0TWF+ZUrQ==", 138 | "requires": { 139 | "buffer": "^5.1.0", 140 | "long": "^4.0.0" 141 | } 142 | }, 143 | "buffer": { 144 | "version": "5.4.3", 145 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", 146 | "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", 147 | "requires": { 148 | "base64-js": "^1.0.2", 149 | "ieee754": "^1.1.4" 150 | } 151 | }, 152 | "buffer-equal-constant-time": { 153 | "version": "1.0.1", 154 | "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", 155 | "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" 156 | }, 157 | "caseless": { 158 | "version": "0.12.0", 159 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 160 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 161 | }, 162 | "combined-stream": { 163 | "version": "1.0.8", 164 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 165 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 166 | "requires": { 167 | "delayed-stream": "~1.0.0" 168 | } 169 | }, 170 | "core-util-is": { 171 | "version": "1.0.2", 172 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 173 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 174 | }, 175 | "dashdash": { 176 | "version": "1.14.1", 177 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 178 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 179 | "requires": { 180 | "assert-plus": "^1.0.0" 181 | } 182 | }, 183 | "delayed-stream": { 184 | "version": "1.0.0", 185 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 186 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 187 | }, 188 | "ecc-jsbn": { 189 | "version": "0.1.2", 190 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 191 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 192 | "requires": { 193 | "jsbn": "~0.1.0", 194 | "safer-buffer": "^2.1.0" 195 | } 196 | }, 197 | "ecdsa-sig-formatter": { 198 | "version": "1.0.11", 199 | "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", 200 | "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", 201 | "requires": { 202 | "safe-buffer": "^5.0.1" 203 | } 204 | }, 205 | "extend": { 206 | "version": "3.0.2", 207 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 208 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 209 | }, 210 | "extsprintf": { 211 | "version": "1.3.0", 212 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 213 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 214 | }, 215 | "fast-deep-equal": { 216 | "version": "3.1.1", 217 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", 218 | "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" 219 | }, 220 | "fast-json-stable-stringify": { 221 | "version": "2.1.0", 222 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 223 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 224 | }, 225 | "forever-agent": { 226 | "version": "0.6.1", 227 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 228 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 229 | }, 230 | "form-data": { 231 | "version": "2.3.3", 232 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 233 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 234 | "requires": { 235 | "asynckit": "^0.4.0", 236 | "combined-stream": "^1.0.6", 237 | "mime-types": "^2.1.12" 238 | } 239 | }, 240 | "function-bind": { 241 | "version": "1.1.1", 242 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 243 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 244 | }, 245 | "getpass": { 246 | "version": "0.1.7", 247 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 248 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 249 | "requires": { 250 | "assert-plus": "^1.0.0" 251 | } 252 | }, 253 | "har-schema": { 254 | "version": "2.0.0", 255 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 256 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 257 | }, 258 | "har-validator": { 259 | "version": "5.1.3", 260 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", 261 | "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", 262 | "requires": { 263 | "ajv": "^6.5.5", 264 | "har-schema": "^2.0.0" 265 | } 266 | }, 267 | "has": { 268 | "version": "1.0.3", 269 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 270 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 271 | "requires": { 272 | "function-bind": "^1.1.1" 273 | } 274 | }, 275 | "http-signature": { 276 | "version": "1.2.0", 277 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 278 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 279 | "requires": { 280 | "assert-plus": "^1.0.0", 281 | "jsprim": "^1.2.2", 282 | "sshpk": "^1.7.0" 283 | } 284 | }, 285 | "ieee754": { 286 | "version": "1.1.13", 287 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", 288 | "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" 289 | }, 290 | "is-regex": { 291 | "version": "1.0.5", 292 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", 293 | "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", 294 | "requires": { 295 | "has": "^1.0.3" 296 | } 297 | }, 298 | "is-typedarray": { 299 | "version": "1.0.0", 300 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 301 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 302 | }, 303 | "isstream": { 304 | "version": "0.1.2", 305 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 306 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 307 | }, 308 | "jsbn": { 309 | "version": "0.1.1", 310 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 311 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 312 | }, 313 | "json-schema": { 314 | "version": "0.2.3", 315 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 316 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" 317 | }, 318 | "json-schema-traverse": { 319 | "version": "0.4.1", 320 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 321 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 322 | }, 323 | "json-stringify-safe": { 324 | "version": "5.0.1", 325 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 326 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 327 | }, 328 | "jsonwebtoken": { 329 | "version": "8.5.1", 330 | "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", 331 | "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", 332 | "requires": { 333 | "jws": "^3.2.2", 334 | "lodash.includes": "^4.3.0", 335 | "lodash.isboolean": "^3.0.3", 336 | "lodash.isinteger": "^4.0.4", 337 | "lodash.isnumber": "^3.0.3", 338 | "lodash.isplainobject": "^4.0.6", 339 | "lodash.isstring": "^4.0.1", 340 | "lodash.once": "^4.0.0", 341 | "ms": "^2.1.1", 342 | "semver": "^5.6.0" 343 | } 344 | }, 345 | "jsprim": { 346 | "version": "1.4.1", 347 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 348 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 349 | "requires": { 350 | "assert-plus": "1.0.0", 351 | "extsprintf": "1.3.0", 352 | "json-schema": "0.2.3", 353 | "verror": "1.10.0" 354 | } 355 | }, 356 | "jwa": { 357 | "version": "1.4.1", 358 | "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", 359 | "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", 360 | "requires": { 361 | "buffer-equal-constant-time": "1.0.1", 362 | "ecdsa-sig-formatter": "1.0.11", 363 | "safe-buffer": "^5.0.1" 364 | } 365 | }, 366 | "jws": { 367 | "version": "3.2.2", 368 | "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", 369 | "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", 370 | "requires": { 371 | "jwa": "^1.4.1", 372 | "safe-buffer": "^5.0.1" 373 | } 374 | }, 375 | "lodash.clonedeep": { 376 | "version": "4.5.0", 377 | "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", 378 | "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" 379 | }, 380 | "lodash.includes": { 381 | "version": "4.3.0", 382 | "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", 383 | "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" 384 | }, 385 | "lodash.isboolean": { 386 | "version": "3.0.3", 387 | "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", 388 | "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" 389 | }, 390 | "lodash.isinteger": { 391 | "version": "4.0.4", 392 | "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", 393 | "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" 394 | }, 395 | "lodash.isnumber": { 396 | "version": "3.0.3", 397 | "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", 398 | "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" 399 | }, 400 | "lodash.isplainobject": { 401 | "version": "4.0.6", 402 | "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", 403 | "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" 404 | }, 405 | "lodash.isstring": { 406 | "version": "4.0.1", 407 | "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", 408 | "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" 409 | }, 410 | "lodash.merge": { 411 | "version": "4.6.2", 412 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 413 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" 414 | }, 415 | "lodash.once": { 416 | "version": "4.1.1", 417 | "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", 418 | "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" 419 | }, 420 | "lodash.set": { 421 | "version": "4.3.2", 422 | "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", 423 | "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" 424 | }, 425 | "lodash.unset": { 426 | "version": "4.5.2", 427 | "resolved": "https://registry.npmjs.org/lodash.unset/-/lodash.unset-4.5.2.tgz", 428 | "integrity": "sha1-Nw0dPoW3Kn4bDN8tJyEhMG8j5O0=" 429 | }, 430 | "long": { 431 | "version": "4.0.0", 432 | "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", 433 | "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" 434 | }, 435 | "mime-db": { 436 | "version": "1.43.0", 437 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", 438 | "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" 439 | }, 440 | "mime-types": { 441 | "version": "2.1.26", 442 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", 443 | "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", 444 | "requires": { 445 | "mime-db": "1.43.0" 446 | } 447 | }, 448 | "ms": { 449 | "version": "2.1.2", 450 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 451 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 452 | }, 453 | "oauth-sign": { 454 | "version": "0.9.0", 455 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 456 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 457 | }, 458 | "performance-now": { 459 | "version": "2.1.0", 460 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 461 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 462 | }, 463 | "protobufjs": { 464 | "version": "6.8.8", 465 | "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", 466 | "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", 467 | "requires": { 468 | "@protobufjs/aspromise": "^1.1.2", 469 | "@protobufjs/base64": "^1.1.2", 470 | "@protobufjs/codegen": "^2.0.4", 471 | "@protobufjs/eventemitter": "^1.1.0", 472 | "@protobufjs/fetch": "^1.1.0", 473 | "@protobufjs/float": "^1.0.2", 474 | "@protobufjs/inquire": "^1.1.0", 475 | "@protobufjs/path": "^1.1.2", 476 | "@protobufjs/pool": "^1.1.0", 477 | "@protobufjs/utf8": "^1.1.0", 478 | "@types/long": "^4.0.0", 479 | "@types/node": "^10.1.0", 480 | "long": "^4.0.0" 481 | } 482 | }, 483 | "psl": { 484 | "version": "1.7.0", 485 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", 486 | "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" 487 | }, 488 | "punycode": { 489 | "version": "2.1.1", 490 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 491 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 492 | }, 493 | "qs": { 494 | "version": "6.5.2", 495 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 496 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 497 | }, 498 | "request": { 499 | "version": "2.88.0", 500 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", 501 | "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", 502 | "requires": { 503 | "aws-sign2": "~0.7.0", 504 | "aws4": "^1.8.0", 505 | "caseless": "~0.12.0", 506 | "combined-stream": "~1.0.6", 507 | "extend": "~3.0.2", 508 | "forever-agent": "~0.6.1", 509 | "form-data": "~2.3.2", 510 | "har-validator": "~5.1.0", 511 | "http-signature": "~1.2.0", 512 | "is-typedarray": "~1.0.0", 513 | "isstream": "~0.1.2", 514 | "json-stringify-safe": "~5.0.1", 515 | "mime-types": "~2.1.19", 516 | "oauth-sign": "~0.9.0", 517 | "performance-now": "^2.1.0", 518 | "qs": "~6.5.2", 519 | "safe-buffer": "^5.1.2", 520 | "tough-cookie": "~2.4.3", 521 | "tunnel-agent": "^0.6.0", 522 | "uuid": "^3.3.2" 523 | } 524 | }, 525 | "safe-buffer": { 526 | "version": "5.2.0", 527 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", 528 | "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" 529 | }, 530 | "safer-buffer": { 531 | "version": "2.1.2", 532 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 533 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 534 | }, 535 | "sax": { 536 | "version": "1.2.4", 537 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 538 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 539 | }, 540 | "semver": { 541 | "version": "5.7.1", 542 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 543 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 544 | }, 545 | "sshpk": { 546 | "version": "1.16.1", 547 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 548 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 549 | "requires": { 550 | "asn1": "~0.2.3", 551 | "assert-plus": "^1.0.0", 552 | "bcrypt-pbkdf": "^1.0.0", 553 | "dashdash": "^1.12.0", 554 | "ecc-jsbn": "~0.1.1", 555 | "getpass": "^0.1.1", 556 | "jsbn": "~0.1.0", 557 | "safer-buffer": "^2.0.2", 558 | "tweetnacl": "~0.14.0" 559 | } 560 | }, 561 | "tcb-admin-node": { 562 | "version": "1.19.1", 563 | "resolved": "https://registry.npmjs.org/tcb-admin-node/-/tcb-admin-node-1.19.1.tgz", 564 | "integrity": "sha512-bHGkYQUYk8kxPGot4Ea6LgoS/Lr3F2/ic9qVslpEKjfXs4gQ6pNK/P/sd50RqRsree7H1bsTNnarXau73Vb6Vw==", 565 | "requires": { 566 | "@cloudbase/database": "^0.9.10", 567 | "is-regex": "^1.0.4", 568 | "jsonwebtoken": "^8.5.1", 569 | "lodash.merge": "^4.6.1", 570 | "request": "^2.87.0", 571 | "xml2js": "^0.4.19" 572 | } 573 | }, 574 | "tough-cookie": { 575 | "version": "2.4.3", 576 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", 577 | "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", 578 | "requires": { 579 | "psl": "^1.1.24", 580 | "punycode": "^1.4.1" 581 | }, 582 | "dependencies": { 583 | "punycode": { 584 | "version": "1.4.1", 585 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", 586 | "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" 587 | } 588 | } 589 | }, 590 | "tslib": { 591 | "version": "1.10.0", 592 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", 593 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" 594 | }, 595 | "tunnel-agent": { 596 | "version": "0.6.0", 597 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 598 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 599 | "requires": { 600 | "safe-buffer": "^5.0.1" 601 | } 602 | }, 603 | "tweetnacl": { 604 | "version": "0.14.5", 605 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 606 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 607 | }, 608 | "uri-js": { 609 | "version": "4.2.2", 610 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 611 | "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 612 | "requires": { 613 | "punycode": "^2.1.0" 614 | } 615 | }, 616 | "uuid": { 617 | "version": "3.4.0", 618 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 619 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 620 | }, 621 | "verror": { 622 | "version": "1.10.0", 623 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 624 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 625 | "requires": { 626 | "assert-plus": "^1.0.0", 627 | "core-util-is": "1.0.2", 628 | "extsprintf": "^1.2.0" 629 | } 630 | }, 631 | "wx-server-sdk": { 632 | "version": "1.8.0", 633 | "resolved": "https://registry.npmjs.org/wx-server-sdk/-/wx-server-sdk-1.8.0.tgz", 634 | "integrity": "sha512-g6fOCTFvzZc/3krQX1p4yK0BYsc6xPfLkD6IUg6L9w3XFTozKyZJpZJ791dsN/jVDqCgxjECnIFClYrp1GAqeA==", 635 | "requires": { 636 | "protobufjs": "6.8.8", 637 | "tcb-admin-node": "1.19.1", 638 | "tslib": "^1.9.3" 639 | } 640 | }, 641 | "xml2js": { 642 | "version": "0.4.23", 643 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", 644 | "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", 645 | "requires": { 646 | "sax": ">=0.6.0", 647 | "xmlbuilder": "~11.0.0" 648 | } 649 | }, 650 | "xmlbuilder": { 651 | "version": "11.0.1", 652 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 653 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 654 | } 655 | } 656 | } 657 | -------------------------------------------------------------------------------- /cloudfunctions/addUser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "getBaiduToken", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "latest" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cloudfunctions/imageCompose/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloudfunctions/imageCompose/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | const http = require('http') 4 | const https = require('https') 5 | const dayjs = require('dayjs') 6 | const images = require('images') 7 | 8 | cloud.init() 9 | 10 | const db = cloud.database() 11 | 12 | // 云函数入口函数 13 | exports.main = async (event, context) => { 14 | const wxContext = cloud.getWXContext() 15 | const openid = wxContext.OPENID 16 | const photoName = event.photoName || '默认' 17 | const imgBcgTip = event.imgBcgTip || '自定义' 18 | const imgType = event.imgType || 'png' || 'jpg' || 'jpeg' || 'gif' || 'bmp' || 'raw' || 'webp' 19 | const dataType = event.dataType || 'fileID' || 'base64' || 'url' 20 | const VImage = event.data || [] 21 | const img = await renderImg(VImage) 22 | const resContent = await getContentByDataType(photoName, imgBcgTip, img, dataType, imgType, openid) 23 | 24 | return { 25 | imgType, 26 | dataType, 27 | value: resContent 28 | } 29 | 30 | } 31 | 32 | // 渲染图片 33 | function renderImg (VImage) { 34 | return VImage.reduce(async (preRomise, curData) => { 35 | 36 | const preResult = await preRomise 37 | let { width, height, x = 0, y = 0 } = curData 38 | width = +((+width).toFixed()) 39 | height = +((+height).toFixed()) 40 | x = +((+x).toFixed()) 41 | y = +((+y).toFixed()) 42 | 43 | let image = await createImage(curData) 44 | image = imageResize(image, width, height) 45 | 46 | if (preResult) return drawImg(preResult, image, x, y, width, height) 47 | else return image 48 | 49 | }, Promise.resolve()) 50 | } 51 | 52 | // 获取文件内容 base64 或 文件id 或 url 53 | async function getContentByDataType (photoName, imgBcgTip, img, dataType, imgType, openid) { 54 | const imgName = `${Date.now()}-${Math.random()}.${imgType}` 55 | const imgBuffer = img.toBuffer(imgType) 56 | if (dataType === 'base64') return imgBuffer.toString('base64') 57 | const fileID = await cloudUploadFile(`tmp/imgCompose/${openid}/${dayjs().format('YYYY-MM-DD')}/${imgName}`, imgBuffer) 58 | db.collection('tmp-file').add({ data: { time: db.serverDate(), fileID: fileID } }) 59 | db.collection('user-file').add({ data: { openid: openid, photoName:photoName, imgBcgTip:imgBcgTip, time: db.serverDate(), fileID: fileID } }) 60 | if (dataType === 'fileID') return fileID 61 | if (dataType === 'url') return await getFileUrlByFileID(fileID) 62 | } 63 | 64 | // 获取文件的临时访问url 65 | async function getFileUrlByFileID (fileID) { 66 | return (await cloud.getTempFileURL({ 67 | fileList: [fileID] 68 | })).fileList[0].tempFileURL 69 | } 70 | 71 | // 上传图片到云存储,返回图片id 72 | async function cloudUploadFile (cloudPath, fileContent) { 73 | return (await cloud.uploadFile({ cloudPath, fileContent })).fileID 74 | } 75 | 76 | // 根据云存储id 获取图片buffer 77 | async function getCloudBuffer (fileID) { 78 | return (await cloud.downloadFile({ fileID: fileID })).fileContent 79 | } 80 | 81 | // 根据http地址获取图片 buffer 82 | function getHttpBuffer (src) { 83 | const protocol = src.split('://')[0] 84 | return new Promise((resolve, reject) => { 85 | ;({ http, https }[protocol]).get(src, res => { 86 | if (res.statusCode !== 200) return reject(new Error('图片加载失败')) 87 | const rawData = [] 88 | res.setEncoding('binary') 89 | res.on('data', chunk => rawData.push(chunk)) 90 | res.on('end', () => resolve(Buffer.from(rawData.join(''), 'binary'))) 91 | }) 92 | }) 93 | } 94 | 95 | // 创建图片 96 | async function createImage (data) { 97 | if (data.bgc && data.bgc.length) return images(+data.width, +data.height).fill(...data.bgc) 98 | else if (data.imgId) return images(await getCloudBuffer(data.imgId)) 99 | else if (data.src) return images(await getHttpBuffer(data.src)) 100 | else return images(+data.width, +data.height) 101 | } 102 | 103 | // 图片设置宽高 104 | function imageResize (image, width, height) { 105 | if (!width && !height) return image 106 | const size = image.size() 107 | if (width === size.width && height === size.height) return image 108 | if (width && height) return image.resize(width, height) 109 | if (width) return image.width(width) 110 | if (height) return image.height(height) 111 | } 112 | 113 | // 将图片画在 一张图上 114 | function drawImg (baseImg, img, x, y, width, height) { 115 | if (x >= 0 && y >= 0) return baseImg.draw(img, x, y) 116 | img = images(img, x < 0 ? Math.abs(x) : 0, y < 0 ? Math.abs(y) : 0, width, height) 117 | return baseImg.draw(img, x > 0 ? x : 0, y > 0 ? y : 0) 118 | } 119 | 120 | -------------------------------------------------------------------------------- /cloudfunctions/imageCompose/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "imageCompose", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@cloudbase/database": { 8 | "version": "1.2.2", 9 | "resolved": "https://registry.npmjs.org/@cloudbase/database/-/database-1.2.2.tgz", 10 | "integrity": "sha512-14GPoD0vdVnfdN+4rHlMmpkxAekFklt4X2gi33iCuoZUDC62p5LWS7OuTjoronnZ4QPsZPCKm+WsjE8mVD+Hmw==", 11 | "requires": { 12 | "bson": "^4.0.3", 13 | "lodash.clonedeep": "4.5.0", 14 | "lodash.set": "4.3.2", 15 | "lodash.unset": "4.5.2" 16 | } 17 | }, 18 | "@cloudbase/node-sdk": { 19 | "version": "2.4.7", 20 | "resolved": "https://registry.npmjs.org/@cloudbase/node-sdk/-/node-sdk-2.4.7.tgz", 21 | "integrity": "sha512-gMtp+25nAJzpXTxpZzN7PTtsTdv6m7SNRszMwPpWB3pwAYyefbuOkR505iv+kYugsX6MkbgKjcCQ/F5dpNMMYw==", 22 | "requires": { 23 | "@cloudbase/database": "1.2.2", 24 | "@cloudbase/signature-nodejs": "1.0.0-beta.0", 25 | "@types/retry": "^0.12.0", 26 | "agentkeepalive": "^4.1.3", 27 | "is-regex": "^1.0.4", 28 | "jsonwebtoken": "^8.5.1", 29 | "lodash.merge": "^4.6.1", 30 | "request": "^2.87.0", 31 | "request-promise": "^4.2.5", 32 | "retry": "^0.12.0", 33 | "ts-node": "^8.10.2", 34 | "xml2js": "^0.4.19" 35 | } 36 | }, 37 | "@cloudbase/signature-nodejs": { 38 | "version": "1.0.0-beta.0", 39 | "resolved": "https://registry.npmjs.org/@cloudbase/signature-nodejs/-/signature-nodejs-1.0.0-beta.0.tgz", 40 | "integrity": "sha512-gpKqwsVk/D2PzvFamYNReymXSdvRSY90eZ1ARf+1wZ8oT6OpK9kr6nmevGykMxN1n17Gn92hBbWqAxU9o3+kAQ==", 41 | "requires": { 42 | "@types/clone": "^0.1.30", 43 | "clone": "^2.1.2", 44 | "is-stream": "^2.0.0", 45 | "url": "^0.11.0" 46 | } 47 | }, 48 | "@protobufjs/aspromise": { 49 | "version": "1.1.2", 50 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", 51 | "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" 52 | }, 53 | "@protobufjs/base64": { 54 | "version": "1.1.2", 55 | "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", 56 | "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" 57 | }, 58 | "@protobufjs/codegen": { 59 | "version": "2.0.4", 60 | "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", 61 | "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" 62 | }, 63 | "@protobufjs/eventemitter": { 64 | "version": "1.1.0", 65 | "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", 66 | "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" 67 | }, 68 | "@protobufjs/fetch": { 69 | "version": "1.1.0", 70 | "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", 71 | "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", 72 | "requires": { 73 | "@protobufjs/aspromise": "^1.1.1", 74 | "@protobufjs/inquire": "^1.1.0" 75 | } 76 | }, 77 | "@protobufjs/float": { 78 | "version": "1.0.2", 79 | "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", 80 | "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" 81 | }, 82 | "@protobufjs/inquire": { 83 | "version": "1.1.0", 84 | "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", 85 | "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" 86 | }, 87 | "@protobufjs/path": { 88 | "version": "1.1.2", 89 | "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", 90 | "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" 91 | }, 92 | "@protobufjs/pool": { 93 | "version": "1.1.0", 94 | "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", 95 | "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" 96 | }, 97 | "@protobufjs/utf8": { 98 | "version": "1.1.0", 99 | "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", 100 | "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" 101 | }, 102 | "@types/clone": { 103 | "version": "0.1.30", 104 | "resolved": "https://registry.npmjs.org/@types/clone/-/clone-0.1.30.tgz", 105 | "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=" 106 | }, 107 | "@types/long": { 108 | "version": "4.0.1", 109 | "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", 110 | "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" 111 | }, 112 | "@types/node": { 113 | "version": "10.17.60", 114 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", 115 | "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" 116 | }, 117 | "@types/retry": { 118 | "version": "0.12.1", 119 | "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", 120 | "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" 121 | }, 122 | "agentkeepalive": { 123 | "version": "4.1.4", 124 | "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.1.4.tgz", 125 | "integrity": "sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ==", 126 | "requires": { 127 | "debug": "^4.1.0", 128 | "depd": "^1.1.2", 129 | "humanize-ms": "^1.2.1" 130 | } 131 | }, 132 | "ajv": { 133 | "version": "6.12.6", 134 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 135 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", 136 | "requires": { 137 | "fast-deep-equal": "^3.1.1", 138 | "fast-json-stable-stringify": "^2.0.0", 139 | "json-schema-traverse": "^0.4.1", 140 | "uri-js": "^4.2.2" 141 | } 142 | }, 143 | "arg": { 144 | "version": "4.1.3", 145 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", 146 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" 147 | }, 148 | "asn1": { 149 | "version": "0.2.6", 150 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", 151 | "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", 152 | "requires": { 153 | "safer-buffer": "~2.1.0" 154 | } 155 | }, 156 | "assert-plus": { 157 | "version": "1.0.0", 158 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 159 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 160 | }, 161 | "asynckit": { 162 | "version": "0.4.0", 163 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 164 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 165 | }, 166 | "aws-sign2": { 167 | "version": "0.7.0", 168 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 169 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 170 | }, 171 | "aws4": { 172 | "version": "1.11.0", 173 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", 174 | "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" 175 | }, 176 | "base64-js": { 177 | "version": "1.5.1", 178 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 179 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" 180 | }, 181 | "bcrypt-pbkdf": { 182 | "version": "1.0.2", 183 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 184 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 185 | "requires": { 186 | "tweetnacl": "^0.14.3" 187 | } 188 | }, 189 | "bluebird": { 190 | "version": "3.7.2", 191 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", 192 | "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" 193 | }, 194 | "bson": { 195 | "version": "4.6.0", 196 | "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.0.tgz", 197 | "integrity": "sha512-8jw1NU1hglS+Da1jDOUYuNcBJ4cNHCFIqzlwoFNnsTOg2R/ox0aTYcTiBN4dzRa9q7Cvy6XErh3L8ReTEb9AQQ==", 198 | "requires": { 199 | "buffer": "^5.6.0" 200 | } 201 | }, 202 | "buffer": { 203 | "version": "5.7.1", 204 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", 205 | "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", 206 | "requires": { 207 | "base64-js": "^1.3.1", 208 | "ieee754": "^1.1.13" 209 | } 210 | }, 211 | "buffer-equal-constant-time": { 212 | "version": "1.0.1", 213 | "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", 214 | "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" 215 | }, 216 | "buffer-from": { 217 | "version": "1.1.2", 218 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", 219 | "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" 220 | }, 221 | "call-bind": { 222 | "version": "1.0.2", 223 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 224 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 225 | "requires": { 226 | "function-bind": "^1.1.1", 227 | "get-intrinsic": "^1.0.2" 228 | } 229 | }, 230 | "caseless": { 231 | "version": "0.12.0", 232 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 233 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 234 | }, 235 | "clone": { 236 | "version": "2.1.2", 237 | "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", 238 | "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" 239 | }, 240 | "combined-stream": { 241 | "version": "1.0.8", 242 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 243 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 244 | "requires": { 245 | "delayed-stream": "~1.0.0" 246 | } 247 | }, 248 | "core-util-is": { 249 | "version": "1.0.2", 250 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 251 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 252 | }, 253 | "dashdash": { 254 | "version": "1.14.1", 255 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 256 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 257 | "requires": { 258 | "assert-plus": "^1.0.0" 259 | } 260 | }, 261 | "dayjs": { 262 | "version": "1.10.7", 263 | "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz", 264 | "integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==" 265 | }, 266 | "debug": { 267 | "version": "4.3.3", 268 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", 269 | "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", 270 | "requires": { 271 | "ms": "2.1.2" 272 | } 273 | }, 274 | "delayed-stream": { 275 | "version": "1.0.0", 276 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 277 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 278 | }, 279 | "depd": { 280 | "version": "1.1.2", 281 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 282 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 283 | }, 284 | "diff": { 285 | "version": "4.0.2", 286 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 287 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" 288 | }, 289 | "ecc-jsbn": { 290 | "version": "0.1.2", 291 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 292 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 293 | "requires": { 294 | "jsbn": "~0.1.0", 295 | "safer-buffer": "^2.1.0" 296 | } 297 | }, 298 | "ecdsa-sig-formatter": { 299 | "version": "1.0.11", 300 | "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", 301 | "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", 302 | "requires": { 303 | "safe-buffer": "^5.0.1" 304 | } 305 | }, 306 | "extend": { 307 | "version": "3.0.2", 308 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 309 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 310 | }, 311 | "extsprintf": { 312 | "version": "1.3.0", 313 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 314 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 315 | }, 316 | "fast-deep-equal": { 317 | "version": "3.1.3", 318 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 319 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" 320 | }, 321 | "fast-json-stable-stringify": { 322 | "version": "2.1.0", 323 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 324 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 325 | }, 326 | "forever-agent": { 327 | "version": "0.6.1", 328 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 329 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 330 | }, 331 | "form-data": { 332 | "version": "2.3.3", 333 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 334 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 335 | "requires": { 336 | "asynckit": "^0.4.0", 337 | "combined-stream": "^1.0.6", 338 | "mime-types": "^2.1.12" 339 | } 340 | }, 341 | "function-bind": { 342 | "version": "1.1.1", 343 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 344 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 345 | }, 346 | "get-intrinsic": { 347 | "version": "1.1.1", 348 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", 349 | "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", 350 | "requires": { 351 | "function-bind": "^1.1.1", 352 | "has": "^1.0.3", 353 | "has-symbols": "^1.0.1" 354 | } 355 | }, 356 | "getpass": { 357 | "version": "0.1.7", 358 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 359 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 360 | "requires": { 361 | "assert-plus": "^1.0.0" 362 | } 363 | }, 364 | "har-schema": { 365 | "version": "2.0.0", 366 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 367 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 368 | }, 369 | "har-validator": { 370 | "version": "5.1.5", 371 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", 372 | "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", 373 | "requires": { 374 | "ajv": "^6.12.3", 375 | "har-schema": "^2.0.0" 376 | } 377 | }, 378 | "has": { 379 | "version": "1.0.3", 380 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 381 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 382 | "requires": { 383 | "function-bind": "^1.1.1" 384 | } 385 | }, 386 | "has-symbols": { 387 | "version": "1.0.2", 388 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", 389 | "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" 390 | }, 391 | "has-tostringtag": { 392 | "version": "1.0.0", 393 | "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", 394 | "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", 395 | "requires": { 396 | "has-symbols": "^1.0.2" 397 | } 398 | }, 399 | "http-signature": { 400 | "version": "1.2.0", 401 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 402 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 403 | "requires": { 404 | "assert-plus": "^1.0.0", 405 | "jsprim": "^1.2.2", 406 | "sshpk": "^1.7.0" 407 | } 408 | }, 409 | "humanize-ms": { 410 | "version": "1.2.1", 411 | "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", 412 | "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", 413 | "requires": { 414 | "ms": "^2.0.0" 415 | } 416 | }, 417 | "ieee754": { 418 | "version": "1.2.1", 419 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", 420 | "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" 421 | }, 422 | "images": { 423 | "version": "3.2.3", 424 | "resolved": "https://registry.npmjs.org/images/-/images-3.2.3.tgz", 425 | "integrity": "sha512-Ga7WPuo1krAdgE+pH641Q2NeAetJsNoU4wjC9DKGpSptWJ/Ljle6m2oA0XdO2c5ujy1Ups8UoH28ejR74m/vqQ==" 426 | }, 427 | "is-regex": { 428 | "version": "1.1.4", 429 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", 430 | "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", 431 | "requires": { 432 | "call-bind": "^1.0.2", 433 | "has-tostringtag": "^1.0.0" 434 | } 435 | }, 436 | "is-stream": { 437 | "version": "2.0.1", 438 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", 439 | "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" 440 | }, 441 | "is-typedarray": { 442 | "version": "1.0.0", 443 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 444 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 445 | }, 446 | "isstream": { 447 | "version": "0.1.2", 448 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 449 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 450 | }, 451 | "jsbn": { 452 | "version": "0.1.1", 453 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 454 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 455 | }, 456 | "json-schema": { 457 | "version": "0.4.0", 458 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", 459 | "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" 460 | }, 461 | "json-schema-traverse": { 462 | "version": "0.4.1", 463 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 464 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 465 | }, 466 | "json-stringify-safe": { 467 | "version": "5.0.1", 468 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 469 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 470 | }, 471 | "jsonwebtoken": { 472 | "version": "8.5.1", 473 | "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", 474 | "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", 475 | "requires": { 476 | "jws": "^3.2.2", 477 | "lodash.includes": "^4.3.0", 478 | "lodash.isboolean": "^3.0.3", 479 | "lodash.isinteger": "^4.0.4", 480 | "lodash.isnumber": "^3.0.3", 481 | "lodash.isplainobject": "^4.0.6", 482 | "lodash.isstring": "^4.0.1", 483 | "lodash.once": "^4.0.0", 484 | "ms": "^2.1.1", 485 | "semver": "^5.6.0" 486 | } 487 | }, 488 | "jsprim": { 489 | "version": "1.4.2", 490 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", 491 | "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", 492 | "requires": { 493 | "assert-plus": "1.0.0", 494 | "extsprintf": "1.3.0", 495 | "json-schema": "0.4.0", 496 | "verror": "1.10.0" 497 | } 498 | }, 499 | "jwa": { 500 | "version": "1.4.1", 501 | "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", 502 | "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", 503 | "requires": { 504 | "buffer-equal-constant-time": "1.0.1", 505 | "ecdsa-sig-formatter": "1.0.11", 506 | "safe-buffer": "^5.0.1" 507 | } 508 | }, 509 | "jws": { 510 | "version": "3.2.2", 511 | "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", 512 | "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", 513 | "requires": { 514 | "jwa": "^1.4.1", 515 | "safe-buffer": "^5.0.1" 516 | } 517 | }, 518 | "lodash": { 519 | "version": "4.17.21", 520 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 521 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" 522 | }, 523 | "lodash.clonedeep": { 524 | "version": "4.5.0", 525 | "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", 526 | "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" 527 | }, 528 | "lodash.includes": { 529 | "version": "4.3.0", 530 | "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", 531 | "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" 532 | }, 533 | "lodash.isboolean": { 534 | "version": "3.0.3", 535 | "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", 536 | "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" 537 | }, 538 | "lodash.isinteger": { 539 | "version": "4.0.4", 540 | "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", 541 | "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" 542 | }, 543 | "lodash.isnumber": { 544 | "version": "3.0.3", 545 | "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", 546 | "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" 547 | }, 548 | "lodash.isplainobject": { 549 | "version": "4.0.6", 550 | "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", 551 | "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" 552 | }, 553 | "lodash.isstring": { 554 | "version": "4.0.1", 555 | "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", 556 | "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" 557 | }, 558 | "lodash.merge": { 559 | "version": "4.6.2", 560 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 561 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" 562 | }, 563 | "lodash.once": { 564 | "version": "4.1.1", 565 | "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", 566 | "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" 567 | }, 568 | "lodash.set": { 569 | "version": "4.3.2", 570 | "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", 571 | "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" 572 | }, 573 | "lodash.unset": { 574 | "version": "4.5.2", 575 | "resolved": "https://registry.npmjs.org/lodash.unset/-/lodash.unset-4.5.2.tgz", 576 | "integrity": "sha1-Nw0dPoW3Kn4bDN8tJyEhMG8j5O0=" 577 | }, 578 | "long": { 579 | "version": "4.0.0", 580 | "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", 581 | "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" 582 | }, 583 | "make-error": { 584 | "version": "1.3.6", 585 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 586 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" 587 | }, 588 | "mime-db": { 589 | "version": "1.51.0", 590 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", 591 | "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" 592 | }, 593 | "mime-types": { 594 | "version": "2.1.34", 595 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", 596 | "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", 597 | "requires": { 598 | "mime-db": "1.51.0" 599 | } 600 | }, 601 | "ms": { 602 | "version": "2.1.2", 603 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 604 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 605 | }, 606 | "oauth-sign": { 607 | "version": "0.9.0", 608 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 609 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 610 | }, 611 | "performance-now": { 612 | "version": "2.1.0", 613 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 614 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 615 | }, 616 | "protobufjs": { 617 | "version": "6.8.8", 618 | "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", 619 | "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", 620 | "requires": { 621 | "@protobufjs/aspromise": "^1.1.2", 622 | "@protobufjs/base64": "^1.1.2", 623 | "@protobufjs/codegen": "^2.0.4", 624 | "@protobufjs/eventemitter": "^1.1.0", 625 | "@protobufjs/fetch": "^1.1.0", 626 | "@protobufjs/float": "^1.0.2", 627 | "@protobufjs/inquire": "^1.1.0", 628 | "@protobufjs/path": "^1.1.2", 629 | "@protobufjs/pool": "^1.1.0", 630 | "@protobufjs/utf8": "^1.1.0", 631 | "@types/long": "^4.0.0", 632 | "@types/node": "^10.1.0", 633 | "long": "^4.0.0" 634 | } 635 | }, 636 | "psl": { 637 | "version": "1.8.0", 638 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", 639 | "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" 640 | }, 641 | "punycode": { 642 | "version": "1.3.2", 643 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", 644 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" 645 | }, 646 | "qs": { 647 | "version": "6.5.2", 648 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 649 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 650 | }, 651 | "querystring": { 652 | "version": "0.2.0", 653 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", 654 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" 655 | }, 656 | "request": { 657 | "version": "2.88.2", 658 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", 659 | "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", 660 | "requires": { 661 | "aws-sign2": "~0.7.0", 662 | "aws4": "^1.8.0", 663 | "caseless": "~0.12.0", 664 | "combined-stream": "~1.0.6", 665 | "extend": "~3.0.2", 666 | "forever-agent": "~0.6.1", 667 | "form-data": "~2.3.2", 668 | "har-validator": "~5.1.3", 669 | "http-signature": "~1.2.0", 670 | "is-typedarray": "~1.0.0", 671 | "isstream": "~0.1.2", 672 | "json-stringify-safe": "~5.0.1", 673 | "mime-types": "~2.1.19", 674 | "oauth-sign": "~0.9.0", 675 | "performance-now": "^2.1.0", 676 | "qs": "~6.5.2", 677 | "safe-buffer": "^5.1.2", 678 | "tough-cookie": "~2.5.0", 679 | "tunnel-agent": "^0.6.0", 680 | "uuid": "^3.3.2" 681 | } 682 | }, 683 | "request-promise": { 684 | "version": "4.2.6", 685 | "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz", 686 | "integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==", 687 | "requires": { 688 | "bluebird": "^3.5.0", 689 | "request-promise-core": "1.1.4", 690 | "stealthy-require": "^1.1.1", 691 | "tough-cookie": "^2.3.3" 692 | } 693 | }, 694 | "request-promise-core": { 695 | "version": "1.1.4", 696 | "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", 697 | "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", 698 | "requires": { 699 | "lodash": "^4.17.19" 700 | } 701 | }, 702 | "retry": { 703 | "version": "0.12.0", 704 | "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", 705 | "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" 706 | }, 707 | "safe-buffer": { 708 | "version": "5.2.1", 709 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 710 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 711 | }, 712 | "safer-buffer": { 713 | "version": "2.1.2", 714 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 715 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 716 | }, 717 | "sax": { 718 | "version": "1.2.4", 719 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 720 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 721 | }, 722 | "semver": { 723 | "version": "5.7.1", 724 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 725 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 726 | }, 727 | "source-map": { 728 | "version": "0.6.1", 729 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 730 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" 731 | }, 732 | "source-map-support": { 733 | "version": "0.5.21", 734 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", 735 | "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", 736 | "requires": { 737 | "buffer-from": "^1.0.0", 738 | "source-map": "^0.6.0" 739 | } 740 | }, 741 | "sshpk": { 742 | "version": "1.16.1", 743 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 744 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 745 | "requires": { 746 | "asn1": "~0.2.3", 747 | "assert-plus": "^1.0.0", 748 | "bcrypt-pbkdf": "^1.0.0", 749 | "dashdash": "^1.12.0", 750 | "ecc-jsbn": "~0.1.1", 751 | "getpass": "^0.1.1", 752 | "jsbn": "~0.1.0", 753 | "safer-buffer": "^2.0.2", 754 | "tweetnacl": "~0.14.0" 755 | } 756 | }, 757 | "stealthy-require": { 758 | "version": "1.1.1", 759 | "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", 760 | "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" 761 | }, 762 | "tcb-admin-node": { 763 | "version": "1.23.0", 764 | "resolved": "https://registry.npmjs.org/tcb-admin-node/-/tcb-admin-node-1.23.0.tgz", 765 | "integrity": "sha512-SAbjTqMsSi63SId1BJ4kWdyGJzhxh9Tjvy3YXxcsoaAC2PtASn4UIYsBsiNEUfcn58QEn2tdvCvvf69WLLjjrg==", 766 | "requires": { 767 | "@cloudbase/database": "0.9.15", 768 | "@cloudbase/signature-nodejs": "^1.0.0-beta.0", 769 | "is-regex": "^1.0.4", 770 | "jsonwebtoken": "^8.5.1", 771 | "lodash.merge": "^4.6.1", 772 | "request": "^2.87.0", 773 | "xml2js": "^0.4.19" 774 | }, 775 | "dependencies": { 776 | "@cloudbase/database": { 777 | "version": "0.9.15", 778 | "resolved": "https://registry.npmjs.org/@cloudbase/database/-/database-0.9.15.tgz", 779 | "integrity": "sha512-63e7iIl+van41B39Tw4ScNe9TRCt+5GHjc7q6i8NzkWBLC3U3KlbWo79YHsUHUPI79POpQ8UMlMVo7HXIAO3dg==", 780 | "requires": { 781 | "bson": "^4.0.2", 782 | "lodash.clonedeep": "4.5.0", 783 | "lodash.set": "4.3.2", 784 | "lodash.unset": "4.5.2" 785 | } 786 | } 787 | } 788 | }, 789 | "tough-cookie": { 790 | "version": "2.5.0", 791 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", 792 | "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", 793 | "requires": { 794 | "psl": "^1.1.28", 795 | "punycode": "^2.1.1" 796 | }, 797 | "dependencies": { 798 | "punycode": { 799 | "version": "2.1.1", 800 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 801 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 802 | } 803 | } 804 | }, 805 | "ts-node": { 806 | "version": "8.10.2", 807 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", 808 | "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", 809 | "requires": { 810 | "arg": "^4.1.0", 811 | "diff": "^4.0.1", 812 | "make-error": "^1.1.1", 813 | "source-map-support": "^0.5.17", 814 | "yn": "3.1.1" 815 | } 816 | }, 817 | "tslib": { 818 | "version": "1.14.1", 819 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", 820 | "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" 821 | }, 822 | "tunnel-agent": { 823 | "version": "0.6.0", 824 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 825 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 826 | "requires": { 827 | "safe-buffer": "^5.0.1" 828 | } 829 | }, 830 | "tweetnacl": { 831 | "version": "0.14.5", 832 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 833 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 834 | }, 835 | "uri-js": { 836 | "version": "4.4.1", 837 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", 838 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", 839 | "requires": { 840 | "punycode": "^2.1.0" 841 | }, 842 | "dependencies": { 843 | "punycode": { 844 | "version": "2.1.1", 845 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 846 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 847 | } 848 | } 849 | }, 850 | "url": { 851 | "version": "0.11.0", 852 | "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", 853 | "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", 854 | "requires": { 855 | "punycode": "1.3.2", 856 | "querystring": "0.2.0" 857 | } 858 | }, 859 | "uuid": { 860 | "version": "3.4.0", 861 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 862 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 863 | }, 864 | "verror": { 865 | "version": "1.10.0", 866 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 867 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 868 | "requires": { 869 | "assert-plus": "^1.0.0", 870 | "core-util-is": "1.0.2", 871 | "extsprintf": "^1.2.0" 872 | } 873 | }, 874 | "wx-server-sdk": { 875 | "version": "2.5.3", 876 | "resolved": "https://registry.npmjs.org/wx-server-sdk/-/wx-server-sdk-2.5.3.tgz", 877 | "integrity": "sha512-UrLSvDZGb5iUhOikZAD7FtgaOXfobfnegc5mSQZ/MGghiLMNOL73Vb3xHIUPK41N4Hax9BTqMALscGuNJS5wqA==", 878 | "requires": { 879 | "@cloudbase/node-sdk": "2.4.7", 880 | "protobufjs": "6.8.8", 881 | "tcb-admin-node": "^1.23.0", 882 | "tslib": "^1.9.3" 883 | } 884 | }, 885 | "xml2js": { 886 | "version": "0.4.23", 887 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", 888 | "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", 889 | "requires": { 890 | "sax": ">=0.6.0", 891 | "xmlbuilder": "~11.0.0" 892 | } 893 | }, 894 | "xmlbuilder": { 895 | "version": "11.0.1", 896 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 897 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 898 | }, 899 | "yn": { 900 | "version": "3.1.1", 901 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", 902 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" 903 | } 904 | } 905 | } 906 | -------------------------------------------------------------------------------- /cloudfunctions/imageCompose/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "imageCompose", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "latest", 13 | "images": "^3.2.3", 14 | "dayjs": "^1.10.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cloudfunctions/imageDivision/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloudfunctions/imageDivision/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | const http = require('http') 4 | const https = require('https') 5 | const dayjs = require('dayjs') 6 | const AipBodyAnalysisClient = require("baidu-aip-sdk").bodyanalysis; 7 | 8 | // 设置APPID/AK/SK 9 | const APP_ID = process.env.APP_ID; 10 | const API_KEY = process.env.API_KEY; 11 | const SECRET_KEY = process.env.SECRET_KEY; 12 | 13 | 14 | // 新建一个对象,建议只保存一个对象调用服务接口 15 | const client = new AipBodyAnalysisClient(APP_ID, API_KEY, SECRET_KEY); 16 | 17 | cloud.init() 18 | 19 | const db = cloud.database() 20 | 21 | // 云函数入口函数 22 | exports.main = async (event, context) => { 23 | 24 | const wxContext = cloud.getWXContext() 25 | const openid = wxContext.OPENID 26 | 27 | db.collection('tmp-file').add({ data: { time: db.serverDate(), fileID: event.fileID } }) 28 | // 获取图片url地址 29 | const tempFileURL = await getFileUrlByFileID(event.fileID) 30 | 31 | // 云存储图片处理地址 返回这个地址, 精细抠图可能还会用 32 | const tmpOriginImgSrc = encodeURI(`${tempFileURL}?imageMogr2/thumbnail/1500x1500|imageMogr2/format/jpg`) 33 | // 获取图片buffer 34 | const imgBuffer = await getHttpBuffer(tmpOriginImgSrc) 35 | // 图片的base64 36 | const imageBase64 = encodeURI(imgBuffer.toString('base64')) 37 | //百度人像人脸检测 38 | const { result, result_num } = (await client.gesture(imageBase64)) 39 | 40 | if(!result.length || result_num !==1 || result[0].classname !=='Face') return { res:false, msg: '图片不符合要求' } 41 | 42 | // 百度人像分割结果 43 | const { foreground, error_code, error_msg } = (await client.bodySeg(imageBase64, { type: 'foreground' })) 44 | 45 | if (error_code) return { res:false, msg: error_msg } 46 | if (!foreground) return { res:false, foreground, error_code, error_msg } 47 | 48 | const resultFileId = await uploadBase64(foreground, openid) 49 | db.collection('tmp-file').add({ data: { time: db.serverDate(), fileID: resultFileId } }) 50 | 51 | 52 | return { 53 | res:true, 54 | tmpOriginImgSrc, 55 | imageDivisionResultFileId: resultFileId 56 | } 57 | } 58 | 59 | // 获取文件的临时访问url 60 | async function getFileUrlByFileID (fileID) { 61 | return (await cloud.getTempFileURL({ 62 | fileList: [fileID] 63 | })).fileList[0].tempFileURL 64 | } 65 | 66 | // 根据http地址获取图片 buffer 67 | function getHttpBuffer (src) { 68 | const protocol = src.split('://')[0] 69 | return new Promise((resolve, reject) => { 70 | ;({ http, https }[protocol]).get(src, res => { 71 | if (res.statusCode !== 200) return reject(new Error('图片加载失败')) 72 | let rawData = '' 73 | res.setEncoding('binary') 74 | res.on('data', chunk => (rawData += chunk)) 75 | res.on('end', () => resolve(Buffer.from(rawData, 'binary'))) 76 | }) 77 | }) 78 | } 79 | 80 | // base64 转为图片,存入云存储, 返回文件id 81 | async function uploadBase64 (base64, openid) { 82 | // base64 转为buffer 83 | const buffer = Buffer.from(base64, 'base64') 84 | // 临时文件名 85 | const temFileName = `${Date.now()}-${Math.random()}.png` 86 | 87 | // 将图片上传到云存储,并拿到文件id 88 | return await cloudUploadFile(`tmp/imgDivision/${openid}/${dayjs().format('YYYY-MM-DD')}/${temFileName}`, buffer) 89 | 90 | } 91 | 92 | // 上传图片到云存储,返回图片id 93 | async function cloudUploadFile (cloudPath, fileContent) { 94 | return (await cloud.uploadFile({ cloudPath, fileContent })).fileID 95 | } -------------------------------------------------------------------------------- /cloudfunctions/imageDivision/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "imageDivision", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "latest", 13 | "baidu-aip-sdk": "^2.4.6", 14 | "dayjs": "^1.10.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cloudfunctions/setUserInfo/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloudfunctions/setUserInfo/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | 6 | // 云函数入口函数 7 | exports.main = async (event, context) => { 8 | const wxContext = cloud.getWXContext() 9 | const data = Object.assign({}, event.data) 10 | delete data._id 11 | const db = cloud.database() 12 | const res = await db.collection('user').where({ 13 | openid: event.openid || wxContext.OPENID 14 | }).update({ data }) 15 | 16 | return { 17 | res, 18 | event, 19 | openid: wxContext.OPENID, 20 | appid: wxContext.APPID, 21 | unionid: wxContext.UNIONID, 22 | } 23 | } -------------------------------------------------------------------------------- /cloudfunctions/setUserInfo/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setUserInfo", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@cloudbase/database": { 8 | "version": "1.0.0-beta.1", 9 | "resolved": "https://registry.npmjs.org/@cloudbase/database/-/database-1.0.0-beta.1.tgz", 10 | "integrity": "sha512-C3sZfIWe4a1kEZkhlxQh2WtMubJpt7NYF0rUT0fOfPY5mrxNq74xo0EnxPROpbW0cLvTFZvSFruGuqxQEQkuDw==", 11 | "requires": { 12 | "bson": "^4.0.3", 13 | "lodash.clonedeep": "4.5.0", 14 | "lodash.set": "4.3.2", 15 | "lodash.unset": "4.5.2" 16 | } 17 | }, 18 | "@cloudbase/node-sdk": { 19 | "version": "2.0.0-beta.5", 20 | "resolved": "https://registry.npmjs.org/@cloudbase/node-sdk/-/node-sdk-2.0.0-beta.5.tgz", 21 | "integrity": "sha512-rHV5hRiMKcJciqAfKWS/0QWkOwuc7YXKbN1fVcLsO7H6YE8vC+T+6/KuGpHgpDKXVeuxKoRmm30/tLbIwdOAFQ==", 22 | "requires": { 23 | "@cloudbase/database": "1.0.0-beta.1", 24 | "@cloudbase/signature-nodejs": "1.0.0-beta.0", 25 | "is-regex": "^1.0.4", 26 | "jsonwebtoken": "^8.5.1", 27 | "lodash.merge": "^4.6.1", 28 | "request": "^2.87.0", 29 | "request-promise": "^4.2.5", 30 | "tcb-admin-node": "1.23.0", 31 | "xml2js": "^0.4.19" 32 | } 33 | }, 34 | "@cloudbase/signature-nodejs": { 35 | "version": "1.0.0-beta.0", 36 | "resolved": "https://registry.npmjs.org/@cloudbase/signature-nodejs/-/signature-nodejs-1.0.0-beta.0.tgz", 37 | "integrity": "sha512-gpKqwsVk/D2PzvFamYNReymXSdvRSY90eZ1ARf+1wZ8oT6OpK9kr6nmevGykMxN1n17Gn92hBbWqAxU9o3+kAQ==", 38 | "requires": { 39 | "@types/clone": "^0.1.30", 40 | "clone": "^2.1.2", 41 | "is-stream": "^2.0.0", 42 | "url": "^0.11.0" 43 | } 44 | }, 45 | "@protobufjs/aspromise": { 46 | "version": "1.1.2", 47 | "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", 48 | "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" 49 | }, 50 | "@protobufjs/base64": { 51 | "version": "1.1.2", 52 | "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", 53 | "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" 54 | }, 55 | "@protobufjs/codegen": { 56 | "version": "2.0.4", 57 | "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", 58 | "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" 59 | }, 60 | "@protobufjs/eventemitter": { 61 | "version": "1.1.0", 62 | "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", 63 | "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" 64 | }, 65 | "@protobufjs/fetch": { 66 | "version": "1.1.0", 67 | "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", 68 | "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", 69 | "requires": { 70 | "@protobufjs/aspromise": "^1.1.1", 71 | "@protobufjs/inquire": "^1.1.0" 72 | } 73 | }, 74 | "@protobufjs/float": { 75 | "version": "1.0.2", 76 | "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", 77 | "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" 78 | }, 79 | "@protobufjs/inquire": { 80 | "version": "1.1.0", 81 | "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", 82 | "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" 83 | }, 84 | "@protobufjs/path": { 85 | "version": "1.1.2", 86 | "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", 87 | "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" 88 | }, 89 | "@protobufjs/pool": { 90 | "version": "1.1.0", 91 | "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", 92 | "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" 93 | }, 94 | "@protobufjs/utf8": { 95 | "version": "1.1.0", 96 | "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", 97 | "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" 98 | }, 99 | "@types/clone": { 100 | "version": "0.1.30", 101 | "resolved": "https://registry.npmjs.org/@types/clone/-/clone-0.1.30.tgz", 102 | "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=" 103 | }, 104 | "@types/long": { 105 | "version": "4.0.1", 106 | "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", 107 | "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" 108 | }, 109 | "@types/node": { 110 | "version": "10.17.21", 111 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", 112 | "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" 113 | }, 114 | "ajv": { 115 | "version": "6.12.2", 116 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", 117 | "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", 118 | "requires": { 119 | "fast-deep-equal": "^3.1.1", 120 | "fast-json-stable-stringify": "^2.0.0", 121 | "json-schema-traverse": "^0.4.1", 122 | "uri-js": "^4.2.2" 123 | } 124 | }, 125 | "asn1": { 126 | "version": "0.2.4", 127 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 128 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 129 | "requires": { 130 | "safer-buffer": "~2.1.0" 131 | } 132 | }, 133 | "assert-plus": { 134 | "version": "1.0.0", 135 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 136 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 137 | }, 138 | "asynckit": { 139 | "version": "0.4.0", 140 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 141 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 142 | }, 143 | "aws-sign2": { 144 | "version": "0.7.0", 145 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 146 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 147 | }, 148 | "aws4": { 149 | "version": "1.9.1", 150 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", 151 | "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" 152 | }, 153 | "base64-js": { 154 | "version": "1.3.1", 155 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", 156 | "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" 157 | }, 158 | "bcrypt-pbkdf": { 159 | "version": "1.0.2", 160 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 161 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 162 | "requires": { 163 | "tweetnacl": "^0.14.3" 164 | } 165 | }, 166 | "bluebird": { 167 | "version": "3.7.2", 168 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", 169 | "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" 170 | }, 171 | "bson": { 172 | "version": "4.0.4", 173 | "resolved": "https://registry.npmjs.org/bson/-/bson-4.0.4.tgz", 174 | "integrity": "sha512-Ioi3TD0/1V3aI8+hPfC56TetYmzfq2H07jJa9A1lKTxWsFtHtYdLMGMXjtGEg9v0f72NSM07diRQEUNYhLupIA==", 175 | "requires": { 176 | "buffer": "^5.1.0", 177 | "long": "^4.0.0" 178 | } 179 | }, 180 | "buffer": { 181 | "version": "5.6.0", 182 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", 183 | "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", 184 | "requires": { 185 | "base64-js": "^1.0.2", 186 | "ieee754": "^1.1.4" 187 | } 188 | }, 189 | "buffer-equal-constant-time": { 190 | "version": "1.0.1", 191 | "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", 192 | "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" 193 | }, 194 | "caseless": { 195 | "version": "0.12.0", 196 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 197 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 198 | }, 199 | "clone": { 200 | "version": "2.1.2", 201 | "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", 202 | "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" 203 | }, 204 | "combined-stream": { 205 | "version": "1.0.8", 206 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 207 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 208 | "requires": { 209 | "delayed-stream": "~1.0.0" 210 | } 211 | }, 212 | "core-util-is": { 213 | "version": "1.0.2", 214 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 215 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 216 | }, 217 | "dashdash": { 218 | "version": "1.14.1", 219 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 220 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 221 | "requires": { 222 | "assert-plus": "^1.0.0" 223 | } 224 | }, 225 | "delayed-stream": { 226 | "version": "1.0.0", 227 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 228 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 229 | }, 230 | "ecc-jsbn": { 231 | "version": "0.1.2", 232 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 233 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 234 | "requires": { 235 | "jsbn": "~0.1.0", 236 | "safer-buffer": "^2.1.0" 237 | } 238 | }, 239 | "ecdsa-sig-formatter": { 240 | "version": "1.0.11", 241 | "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", 242 | "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", 243 | "requires": { 244 | "safe-buffer": "^5.0.1" 245 | } 246 | }, 247 | "extend": { 248 | "version": "3.0.2", 249 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 250 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 251 | }, 252 | "extsprintf": { 253 | "version": "1.3.0", 254 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 255 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 256 | }, 257 | "fast-deep-equal": { 258 | "version": "3.1.1", 259 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", 260 | "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" 261 | }, 262 | "fast-json-stable-stringify": { 263 | "version": "2.1.0", 264 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 265 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 266 | }, 267 | "forever-agent": { 268 | "version": "0.6.1", 269 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 270 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 271 | }, 272 | "form-data": { 273 | "version": "2.3.3", 274 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 275 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 276 | "requires": { 277 | "asynckit": "^0.4.0", 278 | "combined-stream": "^1.0.6", 279 | "mime-types": "^2.1.12" 280 | } 281 | }, 282 | "function-bind": { 283 | "version": "1.1.1", 284 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 285 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 286 | }, 287 | "getpass": { 288 | "version": "0.1.7", 289 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 290 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 291 | "requires": { 292 | "assert-plus": "^1.0.0" 293 | } 294 | }, 295 | "har-schema": { 296 | "version": "2.0.0", 297 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 298 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 299 | }, 300 | "har-validator": { 301 | "version": "5.1.3", 302 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", 303 | "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", 304 | "requires": { 305 | "ajv": "^6.5.5", 306 | "har-schema": "^2.0.0" 307 | } 308 | }, 309 | "has": { 310 | "version": "1.0.3", 311 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 312 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 313 | "requires": { 314 | "function-bind": "^1.1.1" 315 | } 316 | }, 317 | "http-signature": { 318 | "version": "1.2.0", 319 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 320 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 321 | "requires": { 322 | "assert-plus": "^1.0.0", 323 | "jsprim": "^1.2.2", 324 | "sshpk": "^1.7.0" 325 | } 326 | }, 327 | "ieee754": { 328 | "version": "1.1.13", 329 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", 330 | "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" 331 | }, 332 | "is-regex": { 333 | "version": "1.0.5", 334 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", 335 | "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", 336 | "requires": { 337 | "has": "^1.0.3" 338 | } 339 | }, 340 | "is-stream": { 341 | "version": "2.0.0", 342 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", 343 | "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" 344 | }, 345 | "is-typedarray": { 346 | "version": "1.0.0", 347 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 348 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 349 | }, 350 | "isstream": { 351 | "version": "0.1.2", 352 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 353 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 354 | }, 355 | "jsbn": { 356 | "version": "0.1.1", 357 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 358 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 359 | }, 360 | "json-schema": { 361 | "version": "0.2.3", 362 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 363 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" 364 | }, 365 | "json-schema-traverse": { 366 | "version": "0.4.1", 367 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 368 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 369 | }, 370 | "json-stringify-safe": { 371 | "version": "5.0.1", 372 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 373 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 374 | }, 375 | "jsonwebtoken": { 376 | "version": "8.5.1", 377 | "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", 378 | "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", 379 | "requires": { 380 | "jws": "^3.2.2", 381 | "lodash.includes": "^4.3.0", 382 | "lodash.isboolean": "^3.0.3", 383 | "lodash.isinteger": "^4.0.4", 384 | "lodash.isnumber": "^3.0.3", 385 | "lodash.isplainobject": "^4.0.6", 386 | "lodash.isstring": "^4.0.1", 387 | "lodash.once": "^4.0.0", 388 | "ms": "^2.1.1", 389 | "semver": "^5.6.0" 390 | } 391 | }, 392 | "jsprim": { 393 | "version": "1.4.1", 394 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 395 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 396 | "requires": { 397 | "assert-plus": "1.0.0", 398 | "extsprintf": "1.3.0", 399 | "json-schema": "0.2.3", 400 | "verror": "1.10.0" 401 | } 402 | }, 403 | "jwa": { 404 | "version": "1.4.1", 405 | "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", 406 | "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", 407 | "requires": { 408 | "buffer-equal-constant-time": "1.0.1", 409 | "ecdsa-sig-formatter": "1.0.11", 410 | "safe-buffer": "^5.0.1" 411 | } 412 | }, 413 | "jws": { 414 | "version": "3.2.2", 415 | "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", 416 | "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", 417 | "requires": { 418 | "jwa": "^1.4.1", 419 | "safe-buffer": "^5.0.1" 420 | } 421 | }, 422 | "lodash": { 423 | "version": "4.17.15", 424 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", 425 | "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" 426 | }, 427 | "lodash.clonedeep": { 428 | "version": "4.5.0", 429 | "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", 430 | "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" 431 | }, 432 | "lodash.includes": { 433 | "version": "4.3.0", 434 | "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", 435 | "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" 436 | }, 437 | "lodash.isboolean": { 438 | "version": "3.0.3", 439 | "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", 440 | "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" 441 | }, 442 | "lodash.isinteger": { 443 | "version": "4.0.4", 444 | "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", 445 | "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" 446 | }, 447 | "lodash.isnumber": { 448 | "version": "3.0.3", 449 | "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", 450 | "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" 451 | }, 452 | "lodash.isplainobject": { 453 | "version": "4.0.6", 454 | "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", 455 | "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" 456 | }, 457 | "lodash.isstring": { 458 | "version": "4.0.1", 459 | "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", 460 | "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" 461 | }, 462 | "lodash.merge": { 463 | "version": "4.6.2", 464 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 465 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" 466 | }, 467 | "lodash.once": { 468 | "version": "4.1.1", 469 | "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", 470 | "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" 471 | }, 472 | "lodash.set": { 473 | "version": "4.3.2", 474 | "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", 475 | "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" 476 | }, 477 | "lodash.unset": { 478 | "version": "4.5.2", 479 | "resolved": "https://registry.npmjs.org/lodash.unset/-/lodash.unset-4.5.2.tgz", 480 | "integrity": "sha1-Nw0dPoW3Kn4bDN8tJyEhMG8j5O0=" 481 | }, 482 | "long": { 483 | "version": "4.0.0", 484 | "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", 485 | "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" 486 | }, 487 | "mime-db": { 488 | "version": "1.44.0", 489 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", 490 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" 491 | }, 492 | "mime-types": { 493 | "version": "2.1.27", 494 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 495 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 496 | "requires": { 497 | "mime-db": "1.44.0" 498 | } 499 | }, 500 | "ms": { 501 | "version": "2.1.2", 502 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 503 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 504 | }, 505 | "oauth-sign": { 506 | "version": "0.9.0", 507 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 508 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 509 | }, 510 | "performance-now": { 511 | "version": "2.1.0", 512 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 513 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 514 | }, 515 | "protobufjs": { 516 | "version": "6.8.8", 517 | "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", 518 | "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", 519 | "requires": { 520 | "@protobufjs/aspromise": "^1.1.2", 521 | "@protobufjs/base64": "^1.1.2", 522 | "@protobufjs/codegen": "^2.0.4", 523 | "@protobufjs/eventemitter": "^1.1.0", 524 | "@protobufjs/fetch": "^1.1.0", 525 | "@protobufjs/float": "^1.0.2", 526 | "@protobufjs/inquire": "^1.1.0", 527 | "@protobufjs/path": "^1.1.2", 528 | "@protobufjs/pool": "^1.1.0", 529 | "@protobufjs/utf8": "^1.1.0", 530 | "@types/long": "^4.0.0", 531 | "@types/node": "^10.1.0", 532 | "long": "^4.0.0" 533 | } 534 | }, 535 | "psl": { 536 | "version": "1.8.0", 537 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", 538 | "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" 539 | }, 540 | "punycode": { 541 | "version": "1.3.2", 542 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", 543 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" 544 | }, 545 | "qs": { 546 | "version": "6.5.2", 547 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 548 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 549 | }, 550 | "querystring": { 551 | "version": "0.2.0", 552 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", 553 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" 554 | }, 555 | "request": { 556 | "version": "2.88.2", 557 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", 558 | "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", 559 | "requires": { 560 | "aws-sign2": "~0.7.0", 561 | "aws4": "^1.8.0", 562 | "caseless": "~0.12.0", 563 | "combined-stream": "~1.0.6", 564 | "extend": "~3.0.2", 565 | "forever-agent": "~0.6.1", 566 | "form-data": "~2.3.2", 567 | "har-validator": "~5.1.3", 568 | "http-signature": "~1.2.0", 569 | "is-typedarray": "~1.0.0", 570 | "isstream": "~0.1.2", 571 | "json-stringify-safe": "~5.0.1", 572 | "mime-types": "~2.1.19", 573 | "oauth-sign": "~0.9.0", 574 | "performance-now": "^2.1.0", 575 | "qs": "~6.5.2", 576 | "safe-buffer": "^5.1.2", 577 | "tough-cookie": "~2.5.0", 578 | "tunnel-agent": "^0.6.0", 579 | "uuid": "^3.3.2" 580 | } 581 | }, 582 | "request-promise": { 583 | "version": "4.2.5", 584 | "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.5.tgz", 585 | "integrity": "sha512-ZgnepCykFdmpq86fKGwqntyTiUrHycALuGggpyCZwMvGaZWgxW6yagT0FHkgo5LzYvOaCNvxYwWYIjevSH1EDg==", 586 | "requires": { 587 | "bluebird": "^3.5.0", 588 | "request-promise-core": "1.1.3", 589 | "stealthy-require": "^1.1.1", 590 | "tough-cookie": "^2.3.3" 591 | } 592 | }, 593 | "request-promise-core": { 594 | "version": "1.1.3", 595 | "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", 596 | "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", 597 | "requires": { 598 | "lodash": "^4.17.15" 599 | } 600 | }, 601 | "safe-buffer": { 602 | "version": "5.2.1", 603 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 604 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 605 | }, 606 | "safer-buffer": { 607 | "version": "2.1.2", 608 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 609 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 610 | }, 611 | "sax": { 612 | "version": "1.2.4", 613 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 614 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 615 | }, 616 | "semver": { 617 | "version": "5.7.1", 618 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 619 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 620 | }, 621 | "sshpk": { 622 | "version": "1.16.1", 623 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 624 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 625 | "requires": { 626 | "asn1": "~0.2.3", 627 | "assert-plus": "^1.0.0", 628 | "bcrypt-pbkdf": "^1.0.0", 629 | "dashdash": "^1.12.0", 630 | "ecc-jsbn": "~0.1.1", 631 | "getpass": "^0.1.1", 632 | "jsbn": "~0.1.0", 633 | "safer-buffer": "^2.0.2", 634 | "tweetnacl": "~0.14.0" 635 | } 636 | }, 637 | "stealthy-require": { 638 | "version": "1.1.1", 639 | "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", 640 | "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" 641 | }, 642 | "tcb-admin-node": { 643 | "version": "1.23.0", 644 | "resolved": "https://registry.npmjs.org/tcb-admin-node/-/tcb-admin-node-1.23.0.tgz", 645 | "integrity": "sha512-SAbjTqMsSi63SId1BJ4kWdyGJzhxh9Tjvy3YXxcsoaAC2PtASn4UIYsBsiNEUfcn58QEn2tdvCvvf69WLLjjrg==", 646 | "requires": { 647 | "@cloudbase/database": "0.9.15", 648 | "@cloudbase/signature-nodejs": "^1.0.0-beta.0", 649 | "is-regex": "^1.0.4", 650 | "jsonwebtoken": "^8.5.1", 651 | "lodash.merge": "^4.6.1", 652 | "request": "^2.87.0", 653 | "xml2js": "^0.4.19" 654 | }, 655 | "dependencies": { 656 | "@cloudbase/database": { 657 | "version": "0.9.15", 658 | "resolved": "https://registry.npmjs.org/@cloudbase/database/-/database-0.9.15.tgz", 659 | "integrity": "sha512-63e7iIl+van41B39Tw4ScNe9TRCt+5GHjc7q6i8NzkWBLC3U3KlbWo79YHsUHUPI79POpQ8UMlMVo7HXIAO3dg==", 660 | "requires": { 661 | "bson": "^4.0.2", 662 | "lodash.clonedeep": "4.5.0", 663 | "lodash.set": "4.3.2", 664 | "lodash.unset": "4.5.2" 665 | } 666 | } 667 | } 668 | }, 669 | "tough-cookie": { 670 | "version": "2.5.0", 671 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", 672 | "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", 673 | "requires": { 674 | "psl": "^1.1.28", 675 | "punycode": "^2.1.1" 676 | }, 677 | "dependencies": { 678 | "punycode": { 679 | "version": "2.1.1", 680 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 681 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 682 | } 683 | } 684 | }, 685 | "tslib": { 686 | "version": "1.13.0", 687 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", 688 | "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" 689 | }, 690 | "tunnel-agent": { 691 | "version": "0.6.0", 692 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 693 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 694 | "requires": { 695 | "safe-buffer": "^5.0.1" 696 | } 697 | }, 698 | "tweetnacl": { 699 | "version": "0.14.5", 700 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 701 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 702 | }, 703 | "uri-js": { 704 | "version": "4.2.2", 705 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 706 | "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 707 | "requires": { 708 | "punycode": "^2.1.0" 709 | }, 710 | "dependencies": { 711 | "punycode": { 712 | "version": "2.1.1", 713 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 714 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 715 | } 716 | } 717 | }, 718 | "url": { 719 | "version": "0.11.0", 720 | "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", 721 | "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", 722 | "requires": { 723 | "punycode": "1.3.2", 724 | "querystring": "0.2.0" 725 | } 726 | }, 727 | "uuid": { 728 | "version": "3.4.0", 729 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 730 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 731 | }, 732 | "verror": { 733 | "version": "1.10.0", 734 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 735 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 736 | "requires": { 737 | "assert-plus": "^1.0.0", 738 | "core-util-is": "1.0.2", 739 | "extsprintf": "^1.2.0" 740 | } 741 | }, 742 | "wx-server-sdk": { 743 | "version": "2.0.2", 744 | "resolved": "https://registry.npmjs.org/wx-server-sdk/-/wx-server-sdk-2.0.2.tgz", 745 | "integrity": "sha512-UXrw2YNNssZIIMFc8W3P7ajiSxyniTYcsKRxH+6tD+pKcXszGkll0EnAHEJJafm/hH+aISBmU+WJwIcvg8OQIw==", 746 | "requires": { 747 | "@cloudbase/node-sdk": "2.0.0-beta.5", 748 | "protobufjs": "6.8.8", 749 | "tslib": "^1.9.3" 750 | } 751 | }, 752 | "xml2js": { 753 | "version": "0.4.23", 754 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", 755 | "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", 756 | "requires": { 757 | "sax": ">=0.6.0", 758 | "xmlbuilder": "~11.0.0" 759 | } 760 | }, 761 | "xmlbuilder": { 762 | "version": "11.0.1", 763 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 764 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 765 | } 766 | } 767 | } 768 | -------------------------------------------------------------------------------- /cloudfunctions/setUserInfo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setUserInfo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.0.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cloudfunctions/timingDelete/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "triggers": [ 3 | { 4 | "name": "timingDelete", 5 | "type": "timer", 6 | "config": "0 */10 * * * * *" 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /cloudfunctions/timingDelete/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | 6 | const db = cloud.database() 7 | 8 | // 云函数入口函数 9 | exports.main = async (event, context) => { 10 | 11 | const time = Date.now() - 1000 * 60 * 60 12 | 13 | const _ = db.command 14 | const tmpFiles = db.collection('tmp-file') 15 | const { data: list } = await tmpFiles.where({ time: _.lt(time) }).limit(50).get() 16 | 17 | if (!list.length) return { delete: false, list } 18 | 19 | const fileList = list.map(v => v.fileID) 20 | 21 | const { fileList: resultList } = await cloud.deleteFile({ fileList }) 22 | 23 | await tmpFiles.where({ 24 | fileID: _.in(resultList.filter(file => file.status === 0).map(file => file.fileID)) 25 | }).remove() 26 | 27 | return { delete: true, list: resultList } 28 | } -------------------------------------------------------------------------------- /cloudfunctions/timingDelete/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "timingDelete", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.3.2" 13 | } 14 | } -------------------------------------------------------------------------------- /cloudfunctions/userFile/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloudfunctions/userFile/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | // 云函数入口函数 7 | exports.main = async (event, context) => { 8 | const wxContext = cloud.getWXContext() 9 | const fileID = event.fileID 10 | const id = event.id 11 | if(fileID){ 12 | const res = await cloud.deleteFile({ 13 | fileList:[fileID] 14 | }) 15 | } 16 | const res = await db.collection('user-file').doc(id).remove() 17 | return { 18 | res 19 | } 20 | } -------------------------------------------------------------------------------- /cloudfunctions/userFile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "userFile", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.5.3" 13 | } 14 | } -------------------------------------------------------------------------------- /miniprogram/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/.DS_Store -------------------------------------------------------------------------------- /miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | import './tools/dateFormatter' 3 | App({ 4 | onLaunch: function () { 5 | // 初始化云开发 6 | wx.cloud.init({ 7 | resourceEnv: 'noco-04nbo', 8 | traceUser: true 9 | }) 10 | // 新用户入库 11 | this.addUser() 12 | }, 13 | 14 | // 新用户入库 15 | addUser() { 16 | wx.cloud.callFunction({ 17 | name: 'addUser', 18 | success: res => this.globalData.openid = res.result.openid, 19 | fail(err) { 20 | wx.showToast({ 21 | title: '请求失败,请重试', 22 | icon: 'none' 23 | }) 24 | } 25 | }) 26 | }, 27 | // 初始化全局数据 28 | globalData: { 29 | openid: null, 30 | photoSizeList: [{ 31 | name: '一寸', 32 | px: '295×413 px', 33 | size: '25 × 35 mm', 34 | width: 295, 35 | height: 413, 36 | discription: '教师资格证、简历、会计职称考试、健康证等。' 37 | }, 38 | { 39 | name: '小一寸', 40 | px: '260×378 px', 41 | size: '22 × 32 mm', 42 | width: 260, 43 | height: 378, 44 | discription: '驾驶证、驾照、英语AB级等。' 45 | }, 46 | { 47 | name: '大一寸', 48 | px: '390×567 px', 49 | size: '33 × 48 mm', 50 | width: 390, 51 | height: 567, 52 | discription: '计算机等级、中国护照、英语四六级考试等。' 53 | }, 54 | { 55 | name: '二寸', 56 | px: '413×579 px', 57 | size: '35 × 49 mm', 58 | width: 413, 59 | height: 579, 60 | discription: '养老护理员、医疗、职业药师资格证等。' 61 | }, 62 | { 63 | name: '小二寸', 64 | px: '413×531 px', 65 | size: '33 × 45 mm', 66 | width: 413, 67 | height: 531, 68 | discription: '国考、国家公务员、护士资格证考试、主管护师等。' 69 | }, 70 | { 71 | name: '大二寸', 72 | px: '413×626 px', 73 | size: '35 × 53 mm', 74 | width: 413, 75 | height: 626, 76 | discription: '' 77 | }, 78 | { 79 | name: '结婚证', 80 | px: '626x413 px', 81 | size: '53 × 35 mm', 82 | width: 626, 83 | height: 413, 84 | discription: '结婚证大二寸双人证件照。' 85 | }, 86 | { 87 | name: '一寸半身照', 88 | px: '295×413 px', 89 | size: '25 × 35 mm', 90 | width: 295, 91 | height: 413, 92 | discription: '' 93 | }, 94 | { 95 | name: '二寸半身照', 96 | px: '413×579 px', 97 | size: '35 × 49 mm', 98 | width: 413, 99 | height: 579, 100 | discription: '' 101 | }, 102 | { 103 | name: '教师资格证', 104 | px: '295×413 px', 105 | size: '25 × 35 mm', 106 | width: 295, 107 | height: 413, 108 | discription: '教师资格证' 109 | }, 110 | { 111 | name: '三寸', 112 | px: '649×991 px', 113 | size: '55 × 84 mm', 114 | width: 413, 115 | height: 626, 116 | discription: '' 117 | }, 118 | { 119 | name: '四寸', 120 | px: '898×1205 px', 121 | size: '76 × 102 mm', 122 | width: 413, 123 | height: 626, 124 | discription: '' 125 | }, 126 | { 127 | name: '五寸', 128 | px: '1050×1499 px', 129 | size: '89 × 127 mm', 130 | width: 413, 131 | height: 626, 132 | discription: '' 133 | }, 134 | { 135 | name: '简历', 136 | px: '295×413 px', 137 | size: '25 × 35 mm', 138 | width: 295, 139 | height: 413, 140 | discription: '简历' 141 | }, 142 | { 143 | name: '健康证', 144 | px: '295×413 px', 145 | size: '25 × 35 mm', 146 | width: 295, 147 | height: 413, 148 | discription: '健康证' 149 | }, 150 | 151 | ] 152 | } 153 | }) -------------------------------------------------------------------------------- /miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/mein/mein", 5 | "pages/user-file/user-file", 6 | "pages/editPhoto/complete/complete", 7 | "pages/preImgEdit/preImgEdit", 8 | "pages/editPhoto/editPhoto", 9 | "pages/autoCamera/autoCamera" 10 | ], 11 | "window": { 12 | "backgroundColor": "#fff", 13 | "backgroundTextStyle": "light", 14 | "navigationBarBackgroundColor": "#fff", 15 | "navigationBarTitleText": "", 16 | "navigationBarTextStyle": "black" 17 | }, 18 | "sitemapLocation": "sitemap.json", 19 | "style": "v2", 20 | "tabBar": { 21 | "backgroundColor": "#fff", 22 | "color": "#333333", 23 | "selectedColor": "#0acaa2", 24 | "list": [ 25 | { 26 | "pagePath": "pages/index/index", 27 | "text": "首页", 28 | "iconPath": "./images/index.png", 29 | "selectedIconPath": "./images/index-active.png" 30 | }, 31 | { 32 | "pagePath": "pages/mein/mein", 33 | "text": "我的", 34 | "iconPath": "./images/me.png", 35 | "selectedIconPath": "./images/me-active.png" 36 | } 37 | ] 38 | } 39 | } -------------------------------------------------------------------------------- /miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | display: flex; 4 | flex-direction: column; 5 | align-items: center; 6 | box-sizing: border-box; 7 | } 8 | button { 9 | background: initial; 10 | } 11 | @font-face { 12 | font-family: 'iconfont'; /* Project id 2987861 */ 13 | src: url('//at.alicdn.com/t/font_2987861_pztcczsdu4.woff2?t=1639193843730') format('woff2'), 14 | url('//at.alicdn.com/t/font_2987861_pztcczsdu4.woff?t=1639193843730') format('woff'), 15 | url('//at.alicdn.com/t/font_2987861_pztcczsdu4.ttf?t=1639193843730') format('truetype'); 16 | } 17 | 18 | .iconfont { 19 | font-family: "iconfont" !important; 20 | font-size: 16px; 21 | font-style: normal; 22 | -webkit-font-smoothing: antialiased; 23 | -moz-osx-font-smoothing: grayscale; 24 | } 25 | .icon_huo:before { 26 | content: "\e6ea"; 27 | } 28 | .icon_cameraC:before { 29 | content: "\e66a"; 30 | } 31 | .icon_cameraT:before { 32 | content: "\e7ae"; 33 | } 34 | .icon_back:before { 35 | content: "\e60b"; 36 | } 37 | .icon_confirm:before { 38 | content: "\e714"; 39 | } 40 | .icon_arrowR:before { 41 | content: "\e678"; 42 | } 43 | .icon_card:before { 44 | content: "\e6f1"; 45 | } 46 | .icon_question:before { 47 | content: "\e60a"; 48 | } 49 | .icon_tip:before { 50 | content: "\e625"; 51 | } 52 | .icon_select:before { 53 | content: "\e6e5"; 54 | } 55 | .icon_complete:before { 56 | content: "\e600"; 57 | } 58 | .icon_download:before { 59 | content: "\e61d"; 60 | } 61 | .icon_delete:before { 62 | content: "\e6c7"; 63 | } 64 | .icon_noData:before { 65 | content: "\e642"; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /miniprogram/images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/.DS_Store -------------------------------------------------------------------------------- /miniprogram/images/index-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/index-active.png -------------------------------------------------------------------------------- /miniprogram/images/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/index.png -------------------------------------------------------------------------------- /miniprogram/images/me-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/me-active.png -------------------------------------------------------------------------------- /miniprogram/images/me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/me.png -------------------------------------------------------------------------------- /miniprogram/images/noUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/noUser.png -------------------------------------------------------------------------------- /miniprogram/images/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/person.png -------------------------------------------------------------------------------- /miniprogram/images/take.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/images/take.png -------------------------------------------------------------------------------- /miniprogram/pages/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/.DS_Store -------------------------------------------------------------------------------- /miniprogram/pages/autoCamera/autoCamera.js: -------------------------------------------------------------------------------- 1 | // pages/autoCamera/autoCamera.js 2 | const app = getApp() 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | cameraPostion:'back', 10 | cameraImg:false, 11 | photoSrc:'', 12 | photoName:'', 13 | width:'', 14 | height:'' 15 | }, 16 | 17 | /** 18 | * 生命周期函数--监听页面加载 19 | */ 20 | onLoad: function (options) { 21 | this.recevingData() 22 | 23 | }, 24 | recevingData(){ 25 | 26 | const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel() 27 | eventChannel && eventChannel.on('toAutoCamera', (data) => { 28 | const {width, height,photoName} = data 29 | console.log(data) 30 | 31 | this.setData({ 32 | width: width, 33 | height: height, 34 | photoName:photoName 35 | }) 36 | }) 37 | }, 38 | 39 | takePhoto() { 40 | if(this.data.photoSrc){ 41 | this.imgUpload(this.data.photoSrc) 42 | } 43 | 44 | }, 45 | trunCameraBtn(){ 46 | const ctx = wx.createCameraContext() 47 | ctx.takePhoto({ 48 | quality: 'high', 49 | success: (res) => { 50 | this.setData({ 51 | photoSrc: res.tempImagePath, 52 | cameraImg:true, 53 | }) 54 | } 55 | }) 56 | }, 57 | goRepeat(){ 58 | 59 | this.setData({ 60 | cameraImg:false, 61 | photoSrc:'' 62 | }) 63 | 64 | }, 65 | // 上传原图, 后使用百度人像分割 66 | imgUpload(filePath) { 67 | 68 | const openid = app.globalData.openid 69 | if (!openid) return 70 | wx.showLoading({ title: '正在检测图像中', }) 71 | const fileName = filePath.split('tmp/')[1] || filePath.split('tmp_')[1]; 72 | wx.cloud.uploadFile({ 73 | cloudPath: `tmp/originfile/${openid}/${new Date().Format('yyyy-MM-dd')}/${fileName}`, 74 | filePath 75 | }) 76 | .then(res => { 77 | 78 | this.imageDivision(res.fileID) 79 | }) 80 | .catch(error => { 81 | console.log(error) 82 | wx.showToast({ title: '失败,请重试', icon: 'loading' }) 83 | }) 84 | }, 85 | 86 | // 使用百度人像分割 87 | imageDivision (fileID) { 88 | wx.cloud.callFunction({ 89 | name: 'imageDivision', 90 | data: { fileID } 91 | }) 92 | .then(({ result }) => { 93 | wx.hideLoading() 94 | if(result.res){ 95 | this.goEditPage(result) 96 | }else{ 97 | wx.showToast({ title: result.msg, icon: 'error' }) 98 | this.goRepeat() 99 | } 100 | }).catch((error) => { 101 | console.log(error) 102 | wx.hideLoading() 103 | wx.showToast({ title: '失败,请重试', icon: 'error' }) 104 | }) 105 | }, 106 | 107 | /** 108 | * 去编辑页面 109 | */ 110 | goEditPage (data) { 111 | const { width, height ,photoName} = this.data 112 | wx.navigateTo({ 113 | url: '/pages/editPhoto/editPhoto', 114 | success: function (res) { 115 | res.eventChannel.emit('acceptDataFromOpenerPage', { 116 | ...data, 117 | width, 118 | height, 119 | photoName 120 | }) 121 | } 122 | }) 123 | }, 124 | error(e) { 125 | console.log(e.detail) 126 | }, 127 | trunCameraPostion(){ 128 | 129 | if(this.data.cameraPostion==='back'){ 130 | this.setData({ 131 | cameraPostion:'front' 132 | }) 133 | return 134 | } 135 | if(this.data.cameraPostion==='front'){ 136 | this.setData({ 137 | cameraPostion:'back' 138 | }) 139 | return 140 | } 141 | }, 142 | /** 143 | * 生命周期函数--监听页面初次渲染完成 144 | */ 145 | onReady: function () { 146 | 147 | }, 148 | 149 | /** 150 | * 生命周期函数--监听页面显示 151 | */ 152 | onShow: function () { 153 | 154 | }, 155 | 156 | /** 157 | * 生命周期函数--监听页面隐藏 158 | */ 159 | onHide: function () { 160 | 161 | }, 162 | 163 | /** 164 | * 生命周期函数--监听页面卸载 165 | */ 166 | onUnload: function () { 167 | 168 | }, 169 | 170 | /** 171 | * 页面相关事件处理函数--监听用户下拉动作 172 | */ 173 | onPullDownRefresh: function () { 174 | 175 | }, 176 | 177 | /** 178 | * 页面上拉触底事件的处理函数 179 | */ 180 | onReachBottom: function () { 181 | 182 | }, 183 | 184 | /** 185 | * 用户点击右上角分享 186 | */ 187 | onShareAppMessage: function () { 188 | 189 | } 190 | }) -------------------------------------------------------------------------------- /miniprogram/pages/autoCamera/autoCamera.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "拍照", 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /miniprogram/pages/autoCamera/autoCamera.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /miniprogram/pages/autoCamera/autoCamera.wxss: -------------------------------------------------------------------------------- 1 | /* pages/autoCamera/autoCamera.wxss */ 2 | page{ 3 | overflow: hidden; 4 | height: 100%; 5 | } 6 | .contain{ 7 | position: relative; 8 | box-sizing: border-box; 9 | width: 100vw; 10 | height: 100vh; 11 | } 12 | .contain-photo{ 13 | width: 100%; 14 | height: 100%; 15 | } 16 | image{ 17 | width: 100%; 18 | height: 100%; 19 | } 20 | .person{ 21 | width: 100%; 22 | height: 100%; 23 | position: absolute; 24 | font-size: 150rpx; 25 | top: 200rpx; 26 | color: #fff; 27 | } 28 | .person image{ 29 | width: 100%; 30 | height: 60%; 31 | } 32 | .icon_cameraC{ 33 | width: 150rpx; 34 | height: 150rpx; 35 | position: absolute; 36 | font-size: 150rpx; 37 | left: 50%; 38 | margin-left: -75rpx; 39 | bottom: 50rpx; 40 | color: #fff; 41 | } 42 | .icon_cameraT{ 43 | width: 100rpx; 44 | height: 100rpx; 45 | position: absolute; 46 | font-size: 100rpx; 47 | right: 30rpx; 48 | top: 50rpx; 49 | color: #fff; 50 | 51 | } 52 | .icon_back{ 53 | position: absolute; 54 | font-size: 100rpx; 55 | left: 70rpx; 56 | bottom: 50rpx; 57 | color: #fff; 58 | 59 | } 60 | .icon_confirm{ 61 | position: absolute; 62 | font-size: 100rpx; 63 | right: 70rpx; 64 | bottom: 50rpx; 65 | color: #fff; 66 | 67 | } -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/complete/complete.js: -------------------------------------------------------------------------------- 1 | // 在页面中定义插屏广告 2 | let interstitialAd = null 3 | 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | msg: '', 11 | tempFilePath: '', 12 | url: '' 13 | }, 14 | 15 | 16 | 17 | /** 18 | * 生命周期函数--监听页面加载 19 | */ 20 | onLoad: function (options) { 21 | this.setData({ 22 | msg: options.msg, 23 | tempFilePath: options.tempFilePath, 24 | url: options.url 25 | }) 26 | }, 27 | 28 | preView () { 29 | wx.previewImage({ 30 | urls: [this.data.url], 31 | current: this.data.url 32 | }) 33 | }, 34 | contineu() { 35 | debugger 36 | wx.navigateBack({ 37 | delta: 3 //默认值是1 38 | }) 39 | }, 40 | /** 41 | * 生命周期函数--监听页面显示 42 | */ 43 | onShow: function () { 44 | }, 45 | /** 46 | * 用户点击右上角分享 47 | */ 48 | onShareAppMessage: function (res) { 49 | return { 50 | title: '随时随地可以制作的电子证件照神器!', 51 | path: '/pages/index/index', 52 | imageUrl: this.data.tempFilePath 53 | } 54 | } 55 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/complete/complete.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/complete/complete.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{msg}} 8 | 9 | 10 | 11 | 12 | 13 | 已保存在手机相册 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/complete/complete.wxss: -------------------------------------------------------------------------------- 1 | .container{ 2 | width: 100vw; 3 | height: 100vh; 4 | display:flex; 5 | flex-flow:column nowrap; 6 | overflow: hidden; 7 | } 8 | .container-content{ 9 | width: 100%; 10 | height: 48%; 11 | } 12 | .container-content-img{ 13 | margin-top: 50rpx; 14 | display: flex; 15 | justify-content: center; 16 | } 17 | .img-msg{ 18 | text-align: center; 19 | font-size: 12px; 20 | color: #ddd; 21 | } 22 | .container-opt{ 23 | width: 100%; 24 | flex: 1; 25 | background: #fff; 26 | } 27 | .msg{ 28 | margin-top: 50rpx; 29 | text-align: center; 30 | } 31 | .icon_complete{ 32 | font-size: 80rpx; 33 | color: rgb(13, 163, 20); 34 | } 35 | .container-opt-btn{ 36 | width: 90%; 37 | margin: 0 auto; 38 | position: fixed; 39 | bottom: 100rpx; 40 | right:0px; 41 | left:0px; 42 | 43 | } 44 | .container-opt-btn button { 45 | margin-bottom: 20rpx; 46 | box-shadow: 0 0 10rpx 5rpx rgba(67,142,219,.25); 47 | background-color: #0acaa2 !important; 48 | color: #fff !important; 49 | font-weight: normal; 50 | height: 90rpx; 51 | padding: 0; 52 | line-height: 90rpx; 53 | width: 100% !important; 54 | border-radius: 10rpx; 55 | } 56 | -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/editPhoto.js: -------------------------------------------------------------------------------- 1 | 2 | const hexRgb = require('./hex-rgb') 3 | const { photoSizeList } = getApp().globalData; 4 | const sizeNameList = photoSizeList.map(v => v.name) 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | photoName: '', 13 | targetWidth: '', 14 | targetHeight: '', 15 | showScale: 1, 16 | tmpOriginImgSrc: '', 17 | filePath: '', 18 | bgc: '#ffffff', 19 | photoBg: '#ffffff', 20 | rpxRatio: 1, //此值为你的屏幕CSS像素宽度/750,单位rpx实际像素 21 | array: sizeNameList, 22 | index: 0, 23 | initImgWidth: 0, 24 | initImgHeight: 0, 25 | originImgWidth: 0, 26 | originImgHeight: 0, 27 | width: 0, 28 | height: 0, 29 | left: 0, 30 | top: 0, 31 | scale: 1, 32 | rotate: 0, 33 | 34 | }, 35 | 36 | // 尺寸改变 37 | bindPickerChange(e) { 38 | this.setData({ index: e.detail.value }) 39 | }, 40 | 41 | // 切换背景 42 | toggleBg(e) { 43 | const bgc = e.currentTarget.dataset.color; 44 | const photoBg = { 45 | red: '#ff0000', 46 | blue: '#438edb', 47 | blue2: '#00bff3', 48 | white: '#ffffff', 49 | transparent: 'transparent' 50 | }[bgc] 51 | this.setData({ 52 | bgc, 53 | photoBg 54 | }) 55 | }, 56 | 57 | 58 | // 图片合成 59 | async composeImage () { 60 | wx.showLoading({ title: '制作中...', }) 61 | const { photoBg, photoName, targetWidth, targetHeight, filePath} = this.data 62 | const colorObj={ 63 | '#ff0000':'红底', 64 | '#438edb':'蓝底(普蓝)', 65 | '#00bff3':'蓝底(湖蓝)', 66 | '#ffffff':'白底', 67 | } 68 | const imgBcgTip = colorObj[photoBg] || '自定义' 69 | // 将颜色转为 rgba值 70 | const bgc = hexRgb(photoBg, { format: 'array' }) 71 | // 底图 72 | const baseImg = { bgc, width: targetWidth, height: targetHeight } 73 | // 人像图 74 | const peopleImg = { imgId:filePath, ...this.computedXY(baseImg, this.data) } 75 | 76 | // 组合图片顺序 77 | const data = [baseImg, peopleImg] 78 | // 合成图片 返回url 79 | const { result } = await wx.cloud.callFunction({ 80 | name: 'imageCompose', 81 | data: { photoName:photoName, imgBcgTip:imgBcgTip, imgType: 'jpg', dataType: 'url', data } 82 | }) 83 | 84 | this.downloadAndToComplate(result.value) 85 | 86 | }, 87 | 88 | // 下载并跳转 89 | async downloadAndToComplate (url) { 90 | let msg = '' 91 | try { 92 | // 下载图片到本地 93 | const { tempFilePath, dataLength } = await this.downloadImg(url) 94 | const { targetWidth, targetHeight } = this.data 95 | const size = (dataLength / 1024).toFixed(2) 96 | msg = `图片像素${targetWidth + ' * ' + targetHeight},图片大小${size}kb` 97 | 98 | // 保存图片到相册 99 | await this.saveImage(tempFilePath) 100 | console.log(JSON.stringify('./complete/complete?msg=' + msg + '&tempFilePath=' + tempFilePath + '&url=' + url)) 101 | wx.redirectTo({ url: './complete/complete?msg=' + msg + '&tempFilePath=' + tempFilePath + '&url=' + url, }) 102 | 103 | } catch (error) { 104 | console.log(error) 105 | msg = '下载失败,点击下图预览保存图片。' 106 | wx.redirectTo({ url: '.ß/complete/complete?msg=' + msg + '&tempFilePath=' + url + '&url=' + url, }) 107 | } 108 | }, 109 | 110 | // 计算相对底图的 x , y 111 | computedXY (baseImg, imgData) { 112 | 113 | const left = (imgData.left - imgData.initImgWidth / 2) 114 | const top = (imgData.top - imgData.initImgHeight / 2) 115 | const noScaleImgHeight = baseImg.width * imgData.initImgHeight / imgData.initImgWidth 116 | const resultImgWidth = baseImg.width * imgData.scale 117 | const resultImgHeight = noScaleImgHeight * imgData.scale 118 | const scaleChangeWidth = (resultImgWidth / 2 - baseImg.width / 2) 119 | const scaleChangeHeight = (resultImgHeight / 2 - noScaleImgHeight / 2) 120 | const x = left - scaleChangeWidth 121 | const y = top - scaleChangeHeight 122 | return { x, y, width: resultImgWidth, height: resultImgHeight } 123 | }, 124 | 125 | // 将远端图片,下载到本地 126 | downloadImg (url) { 127 | return new Promise((resolve, reject) => { 128 | wx.downloadFile({ 129 | url, //仅为示例,并非真实的资源 130 | success (res) { 131 | // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 132 | if (res.statusCode === 200) { 133 | console.log(res) 134 | resolve(res) 135 | } else { 136 | reject(res) 137 | } 138 | }, 139 | fail (error) { 140 | reject(error) 141 | } 142 | }) 143 | }) 144 | }, 145 | 146 | // 保存图片到相册 147 | saveImage(tempFilePath) { 148 | const that = this 149 | return new Promise((resolve, reject) => { 150 | wx.saveImageToPhotosAlbum({ 151 | filePath: tempFilePath, 152 | success:() => { 153 | wx.showToast({ title: '下载成功' }) 154 | resolve() 155 | }, 156 | fail(res) { 157 | wx.getSetting({ 158 | success(res) { 159 | if (res.authSetting['scope.writePhotosAlbum']) { 160 | wx.showToast({ title: '下载失败', icon: 'none' }) 161 | reject(new Error('错误')) 162 | } else { 163 | that.openConfirm() 164 | } 165 | }, 166 | fail () { 167 | reject(new Error('错误')) 168 | } 169 | }) 170 | }, 171 | }) 172 | }) 173 | }, 174 | openConfirm() { 175 | wx.showModal({ 176 | content: '检测到您之前没打开相册的写入相册权限,是否去授权?', 177 | confirmText: "去授权", 178 | cancelText: "取消", 179 | success: function (res) { 180 | console.log(res); 181 | //点击“确认”时打开设置页面 182 | if (res.confirm) { 183 | console.log('用户点击确认') 184 | wx.openSetting({ 185 | success: (res) => { } 186 | }) 187 | } else { 188 | console.log('用户点击取消') 189 | } 190 | } 191 | }); 192 | }, 193 | /** 194 | * 生命周期函数--监听页面加载 195 | */ 196 | onLoad: function () { 197 | wx.setNavigationBarTitle({ title: '生成照片' }) 198 | wx.showLoading({ title: '图片加载中', }) 199 | 200 | this.receivingParameters() 201 | this.setRpxRatio() 202 | 203 | }, 204 | 205 | // 接收参数 206 | receivingParameters () { 207 | 208 | const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel() 209 | eventChannel && eventChannel.on('acceptDataFromOpenerPage', (data) => { 210 | const {width, height, photoName, tmpOriginImgSrc, imageDivisionResultFileId} = data 211 | console.log(JSON.stringify(data)) 212 | debugger 213 | this.setData({ 214 | photoName:photoName, 215 | targetWidth: width, 216 | targetHeight: height, 217 | showScale: (480 / (+width)), 218 | filePath: imageDivisionResultFileId, 219 | tmpOriginImgSrc 220 | }) 221 | }) 222 | }, 223 | 224 | // 设置屏幕宽度比例 225 | setRpxRatio () { 226 | 227 | const _this = this 228 | wx.getSystemInfo({ 229 | success(res) { 230 | _this.setData({ rpxRatio: res.screenWidth / 750 }) 231 | } 232 | }) 233 | }, 234 | 235 | 236 | /** 237 | * 生命周期函数--监听页面显示 238 | */ 239 | onShow: function (e) { 240 | 241 | }, 242 | // 关闭上拉加载 243 | onReachBottom: function () { 244 | return 245 | }, 246 | bindload: function (e) { 247 | wx.hideLoading({}) 248 | const that = this 249 | const photoSizeObj = { 250 | width: this.data.targetWidth, 251 | height: this.data.targetHeight 252 | } 253 | const { width, height } = e.detail 254 | const _width = photoSizeObj.width 255 | const _height = _width * height / width 256 | 257 | const imgLoadSetData = { 258 | originImgWidth: width, 259 | originImgHeight: height, 260 | initImgWidth: _width, 261 | initImgHeight: _height, 262 | width: _width, 263 | height: _height, 264 | left: _width / 2, 265 | top: _height / 2 + photoSizeObj.height - _height +120 266 | } 267 | const outerDataName = e.currentTarget.dataset.dataname 268 | that.setData(outerDataName ? { 269 | [outerDataName]: { 270 | ...that.data[outerDataName], 271 | ...imgLoadSetData 272 | } 273 | } : imgLoadSetData) 274 | }, 275 | 276 | /** 277 | * 用户点击右上角分享 278 | */ 279 | onShareAppMessage: function () { 280 | return { 281 | title: '随时随地可以制作的电子证件照神器!', 282 | path: '/pages/index/index' 283 | } 284 | } 285 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/editPhoto.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | 4 | }, 5 | "navigationBarTitleText": "生成照片", 6 | "disableScroll": true 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/editPhoto.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/editPhoto.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editPhoto/editPhoto.wxss */ 2 | .container { 3 | width: 100vw; 4 | height: 100vh; 5 | overflow: hidden; 6 | } 7 | .imgOpt{ 8 | width: 100%; 9 | height: 100%; 10 | background: #fff; 11 | } 12 | 13 | /* 颜色选择 */ 14 | .imgOpt .colors { 15 | width: 100%; 16 | display: flex; 17 | flex-direction: row; 18 | justify-content: space-around ; 19 | margin-top: 100rpx; 20 | } 21 | .imgOpt .colors .color { 22 | width: 8vw; 23 | height: 8vw; 24 | /* padding-top: 9%; */ 25 | border: 1px solid #ddd; 26 | border-radius: 50%; 27 | overflow: hidden; 28 | } 29 | .icon_select{ 30 | font-size: 60rpx; 31 | font-weight: bold; 32 | color: rgb(11, 179, 81); 33 | } 34 | .imgOpt .colors .color.transparent { 35 | background-color: transparent; 36 | position: relative; 37 | } 38 | .imgOpt .colors .color.transparent::before { 39 | content: '透明'; 40 | position: absolute; 41 | left: 0; 42 | top: 50%; 43 | width: 100%; 44 | text-align: center; 45 | color: #333; 46 | line-height: 1; 47 | height: 1em; 48 | margin-top: -0.5em; 49 | font-size: 14px; 50 | } 51 | .blue { 52 | background-color: rgb(67,142,219); 53 | } 54 | .blue2 { 55 | background-color: rgb(0,191,243); 56 | } 57 | .red { 58 | background-color: red; 59 | } 60 | .white { 61 | background-color: white; 62 | } 63 | .imgOpt .colors .color.custom { 64 | padding-top: 0; 65 | height: max-content; 66 | } 67 | .imgOpt .colors .color.custom .text { 68 | width: 100%; 69 | padding-top: 50%; 70 | height: 0; 71 | text-align: center; 72 | } 73 | .imgOpt .colors .color.custom .text text { 74 | transform: translateY(-100%); 75 | display: block; 76 | font-size: 14px; 77 | } 78 | .imgOpt .colors .color .custom-bg { 79 | width: 100%; 80 | height: 0; 81 | padding-top: 50%; 82 | } 83 | 84 | /* color picker */ 85 | .color-picker-view { 86 | position: relative; 87 | margin-top: 10px; 88 | width: 100%; 89 | height: 0; 90 | overflow: visible; 91 | z-index: 99; 92 | } 93 | .color-picker-view .color-picker-content { 94 | position: absolute; 95 | left: 0; 96 | top: 0; 97 | width: 100%; 98 | background-color: #fff; 99 | } 100 | .color-picker-view .color-picker-content .tips { 101 | position: absolute; 102 | width: 4em; 103 | right: 5px; 104 | top: 30px; 105 | } 106 | .color-picker-view .color-picker-content .current-color { 107 | position: absolute; 108 | width: 4em; 109 | height: 4em; 110 | right: 5px; 111 | bottom: 80px; 112 | } 113 | .color-picker-view .color-picker-content button { 114 | position: absolute; 115 | right: 5px; 116 | bottom: 30px; 117 | } 118 | 119 | /* 尺寸 */ 120 | .container .size-picker { 121 | box-sizing: border-box; 122 | width: 100%; 123 | padding: 0 5px; 124 | } 125 | 126 | /* canvas */ 127 | .container .pthto-edit-content { 128 | padding: 5px; 129 | padding-bottom: 15px; 130 | width: 100%; 131 | background: '#e6e2e'; 132 | box-sizing: border-box; 133 | } 134 | .container .pthto-edit-content .canvas-view { 135 | position: relative; 136 | width: 100%; 137 | height: 300px; 138 | margin: 0 auto; 139 | /* border: 10rpx solid #fff; */ 140 | box-sizing: content-box; 141 | overflow: hidden; 142 | /* box-shadow: 0 5rpx 5rpx 5rpx rgba(255,255,255,.5) inset; */ 143 | overflow: hidden; 144 | } 145 | /* .container .pthto-edit-content .canvas-view #myCanvas { 146 | width:100%; 147 | height:100%; 148 | } */ 149 | .container .pthto-edit-content .canvas-view .people-photo { 150 | position: absolute; 151 | /* left: 0; 152 | bottom: 0; */ 153 | width: 100%; 154 | transform-origin: center center; 155 | } 156 | 157 | .container .pthto-edit-content .canvas-view .guide { 158 | position: absolute; 159 | z-index: 9; 160 | left: 0; 161 | top: 0; 162 | right: 0; 163 | bottom: 0; 164 | background-color: rgba(0,0,0,.5); 165 | /* pointer-events: none; */ 166 | } 167 | 168 | .container .pthto-edit-content .canvas-view .guide .guide-know { 169 | position: absolute; 170 | width: 6em; 171 | line-height: 2em; 172 | height: 2em; 173 | left: 0; 174 | top: 0; 175 | right: 0; 176 | bottom: 0; 177 | margin: auto; 178 | border-radius: 5px; 179 | color: #fff; 180 | border: 1px solid #fff; 181 | text-align: center; 182 | } 183 | 184 | .container .pthto-edit-content .canvas-view .guide text { 185 | position: absolute; 186 | top: 10rpx; 187 | left: 0rpx; 188 | right: 0rpx; 189 | /* bottom: 0; */ 190 | margin: auto; 191 | color: #fff; 192 | text-align: center; 193 | font-size: 40rpx; 194 | } 195 | .container .pthto-edit-content .canvas-view .guide image { 196 | position: absolute; 197 | width: 200rpx; 198 | left: 0; 199 | top: 0; 200 | right: 0; 201 | bottom: 0; 202 | margin: auto; 203 | } 204 | 205 | 206 | .download-view { 207 | width: 100%; 208 | box-sizing: border-box; 209 | padding: 0 20rpx; 210 | margin-top: 100rpx; 211 | } 212 | 213 | .download-view .no-count { 214 | padding: 0 10rpx; 215 | display: flex; 216 | width: 100%; 217 | flex-direction: row; 218 | justify-content: space-around; 219 | } 220 | 221 | .download-view .no-count > button, .download-view .no-count navigator { 222 | width: 45%; 223 | margin: 0; 224 | margin-bottom: 0; 225 | box-sizing: border-box; 226 | } 227 | 228 | .download-view .no-count navigator button { 229 | box-sizing: border-box; 230 | width: 100%; 231 | margin-bottom: 0; 232 | } 233 | 234 | .download-view button { 235 | margin-bottom: 20rpx; 236 | box-shadow: 0 0 10rpx 5rpx rgba(67,142,219,.25); 237 | background-color: #0acaa2 !important; 238 | color: #fff !important; 239 | font-weight: normal; 240 | height: 90rpx; 241 | padding: 0; 242 | line-height: 90rpx; 243 | width: 100% !important; 244 | border-radius: 10rpx; 245 | } 246 | 247 | 248 | .style-text { 249 | color: #333333; 250 | font-size: 24rpx !important; 251 | } 252 | -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/hex-rgb.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const hexCharacters = 'a-f\\d'; 4 | const match3or4Hex = `#?[${hexCharacters}]{3}[${hexCharacters}]?`; 5 | const match6or8Hex = `#?[${hexCharacters}]{6}([${hexCharacters}]{2})?`; 6 | const nonHexChars = new RegExp(`[^#${hexCharacters}]`, 'gi'); 7 | const validHexSize = new RegExp(`^${match3or4Hex}$|^${match6or8Hex}$`, 'i'); 8 | 9 | module.exports = (hex, options = {}) => { 10 | if (typeof hex !== 'string' || nonHexChars.test(hex) || !validHexSize.test(hex)) { 11 | throw new TypeError('Expected a valid hex string'); 12 | } 13 | 14 | hex = hex.replace(/^#/, ''); 15 | let alpha = 1; 16 | 17 | if (hex.length === 8) { 18 | alpha = Number.parseInt(hex.slice(6, 8), 16) / 255; 19 | hex = hex.slice(0, 6); 20 | } 21 | 22 | if (hex.length === 4) { 23 | alpha = Number.parseInt(hex.slice(3, 4).repeat(2), 16) / 255; 24 | hex = hex.slice(0, 3); 25 | } 26 | 27 | if (hex.length === 3) { 28 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 29 | } 30 | 31 | const number = Number.parseInt(hex, 16); 32 | const red = number >> 16; 33 | const green = (number >> 8) & 255; 34 | const blue = number & 255; 35 | 36 | if (options.format === 'array') { 37 | return [red, green, blue, alpha]; 38 | } 39 | 40 | if (options.format === 'css') { 41 | const alphaString = alpha === 1 ? '' : ` / ${Number((alpha * 100).toFixed(2))}%`; 42 | return `rgb(${red} ${green} ${blue}${alphaString})`; 43 | } 44 | 45 | return {red, green, blue, alpha}; 46 | }; 47 | -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/images/move-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/editPhoto/images/move-white.png -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/images/move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/editPhoto/images/move.png -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/images/use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/editPhoto/images/use.png -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/images/zoom-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/editPhoto/images/zoom-white.png -------------------------------------------------------------------------------- /miniprogram/pages/editPhoto/images/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/editPhoto/images/zoom.png -------------------------------------------------------------------------------- /miniprogram/pages/index/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ljc-s/photoEdit/756ebf956141a78b225a173d030c157db5db5767/miniprogram/pages/index/.DS_Store -------------------------------------------------------------------------------- /miniprogram/pages/index/index.js: -------------------------------------------------------------------------------- 1 | 2 | const app = getApp() 3 | 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | photoSizeList: app.globalData.photoSizeList, 11 | bannerList:[] 12 | }, 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | // wx.setNavigationBarTitle({ title: '随心证件照' }) 18 | this.getBannerList() 19 | 20 | }, 21 | //获取标题图片 22 | getBannerList(){ 23 | wx.showLoading({ title: '加载中', }) 24 | const that = this 25 | const db = wx.cloud.database() 26 | db.collection('bannerList-simple').get().then(res => { 27 | res.data.forEach(e => { 28 | e.imgUrl = e.imgUrl.trim() 29 | }); 30 | that.setData({ 31 | bannerList:res.data 32 | }) 33 | wx.hideLoading() 34 | }) 35 | }, 36 | // 去选择照片页面 37 | goNextPage (e) { 38 | wx.navigateTo({ 39 | // url: '/pages/example/example?index=' + e.currentTarget.dataset.index, 40 | url: '/pages/preImgEdit/preImgEdit?index=' + e.currentTarget.dataset.index, 41 | }) 42 | }, 43 | 44 | /** 45 | * 用户点击右上角分享 46 | */ 47 | onShareAppMessage: function () { 48 | return { 49 | title: '随时随地可以制作的电子证件照神器!', 50 | path: '/pages/index/index', 51 | } 52 | }, 53 | 54 | onShow () { 55 | } 56 | }) -------------------------------------------------------------------------------- /miniprogram/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "AUTO证照", 3 | "usingComponents": { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 热门推荐 13 | 14 | 15 | 16 | 22 | {{ item.name }} 23 | {{ item.px }} | {{ item.size }} 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/index/index.wxss */ 2 | .container { 3 | background-color: rgb(233, 233, 233); 4 | position: relative; 5 | box-sizing: border-box; 6 | width: 100vw; 7 | height: 100vh; 8 | } 9 | .container-head{ 10 | width: 100%; 11 | height: 600rpx; 12 | display: flex; 13 | flex-direction: column; 14 | justify-content: center; 15 | background: #fff; 16 | } 17 | swiper { 18 | width: 95%; 19 | margin: 10px; 20 | height: 300rpx; 21 | } 22 | .swiper-item { 23 | border-radius: 10px; 24 | height: 100%; 25 | } 26 | 27 | /* 轮播样式 */ 28 | .swiper-img{ 29 | background-color: #fff; 30 | position: relative; 31 | height: 100%; 32 | } 33 | .swiper-img image { 34 | width: 100%; 35 | height: 100%; 36 | } 37 | 38 | .container-content{ 39 | width: 95%; 40 | height: 100%; 41 | margin-top: 20rpx; 42 | padding:0 30rpx; 43 | } 44 | .container-content-section{ 45 | width: 100%; 46 | padding:0 30rpx; 47 | margin-top: 20rpx; 48 | /* text-align: left; */ 49 | } 50 | .icon_huo{ 51 | color: rgb(248, 164, 37); 52 | } 53 | .container-content-section-title{ 54 | color: #333; 55 | } 56 | .container-content-item{ 57 | background: #fff; 58 | } 59 | 60 | .container-content-item { 61 | box-sizing: border-box; 62 | width: 100%; 63 | height: 200rpx; 64 | padding: 25rpx 40rpx; 65 | background: #fff; 66 | border-radius: 10rpx; 67 | position: relative; 68 | margin-bottom: 20rpx; 69 | } 70 | .container-content-item .title { 71 | font-size: 36rpx; 72 | } 73 | .container-content-item .description { 74 | font-size: 25rpx; 75 | color: #919191; 76 | margin-top: 50rpx; 77 | } 78 | .container-content-item image { 79 | position: absolute; 80 | width: 100rpx; 81 | height: 100rpx; 82 | right: 40rpx; 83 | top: 36rpx; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /miniprogram/pages/mein/mein.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/mein/mein.js 2 | 3 | const app = getApp() 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | userInfo: {}, 11 | authorized: false, // 用户头像昵称授权 12 | signed: false, 13 | signInLoading: false, 14 | canIUseGetUserProfile: true, 15 | envVersion: wx.getAccountInfoSync().miniProgram.envVersion || 'release' 16 | }, 17 | 18 | // 获取用户信息回调 19 | bindGetUserInfo (e) { 20 | if (e.detail.userInfo) { 21 | this.setUserInfo(e.detail.userInfo) 22 | } 23 | }, 24 | 25 | // 新的获取用户信息事件回调 26 | getUserProfile(e) { 27 | wx.getUserProfile({ 28 | desc: '用于完善资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 29 | success: (res) => { 30 | this.setUserInfo(res.userInfo) 31 | } 32 | }) 33 | }, 34 | 35 | // 设置用户信息 36 | setUserInfo (userInfo) { 37 | this.setData({ 38 | authorized: !!userInfo.nickName, 39 | userInfo: { 40 | ...this.data.userInfo, 41 | ...userInfo 42 | } 43 | }) 44 | const openid = app.globalData.openid 45 | if (!openid) return 46 | wx.cloud.callFunction({ 47 | name: 'setUserInfo', 48 | data: {openid, data: userInfo} 49 | }).then(res => { 50 | console.log(res) 51 | }) 52 | }, 53 | 54 | // 签到 55 | signIn () { 56 | if (this.data.signInLoading) return 57 | if (!this.data.authorized) { 58 | return wx.showToast({ 59 | title: '请授权登录', 60 | icon: 'none' 61 | }) 62 | } 63 | this.setData({ signInLoading: true }) 64 | wx.cloud.callFunction({ 65 | name: 'userSign', 66 | data: { signIn: true} 67 | }).then(res => { 68 | wx.showToast({ title: '签到成功', }) 69 | this.getUserInfo() 70 | }) 71 | }, 72 | getUserFile(){ 73 | const openid = app.globalData.openid 74 | if (!openid) return 75 | wx.navigateTo({ 76 | url: '/pages/user-file/user-file?openid=' + openid, 77 | }) 78 | }, 79 | /** 80 | * 生命周期函数--监听页面加载 81 | */ 82 | onLoad: function (options) { 83 | if (wx.getUserProfile) { 84 | this.setData({ 85 | canIUseGetUserProfile: true 86 | }) 87 | } 88 | 89 | }, 90 | 91 | /** 92 | * 生命周期函数--监听页面初次渲染完成 93 | */ 94 | onReady: function () { 95 | 96 | }, 97 | 98 | // 从数据库获取用户信息,并更新用户信息 99 | getUserInfo () { 100 | // debugger 101 | const that = this 102 | const openid = app.globalData.openid 103 | if (!openid) return 104 | const db = wx.cloud.database() 105 | db.collection('user').where({ openid }).get().then(res => { 106 | // debugger 107 | this.setData({ 108 | userInfo: res.data[0], 109 | signed: res.data[0].signInDate.trim() === new Date().toDateString().trim() 110 | }) 111 | 112 | // 113 | if (this.data.canIUseGetUserProfile) { 114 | return this.setUserInfo(res.data[0]) 115 | } 116 | 117 | wx.getSetting({ 118 | success (res){ 119 | if (res.authSetting['scope.userInfo']) { 120 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称 121 | wx.getUserInfo({ 122 | success: function(res) { 123 | that.setUserInfo(res.userInfo) 124 | } 125 | }) 126 | } else { 127 | that.setData({ 128 | authorized: false 129 | }) 130 | } 131 | } 132 | }) 133 | }) 134 | }, 135 | 136 | /** 137 | * 生命周期函数--监听页面显示 138 | */ 139 | onShow: function () { 140 | this.timerFunc() 141 | }, 142 | 143 | // 定时器,解决第一次进入页面没有openid 的问题 144 | timerFunc () { 145 | const openid = app.globalData.openid 146 | if (openid) { 147 | this.getUserInfo() 148 | } else { 149 | setTimeout(() => this.timerFunc(), 3000) 150 | } 151 | }, 152 | 153 | 154 | onShareTimeline: function () { 155 | return { 156 | title: '随时随地可以制作的电子证件照神器!', 157 | path: '/pages/index/index' 158 | } 159 | }, 160 | }) -------------------------------------------------------------------------------- /miniprogram/pages/mein/mein.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的证照", 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /miniprogram/pages/mein/mein.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{userInfo.nickName}} 13 | 14 | 15 | 16 | {{userInfo.nickName}} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 35 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /miniprogram/pages/mein/mein.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/mein/mein.wxss */ 2 | .scrollPage { 3 | height: 100vh; 4 | } 5 | .user-info .cu-avatar { 6 | overflow: hidden; 7 | } 8 | 9 | .my-info { 10 | width: 95%; 11 | display: flex; 12 | justify-content: space-between; 13 | align-items: center; 14 | } 15 | 16 | .user-info .nickName { 17 | margin-left: 1em; 18 | font-weight: bold; 19 | font-size: 50rpx; 20 | 21 | } 22 | .btn{ 23 | color: #fff; 24 | } 25 | .user-info .signIn { 26 | margin-right: 10%; 27 | width: 8em; 28 | text-align: right; 29 | text-shadow: none; 30 | } 31 | .my-info-l{ 32 | display: flex; 33 | justify-content: center; 34 | align-items: center; 35 | } 36 | .my-info-r{ 37 | min-width: 5em; 38 | display: flex; 39 | justify-content: center; 40 | align-items: center; 41 | } 42 | .user-bg { 43 | background: #0acaa2; 44 | height: 280rpx; 45 | display: flex; 46 | justify-content: center; 47 | /* padding-top: 40rpx; */ 48 | overflow: hidden; 49 | position: relative; 50 | flex-direction: column; 51 | align-items: center; 52 | color: #fff; 53 | font-weight: 300; 54 | text-shadow: 0 0 3px rgba(0, 0, 0, 0.3); 55 | } 56 | 57 | .user-bg text { 58 | opacity: 0.8; 59 | } 60 | 61 | .user-bg image { 62 | width: 150rpx; 63 | height: 150rpx; 64 | border-radius: 100rpx; 65 | } 66 | 67 | .user-bg .gif-wave{ 68 | position: absolute; 69 | width: 100%; 70 | bottom: 0; 71 | left: 0; 72 | z-index: 99; 73 | mix-blend-mode: screen; 74 | height: 100rpx; 75 | } 76 | 77 | .user-info-content{ 78 | width: 90%; 79 | height: 400rpx; 80 | position: relative; 81 | margin: 0 auto; 82 | margin-top: -30rpx; 83 | background: #fff; 84 | border-radius: 20rpx; 85 | padding: 10rpx; 86 | } 87 | .user-info-content-item{ 88 | height: 120rpx; 89 | display: flex; 90 | justify-content: space-between; 91 | align-items: center; 92 | } 93 | .user-info-content-item-l{ 94 | margin-left: 20rpx; 95 | } -------------------------------------------------------------------------------- /miniprogram/pages/preImgEdit/preImgEdit.js: -------------------------------------------------------------------------------- 1 | const app = getApp() 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | photoSizeList: app.globalData.photoSizeList, 10 | width: '', 11 | height: '', 12 | px: '', 13 | size: '自定义', 14 | photoName: '自定义尺寸', 15 | discription: '', 16 | authSatus:false, 17 | preImgInfoList:[] 18 | }, 19 | 20 | /** 21 | * 生命周期函数--监听页面加载 22 | */ 23 | onLoad: function (options) { 24 | 25 | const {index,width,height,discription,data} = options 26 | if (width && height) { 27 | this.setData({px: width + ' * ' + height + '像素', width: +width, height: +height, discription}); 28 | } 29 | else{ 30 | 31 | const {width, height, px, size, name, discription} = this.data.photoSizeList[index]; 32 | this.setData({ width, height, px, size, photoName: name, discription: discription }); 33 | } 34 | wx.setNavigationBarTitle({ title: this.data.photoName }) 35 | this.getUserAuthSatus() 36 | this.getPreImgInfoList() 37 | }, 38 | 39 | /** 40 | * 选择照片 41 | */ 42 | chooseImagePre (e) { 43 | 44 | const that = this 45 | if(!this.data.authSatus){ 46 | wx.getUserProfile({ 47 | desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 48 | success: (res) => { 49 | 50 | that.setUserInfo(res.userInfo) 51 | that.chooseImage(e.target.dataset.type) 52 | }, 53 | fail(){ 54 | wx.showToast({ title: '请授权后继续', icon: 'none', duration: 2000 }) 55 | } 56 | }) 57 | }else{ 58 | that.chooseImage(e.target.dataset.type) 59 | } 60 | }, 61 | onShow: function () { 62 | this.timerFunc() 63 | }, 64 | 65 | // 定时器,解决第一次进入页面没有openid 的问题 66 | timerFunc () { 67 | const openid = app.globalData.openid 68 | if (openid) { 69 | this.getUserAuthSatus() 70 | } else { 71 | setTimeout(() => this.timerFunc(), 1000) 72 | } 73 | }, 74 | //获取标题图片 75 | getPreImgInfoList(){ 76 | wx.showLoading({ title: '加载中', }) 77 | const that = this 78 | const db = wx.cloud.database() 79 | db.collection('preImgInfoList').get().then(res => { 80 | res.data.forEach(e => { 81 | e.imgUrl = e.imgUrl.trim() 82 | }); 83 | that.setData({ 84 | preImgInfoList:res.data 85 | }) 86 | wx.hideLoading() 87 | }) 88 | }, 89 | getUserAuthSatus(){ 90 | 91 | const that = this 92 | const openid = app.globalData.openid 93 | if (!openid) return 94 | const db = wx.cloud.database() 95 | db.collection('user').where({ openid }).get().then(res => { 96 | if(res.data[0].nickName){ 97 | this.setData({ 98 | authSatus:true 99 | }) 100 | } 101 | }) 102 | }, 103 | chooseImage(sourceType){ 104 | const that = this; 105 | wx.showLoading({title: '选择照片'}) 106 | setTimeout(function () { 107 | wx.hideLoading() 108 | }, 1000) 109 | if(sourceType==='camera'){ 110 | const { width, height, photoName} = this.data 111 | //选择相机拍照 112 | wx.getSetting({ 113 | success(res) { 114 | if (res.authSetting['scope.camera']) { 115 | wx.navigateTo({ 116 | url: '/pages/autoCamera/autoCamera', 117 | success: function (res) { 118 | res.eventChannel.emit('toAutoCamera', { 119 | width, 120 | height, 121 | photoName 122 | }) 123 | } 124 | }) 125 | } else { 126 | wx.authorize({ 127 | scope: 'scope.camera', 128 | success () { 129 | }, 130 | fail(){ 131 | that.openConfirm() 132 | } 133 | }) 134 | } 135 | }, 136 | fail () { 137 | 138 | } 139 | }) 140 | 141 | }else{ 142 | //选择打开相册 143 | wx.chooseMedia({ 144 | count: 1, 145 | mediaType: 'image', 146 | sourceType: [sourceType], 147 | sizeType: 'original', 148 | camera: 'back', 149 | success:(res)=> { 150 | this.imgUpload(res.tempFiles[0].tempFilePath) 151 | 152 | }, 153 | fail () { 154 | wx.showToast({ title: '取消选择', icon: 'none', duration: 2000 }) 155 | } 156 | }) 157 | } 158 | }, 159 | openConfirm() { 160 | wx.showModal({ 161 | content: '检测到您没打开访问摄像头权限,是否打开?', 162 | confirmText: "确认", 163 | cancelText: "取消", 164 | success: function (res) { 165 | console.log(res); 166 | //点击“确认”时打开设置页面 167 | if (res.confirm) { 168 | console.log('用户点击确认') 169 | wx.openSetting({ 170 | success: (res) => { } 171 | }) 172 | } else { 173 | console.log('用户点击取消') 174 | } 175 | } 176 | }); 177 | }, 178 | // 设置用户信息 179 | setUserInfo (userInfo) { 180 | 181 | const openid = app.globalData.openid 182 | if (!openid) return 183 | wx.cloud.callFunction({ 184 | name: 'setUserInfo', 185 | data: {openid, data: userInfo} 186 | }).then(res => { 187 | console.log(res) 188 | }) 189 | }, 190 | // 上传原图, 后使用百度人像分割 191 | imgUpload(filePath) { 192 | const openid = app.globalData.openid 193 | if (!openid) return 194 | wx.showLoading({ title: '正在检测图像中', }) 195 | const fileName = filePath.split('tmp/')[1] || filePath.split('tmp_')[1]; 196 | wx.cloud.uploadFile({ 197 | cloudPath: `tmp/originfile/${openid}/${new Date().Format('yyyy-MM-dd')}/${fileName}`, 198 | filePath 199 | }) 200 | .then(res => { 201 | this.imageDivision(res.fileID) 202 | }) 203 | .catch(error => { 204 | console.log(error) 205 | wx.showToast({ title: '失败,请重试', icon: 'loading' }) 206 | }) 207 | }, 208 | 209 | // 使用百度人像分割 210 | imageDivision (fileID) { 211 | wx.cloud.callFunction({ 212 | name: 'imageDivision', 213 | data: { fileID } 214 | }) 215 | .then(({ result }) => { 216 | wx.hideLoading() 217 | if(result.res){ 218 | this.goEditPage(result) 219 | }else{ 220 | wx.showToast({ title: result.msg, icon: 'error' }) 221 | } 222 | 223 | }).catch((error) => { 224 | wx.hideLoading() 225 | console.log(error) 226 | wx.showToast({ title: '失败,请重试', icon: 'error' }) 227 | }) 228 | }, 229 | 230 | /** 231 | * 去编辑页面 232 | */ 233 | goEditPage (data) { 234 | const { width, height, photoName } = this.data 235 | wx.navigateTo({ 236 | url: '/pages/editPhoto/editPhoto', 237 | success: function (res) { 238 | res.eventChannel.emit('acceptDataFromOpenerPage', { 239 | ...data, 240 | width, 241 | height, 242 | photoName 243 | }) 244 | } 245 | }) 246 | }, 247 | 248 | /** 249 | * 用户点击右上角分享 250 | */ 251 | onShareAppMessage: function () { 252 | return { 253 | title: '随时随地可以制作的电子证件照神器!', 254 | path: '/pages/index/index', 255 | } 256 | } 257 | }) -------------------------------------------------------------------------------- /miniprogram/pages/preImgEdit/preImgEdit.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "选择照片", 3 | "disableScroll": true, 4 | "usingComponents": {} 5 | } -------------------------------------------------------------------------------- /miniprogram/pages/preImgEdit/preImgEdit.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{photoName}} 15 | 16 | 17 | 像素尺寸: 18 | {{px}} 19 | 20 | 21 | 冲印尺寸: 22 | {{size}} 23 | 24 | 25 | 分辨率: 26 | 无要求 27 | 28 | 37 | 38 | 照片描述: 39 | {{discription}} 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 相册选择 48 | 相机拍照 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /miniprogram/pages/preImgEdit/preImgEdit.wxss: -------------------------------------------------------------------------------- 1 | 2 | 3 | .container { 4 | height: 100vh; 5 | padding: 10rpx 30rpx; 6 | padding-bottom: 100rpx; 7 | overflow: visible; 8 | box-sizing: border-box; 9 | background:#fff; 10 | } 11 | .container-head{ 12 | width: 100%; 13 | height: 500rpx; 14 | display: flex; 15 | flex-direction: column; 16 | justify-content: center; 17 | background: #fff; 18 | } 19 | swiper { 20 | width: 100%; 21 | height: 350rpx; 22 | } 23 | .swiper-item { 24 | height: 100%; 25 | } 26 | 27 | /* 轮播样式 */ 28 | .swiper-img{ 29 | background-color: #fff; 30 | position: relative; 31 | height: 100%; 32 | } 33 | .swiper-img image { 34 | width: 100%; 35 | height: 100%; 36 | } 37 | .container-comtent{ 38 | width: 100%; 39 | } 40 | .container-comtent-dec { 41 | width: 100%; 42 | margin-bottom: 20rpx; 43 | background-color: rgba(255,255,255,1); 44 | line-height: 2; 45 | color: #333; 46 | border-radius: 10rpx; 47 | font-size: 28rpx; 48 | position: relative; 49 | } 50 | .container-comtent-dec-item{ 51 | height: 50px; 52 | display: flex; 53 | justify-content: space-between; 54 | } 55 | .dec{ 56 | white-space: nowrap;/*强制在一行显示*/ 57 | text-overflow:ellipsis;/*设置超出内容显示...*/ 58 | overflow: hidden;/*一定不能少 超出的内容进行隐藏*/ 59 | } 60 | .colorPick{ 61 | display: flex; 62 | } 63 | .circle{ 64 | width: 30rpx; 65 | height: 30rpx; 66 | margin-left: 10rpx; 67 | border-radius: 30rpx; 68 | } 69 | .container-optBtn{ 70 | width: 100%; 71 | display: flex; 72 | justify-content: space-between; 73 | align-items: center; 74 | } 75 | .container-btn{ 76 | width: 45%; 77 | height: 90rpx; 78 | margin-top:80rpx; 79 | border-radius: 10rpx; 80 | color: #fff; 81 | text-align: center; 82 | line-height: 90rpx; 83 | background: #0acaa2; 84 | } 85 | -------------------------------------------------------------------------------- /miniprogram/pages/user-file/user-file.js: -------------------------------------------------------------------------------- 1 | // pages/user-file/user-file.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | userFile:null, 9 | openid:'', 10 | listShow:true 11 | }, 12 | 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | this.getUserFileInfo(options.openid) 18 | }, 19 | getUserFileInfo(openid){ 20 | const that = this 21 | that.setData({ 22 | openid:openid 23 | }) 24 | const db = wx.cloud.database() 25 | db.collection('user-file').where({ openid }).get().then(res => { 26 | res.data.forEach(e => { 27 | e.time = e.time.Format('yyyy-MM-dd hh:mm:ss') 28 | }); 29 | const list = res.data 30 | if(list.length === 0){ 31 | that.setData({ 32 | listShow:false 33 | }) 34 | return 35 | } 36 | list.sort(function(a, b) { 37 | return b.time < a.time ? -1 : 1 38 | }) 39 | that.setData({ 40 | userFile:list 41 | }) 42 | console.log(this.data.userFile) 43 | }) 44 | }, 45 | download(e){ 46 | let fileId = e.target.dataset.fileid 47 | wx.cloud.downloadFile({ 48 | fileID: fileId 49 | }).then(async(res) => { 50 | await this.saveImage(res.tempFilePath) 51 | }) 52 | }, 53 | deleteImg(e){ 54 | let id = e.target.dataset.id 55 | const that = this 56 | const openid = that.data.openid 57 | wx.showModal({ 58 | title: '提示', 59 | content: '此操作将永久删除文件, 是否继续?', 60 | success (res) { 61 | if (res.confirm) { 62 | wx.cloud.callFunction({ 63 | name: 'userFile', 64 | data: { id:id } 65 | }).then(result=>{ 66 | wx.showLoading({ 67 | title: '加载中', 68 | }) 69 | setTimeout(function () { 70 | wx.hideLoading() 71 | }, 1000) 72 | 73 | that.getUserFileInfo(openid); 74 | }) 75 | } else if (res.cancel) { 76 | console.log('用户点击取消') 77 | } 78 | } 79 | }) 80 | 81 | 82 | }, 83 | // 保存图片到相册 84 | saveImage(tempFilePath) { 85 | const that = this 86 | return new Promise((resolve, reject) => { 87 | wx.saveImageToPhotosAlbum({ 88 | filePath: tempFilePath, 89 | success:() => { 90 | this.setData({ downloadSuccess: true }) 91 | wx.showToast({ title: '下载成功' }) 92 | resolve() 93 | }, 94 | fail(res) { 95 | 96 | wx.getSetting({ 97 | success(res1) { 98 | if (res1.authSetting['scope.writePhotosAlbum']) { 99 | 100 | wx.showToast({ title: '下载失败', icon: 'none' }) 101 | reject(new Error('错误')) 102 | } else { 103 | that.openConfirm() 104 | } 105 | }, 106 | fail () { 107 | reject(new Error('错误')) 108 | } 109 | }) 110 | }, 111 | }) 112 | }) 113 | }, 114 | openConfirm() { 115 | wx.showModal({ 116 | content: '检测到您之前没打开相册的写入相册权限,是否去授权?', 117 | confirmText: "去授权", 118 | cancelText: "取消", 119 | success: function (res) { 120 | console.log(res); 121 | //点击“确认”时打开设置页面 122 | if (res.confirm) { 123 | console.log('用户点击确认') 124 | wx.openSetting({ 125 | success: (res) => { } 126 | }) 127 | } else { 128 | console.log('用户点击取消') 129 | } 130 | } 131 | }); 132 | }, 133 | /** 134 | * 生命周期函数--监听页面初次渲染完成 135 | */ 136 | onReady: function () { 137 | 138 | }, 139 | 140 | /** 141 | * 生命周期函数--监听页面显示 142 | */ 143 | onShow: function () { 144 | 145 | }, 146 | 147 | /** 148 | * 生命周期函数--监听页面隐藏 149 | */ 150 | onHide: function () { 151 | 152 | }, 153 | 154 | /** 155 | * 生命周期函数--监听页面卸载 156 | */ 157 | onUnload: function () { 158 | 159 | }, 160 | 161 | /** 162 | * 页面相关事件处理函数--监听用户下拉动作 163 | */ 164 | onPullDownRefresh: function () { 165 | 166 | }, 167 | 168 | /** 169 | * 页面上拉触底事件的处理函数 170 | */ 171 | onReachBottom: function () { 172 | 173 | }, 174 | 175 | /** 176 | * 用户点击右上角分享 177 | */ 178 | onShareAppMessage: function () { 179 | 180 | } 181 | }) -------------------------------------------------------------------------------- /miniprogram/pages/user-file/user-file.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的照片", 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /miniprogram/pages/user-file/user-file.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{item.photoName}}{{item.imgBcgTip}} 11 | {{item.time}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 暂无数据,赶紧去制作证件照吧! 23 | 24 | 25 | -------------------------------------------------------------------------------- /miniprogram/pages/user-file/user-file.wxss: -------------------------------------------------------------------------------- 1 | /* pages/user-file/user-file.wxss */ 2 | .container{ 3 | width: 100vw; 4 | height: 100vh; 5 | } 6 | .container-content{ 7 | width: 90%; 8 | margin: 0 auto; 9 | } 10 | .noData{ 11 | margin-top: 50%; 12 | font-size: 30rpx; 13 | color: #ccc; 14 | } 15 | .container-content-item{ 16 | box-sizing: border-box; 17 | width: 100%; 18 | height: 350rpx; 19 | display: flex; 20 | margin-top: 50rpx; 21 | border-radius: 30rpx; 22 | padding: 20rpx; 23 | background: #fff; 24 | } 25 | .container-content-item .itme-img{ 26 | width: 40%; 27 | height: 300rpx; 28 | display: flex; 29 | justify-content: center; 30 | align-items: center; 31 | border-right: 1px dotted #ddd; 32 | 33 | 34 | } 35 | .container-content-item .itme-img image{ 36 | width: 200rpx; 37 | height: 240rpx; 38 | } 39 | .itme-img-content{ 40 | width: 55%; 41 | } 42 | .itme-img-info{ 43 | width: 100%; 44 | height: 140rpx; 45 | margin-left: 20rpx; 46 | margin-top: 30rpx; 47 | border-bottom: 1px dotted #ddd; 48 | } 49 | .itme-img-info-t{ 50 | font-size: 30rpx; 51 | 52 | } 53 | .itme-img-info-b{ 54 | margin-top: 20rpx; 55 | font-size: 25rpx; 56 | color: #ccc; 57 | } 58 | .itme-img-btn{ 59 | width: 70%; 60 | height: 150rpx; 61 | margin: 0 auto; 62 | display: flex; 63 | justify-content: space-between; 64 | align-items: center; 65 | 66 | } 67 | .icon_noData{ 68 | font-size: 120rpx; 69 | text-align: center; 70 | } 71 | .icon_download{ 72 | font-size: 60rpx; 73 | color: #ccc; 74 | } 75 | .icon_delete{ 76 | font-size: 60rpx; 77 | color: #ccc; 78 | } -------------------------------------------------------------------------------- /miniprogram/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [ 4 | { 5 | "action": "allow", 6 | "page": "pages/index/index" 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /miniprogram/tools/dateFormatter.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-extend-native 2 | Date.prototype.Format = function (fmt) { 3 | const o = { 4 | 'M+': this.getMonth() + 1, 5 | 'd+': this.getDate(), 6 | 'h+': this.getHours(), 7 | 'm+': this.getMinutes(), 8 | 's+': this.getSeconds(), 9 | 'q+': Math.floor((this.getMonth() + 3) / 3), 10 | 'S': this.getMilliseconds() 11 | } 12 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) 13 | for (var k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) 14 | return fmt 15 | } 16 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "miniprogram/", 3 | "cloudfunctionRoot": "cloudfunctions/", 4 | "setting": { 5 | "urlCheck": false, 6 | "es6": true, 7 | "enhance": true, 8 | "postcss": true, 9 | "preloadBackgroundData": true, 10 | "minified": true, 11 | "newFeature": true, 12 | "coverView": true, 13 | "nodeModules": true, 14 | "autoAudits": false, 15 | "showShadowRootInWxmlPanel": true, 16 | "scopeDataCheck": false, 17 | "uglifyFileName": true, 18 | "checkInvalidKey": true, 19 | "checkSiteMap": true, 20 | "uploadWithSourceMap": true, 21 | "compileHotReLoad": false, 22 | "useMultiFrameRuntime": true, 23 | "useApiHook": true, 24 | "useApiHostProcess": true, 25 | "babelSetting": { 26 | "ignore": [], 27 | "disablePlugins": [], 28 | "outputPath": "" 29 | }, 30 | "enableEngineNative": false, 31 | "useIsolateContext": false, 32 | "userConfirmedBundleSwitch": true, 33 | "packNpmManually": false, 34 | "packNpmRelationList": [], 35 | "minifyWXSS": true, 36 | "disableUseStrict": false, 37 | "minifyWXML": true, 38 | "showES6CompileOption": false, 39 | "useCompilerPlugins": false 40 | }, 41 | "appid": "wx17e91dff8b1d0f99", 42 | "projectname": "%E8%AF%81%E4%BB%B6%E7%85%A7%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F", 43 | "libVersion": "2.21.0", 44 | "simulatorType": "wechat", 45 | "simulatorPluginLibVersion": {}, 46 | "cloudfunctionTemplateRoot": "cloudfunctionTemplate", 47 | "condition": { 48 | "plugin": { 49 | "list": [] 50 | }, 51 | "game": { 52 | "list": [] 53 | }, 54 | "gamePlugin": { 55 | "list": [] 56 | }, 57 | "miniprogram": { 58 | "list": [ 59 | { 60 | "id": -1, 61 | "name": "db guide", 62 | "pathName": "pages/databaseGuide/databaseGuide", 63 | "query": "" 64 | }, 65 | { 66 | "name": "pages/preImgEdit/preImgEdit", 67 | "pathName": "pages/preImgEdit/preImgEdit", 68 | "query": "index=0", 69 | "scene": null 70 | }, 71 | { 72 | "name": "pages/editPhoto/editPhoto", 73 | "pathName": "pages/editPhoto/editPhoto", 74 | "query": "index=0", 75 | "scene": null 76 | } 77 | ] 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /project.private.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "setting": {}, 3 | "condition": { 4 | "plugin": { 5 | "list": [] 6 | }, 7 | "game": { 8 | "list": [] 9 | }, 10 | "gamePlugin": { 11 | "list": [] 12 | }, 13 | "miniprogram": { 14 | "list": [ 15 | { 16 | "id": -1, 17 | "name": "db guide", 18 | "pathName": "pages/databaseGuide/databaseGuide", 19 | "query": "" 20 | }, 21 | { 22 | "name": "pages/preImgEdit/preImgEdit", 23 | "pathName": "pages/preImgEdit/preImgEdit", 24 | "query": "index=0", 25 | "scene": null 26 | }, 27 | { 28 | "name": "pages/editPhoto/editPhoto", 29 | "pathName": "pages/editPhoto/editPhoto", 30 | "query": "index=0", 31 | "scene": null 32 | }, 33 | { 34 | "name": "", 35 | "pathName": "pages/autoCamera/autoCamera", 36 | "query": "", 37 | "scene": null 38 | }, 39 | { 40 | "name": "", 41 | "pathName": "pages/mein/mein", 42 | "query": "", 43 | "scene": null 44 | }, 45 | { 46 | "name": "", 47 | "pathName": "pages/editPhoto/complete/complete", 48 | "query": "msg=图片像素260 * 378,图片大小36.02kb&tempFilePath=http://tmp/bn8u2Xa5WXVrd980dae9d9423fbf04b206c4a83fecb7.jpg&url=https://6e6f-noco-04nbo-1253571313.tcb.qcloud.la/tmp/imgCompose/o_fns0JknTEtCywrlYRgV0rctuHs/2021-12-10/1639140730469-0.18653771566086075.jpg\"", 49 | "scene": null 50 | }, 51 | { 52 | "name": "", 53 | "pathName": "pages/editPhoto/complete/complete", 54 | "query": "msg=%E5%9B%BE%E7%89%87%E5%83%8F%E7%B4%A0295%20*%20413%EF%BC%8C%E5%9B%BE%E7%89%87%E5%A4%A7%E5%B0%8F44.98kb&tempFilePath=http%3A%2F%2Ftmp%2FqXCSmUYjl98nb81dd2dfdcf704ae868a7f5a2f1cd549.jpg&url=https%3A%2F%2F6e6f-noco-04nbo-1253571313.tcb.qcloud.la%2Ftmp%2FimgCompose%2Fo_fns0JknTEtCywrlYRgV0rctuHs%2F2021-12-10%2F1639144578523-0.25598459077903835.jpg", 55 | "scene": null 56 | }, 57 | { 58 | "name": "", 59 | "pathName": "pages/user-file/user-file", 60 | "query": "openid=o_fns0JknTEtCywrlYRgV0rctuHs", 61 | "scene": null 62 | } 63 | ] 64 | } 65 | } 66 | } --------------------------------------------------------------------------------