2019-04-25 08:23:30 +08:00

99 lines
2.0 KiB
JavaScript

wx.cloud.callFunction({
name: 'sM_createProduct',
data: {
adds: '',
productName: '',
details: '',
price: 0,
isfree: true,
tags: '',
photos: ["", ""],
detailInfo:detailInfo
}
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
wx.cloud.callFunction({
name: 'sM_searchProductList',
data: {
status: 621,
argument: "台灯", //仅在使用500模糊查询时使用
}
}).then(res => {
console.log(res.result)
}).catch(err => {
console.log(err)
})
//注册
db.collection("sM_userInfo").add({
data: {
userName: userInfo.nickName,
avatar: userInfo.avatarUrl,
phone: "15143211127",
wxid: "15143211127",
adds: "南区二舍",
want: [],
issue: [],
newMsg: {
want: [],
reply: []
},
warning: [],
}
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
//登录
wx.cloud.callFunction({
name: "sM_login"
}).then(res => {
console.log(res.result.userInfo[0])
detailInfo = res;
}).catch(err => {
console.log(err)
})
//comment 前端判断是回复还是评论
var iscomment = true;
wx.cloud.callFunction({
name: 'sM_comment',
data: {
iscomment:iscomment,
detailInfo:detailInfo,
prodectId:"96c1cbbe5cbfbcd80599b5253d4fe6ba",
msg:"小东西真精致",
}
}).then(res => {
console.log(res.result)
}).catch(err => {
console.log(err)
})
//comment 前端判断是回复还是评论
var iscomment = false,replyName = "英树",replyNum = 1, replyId = 'ee3099285cc0247005d90def39a28f1b', prodectId = "96c1cbbe5cbfbcd80599b5253d4fe6ba", msg = '小东西真精致', prodectName = "大碗宽面";
wx.cloud.callFunction({
name: 'sM_comment',
data: {
iscomment:iscomment,
detailInfo:detailInfo,
prodectId: prodectId,
msg:'@'+replyName+':'+msg,
replyNum : replyNum,
replyId : replyId,
prodectName: prodectName,
}
}).then(res => {
console.log(res.result) //新的当前商品信息
}).catch(err => {
console.log(err)
})