Commit 6bba43b6 authored by 李超鹏's avatar 李超鹏

修改用户token 增加提示

parent 0f115d95
This diff is collapsed.
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
"url": s, "url": s,
}).then(res =>{ }).then(res =>{
console.log(res, "云服务保存图片"); console.log(res, "云服务保存图片");
if(res.result) { if(res.result.code) {
// TODO 参数是否要来回传递 // TODO 参数是否要来回传递
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItemLength++ photo.currentItemLength++
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
},2000) },2000)
} else { } else {
uni.showToast({ uni.showToast({
title:'图片上传失败' title:'图片上传失败 '+ res.result.msg
}) })
} }
}) })
......
This diff is collapsed.
...@@ -5,7 +5,7 @@ async function getUserId(token) { ...@@ -5,7 +5,7 @@ async function getUserId(token) {
method: 'GET', method: 'GET',
dataType: 'text' dataType: 'text'
}) })
return res && res.status === 200 ? res.data : token return res && res.status === 200 ? res.data : ""
} }
module.exports = { module.exports = {
......
...@@ -7,6 +7,10 @@ exports.main = async (event, context) => { ...@@ -7,6 +7,10 @@ exports.main = async (event, context) => {
const _ = db.command const _ = db.command
const $ = db.command.aggregate const $ = db.command.aggregate
const user_id = await getUserId(event.token) const user_id = await getUserId(event.token)
if(!user_id){
return {error_code:'user_auth',error_msg:"用户没有权限"}
}
let res = await db.collection("standardV2").aggregate().lookup({ let res = await db.collection("standardV2").aggregate().lookup({
from: 'user_upload_file', from: 'user_upload_file',
let: { let: {
......
...@@ -5,6 +5,9 @@ const { ...@@ -5,6 +5,9 @@ const {
exports.main = async (event, context) => { exports.main = async (event, context) => {
//event为客户端上传的参数 //event为客户端上传的参数
const user_id = await getUserId(event.token) const user_id = await getUserId(event.token)
if(!user_id){
return {error_code:'user_auth',error_msg:"用户没有权限"}
}
const collection = uniCloud.database().collection("user_watermark").field({ const collection = uniCloud.database().collection("user_watermark").field({
'_id': false '_id': false
}) })
......
...@@ -12,8 +12,8 @@ exports.main = async (event, context) => { ...@@ -12,8 +12,8 @@ exports.main = async (event, context) => {
url: "https://img2.banshouhui.com/" + event.url, url: "https://img2.banshouhui.com/" + event.url,
create_date: new Date() create_date: new Date()
}) })
return true return {code:true}
}else{
return {code:false,msg:"用户没有权限"}
} }
return false
}; };
...@@ -5,7 +5,6 @@ const { ...@@ -5,7 +5,6 @@ const {
exports.main = async (event, context) => { exports.main = async (event, context) => {
let user_id = await getUserId(event.token) let user_id = await getUserId(event.token)
console.log(user_id);
const watermark = event.watermark const watermark = event.watermark
if (user_id) { if (user_id) {
watermark.user_id = user_id watermark.user_id = user_id
...@@ -19,7 +18,8 @@ exports.main = async (event, context) => { ...@@ -19,7 +18,8 @@ exports.main = async (event, context) => {
} else { } else {
await collection.add(watermark) await collection.add(watermark)
} }
return {code:true}
}else{
return {code:false,msg:"用户没有权限"}
} }
//返回数据给客户端
return true
}; };
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
} }
} }
}, },
"standardV5": { "standardV2": {
"data": [{ "data": [{
"classify_id": "79550af260555cc20afb34146966a2c4", "classify_id": "79550af260555cc20afb34146966a2c4",
"system_id": "79550af260555cc20afb34156c94b32c", "system_id": "79550af260555cc20afb34156c94b32c",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment