Просмотр исходного кода

入驻更新

修复组织入驻问题
RegMs If 4 лет назад
Родитель
Сommit
0bdcc3c4f9

+ 7 - 7
cloudfunctions/createPublisher/index.js

@@ -13,12 +13,12 @@ exports.main = async (event, context) => {
   const code_check = await db.collection('invite').where({
     code: event.code
   }).get()
-  if (code_check.length === 0) {
+  if (code_check.data.length === 0) {
     return {
       errMsg: '邀请码不存在'
     }
   }
-  if (code_check[0].pub_id !== '') {
+  if (code_check.data[0].pub_id !== '') {
     return {
       errMsg: '邀请码已被使用'
     }
@@ -26,12 +26,12 @@ exports.main = async (event, context) => {
   const name_check = await db.collection('publisher').where({
     name: event.name
   }).get()
-  if (name_check.length !== 0) {
+  if (name_check.data.length !== 0) {
     return {
       errMsg: '名称已存在'
     }
   }
-  const pub_id = await db.collection('publisher').add({
+  const publisher = await db.collection('publisher').add({
     data: {
       name: event.name,
       type: event.type,
@@ -45,17 +45,17 @@ exports.main = async (event, context) => {
     code: event.code
   }).update({
     data: {
-      pub_id: pub_id,
+      pub_id: publisher._id,
       use_time: new Date()
     }
   })
   await db.collection('manager').add({
     data: {
-      pub_id: pub_id,
+      pub_id: publisher._id,
       user_id: OPENID,
       title: '',
       role: '拥有者'
     }
   })
-  return pub_id
+  return publisher
 }

+ 1 - 1
miniprogram/pages/publisherLogin/publisherLogin.js

@@ -157,7 +157,7 @@ Page({
       })
     }).then(res => {
       wx.hideLoading()
-      if (res.result.data !== undefined) {
+      if (res.result._id !== undefined) {
         this.setData({
           currentTab: 4
         })