-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"name": "更新库存", | ||
"value": { | ||
"operationType": 1, | ||
"goodsList": [ | ||
{ | ||
"_id": "28ee4e3e600d83e400d0523b50c3aa73", | ||
"buyNum": 10 | ||
} | ||
] | ||
} | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"permissions": { | ||
"openapi": [ | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 云函数入口文件 | ||
const cloud = require('wx-server-sdk') | ||
|
||
cloud.init({ | ||
env: cloud.DYNAMIC_CURRENT_ENV | ||
}) | ||
|
||
const db = cloud.database(); | ||
|
||
// 云函数入口函数 | ||
exports.main = async (event, context) => { | ||
const wxContext = cloud.getWXContext() | ||
console.log("添加商品", wxContext) | ||
console.log("event数据", event) | ||
const {categoryId,categoryName,describe,fileId,goodsName,imgUrl,inventory,isSale,originPrice,price,saleNum,tagName}=event | ||
const resp= await db.collection("goodsList").add({ | ||
data:{ | ||
categoryId:categoryId, | ||
categoryName:categoryName, | ||
describe:describe, | ||
fileId:fileId, | ||
goodsName:goodsName, | ||
imgUrl:imgUrl, | ||
inventory:inventory, | ||
isSale:isSale, | ||
originPrice:originPrice, | ||
price:price, | ||
saleNum:saleNum, | ||
tagName:tagName, | ||
createTime:new Date().getTime | ||
} | ||
}) | ||
return { | ||
event, | ||
openid: wxContext.OPENID, | ||
appid: wxContext.APPID, | ||
unionid: wxContext.UNIONID, | ||
data: resp | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "addGoods", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"wx-server-sdk": "~2.3.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"permissions": { | ||
"openapi": [ | ||
"wxacode.get" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 云函数入口文件 | ||
const cloud = require('wx-server-sdk') | ||
|
||
cloud.init({ | ||
env: cloud.DYNAMIC_CURRENT_ENV | ||
}) | ||
|
||
// 云函数入口函数 | ||
exports.main = async (event, context) => { | ||
const wxContext = cloud.getWXContext() | ||
const {openId} = event | ||
// 获取小程序码,A接口 | ||
|
||
try { | ||
const result = await cloud.openapi.wxacode.get({ | ||
path: '/pages/index/index?shareId=' + openId, | ||
width: 430 | ||
}) | ||
console.log(" 二维码上传结果", result.buffer, openId) | ||
return await cloud.uploadFile({ | ||
cloudPath: 'code/' + openId + '.png', | ||
fileContent: result.buffer | ||
}) | ||
} catch (err) { | ||
return err | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.