收藏
回答

微信云开发调不通内容安全错误码

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 工具 wx50e9743c7db9c712 tong-da-2gwptex949b4db43 3.10.2

日志内容

securityReview 云函数代码

// 云函数:内容安全审核
const cloud = require('wx-server-sdk');

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});

const db = cloud.database();

// 模板消息配置
const TEMPLATE_CONFIG = {
  REVIEW_RESULT: 'REVIEW_RESULT_TEMPLATE'// 审核结果通知模板ID
  POST_PUBLISHED: 'POST_PUBLISHED_TEMPLATE' // 发布成功通知模板ID
};

/**
 * 内容安全审核工具类
 */
class SecurityReviewer {
  /**
   * 审核发帖内容
   */
  static async reviewPostContent(content, images = []) {
    try {
      console.log('开始审核发帖内容...');
      
      const reviewResult = {
        passed: true,
        reason: '',
        violations: [],
        riskLevel: 'low'// low, medium, high
        reviewTime: new Date()
      };

      // 1. 文本内容审核
      const textReview = await this.reviewText(content);
      if (!textReview.passed) {
        reviewResult.passed = false;
        reviewResult.violations.push(...textReview.violations);
        reviewResult.riskLevel = textReview.riskLevel;
      }

      // 2. 图片内容审核
      if (images && images.length > 0) {
        const imageReview = await this.reviewImages(images);
        if (!imageReview.passed) {
          reviewResult.passed = false;
          reviewResult.violations.push(...imageReview.violations);
          if (imageReview.riskLevel === 'high') {
            reviewResult.riskLevel = 'high';
          } else if (imageReview.riskLevel === 'medium' && reviewResult.riskLevel === 'low') {
            reviewResult.riskLevel = 'medium';
          }
        }
      }

      // 3. 综合风险评估
      if (reviewResult.violations.length > 0) {
        reviewResult.reason = reviewResult.violations.join('; ');
      }

      console.log('发帖内容审核完成:', reviewResult);
      console.log(`审核详情 - 通过: ${reviewResult.passed}, 违规项: ${reviewResult.violations.length}, 风险等级: ${reviewResult.riskLevel}`);
      return reviewResult;

    } catch (error) {
      console.error('发帖内容审核失败:', error);
      // 当审核服务完全失败时,设置为需要人工审核
      return {
        passed: false,
        reason: '审核服务异常,需要人工审核',
        violations: ['审核服务异常'],
        riskLevel: 'high',
        reviewTime: new Date()
      };
    }
  }

  /**
   * 审核用户资料
   */
  static async reviewUserProfile(userData) {
    try {
      console.log('开始审核用户资料...');
      
      const reviewResult = {
        passed: true,
        reason: '',
        violations: [],
        riskLevel: 'low',
        reviewTime: new Date()
      };

      // 1. 昵称审核
      if (userData.nickname) {
        const nicknameReview = await this.reviewText(userData.nickname);
        if (!nicknameReview.passed) {
          reviewResult.passed = false;
          reviewResult.violations.push(`昵称违规: ${nicknameReview.violations.join(', ')}`);
          reviewResult.riskLevel = nicknameReview.riskLevel;
        }
      }

      // 2. 个人简介审核
      if (userData.bio) {
        const bioReview = await this.reviewText(userData.bio);
        if (!bioReview.passed) {
          reviewResult.passed = false;
          reviewResult.violations.push(`个人简介违规: ${bioReview.violations.join(', ')}`);
          if (bioReview.riskLevel === 'high') {
            reviewResult.riskLevel = 'high';
          } else if (bioReview.riskLevel === 'medium' && reviewResult.riskLevel === 'low') {
            reviewResult.riskLevel = 'medium';
          }
        }
      }

      // 3. 头像审核(如果有头像URL)
      if (userData.avatar && userData.avatar.startsWith('cloud://')) {
        const avatarReview = await this.reviewImages([userData.avatar]);
        if (!avatarReview.passed) {
          reviewResult.passed = false;
          reviewResult.violations.push(`头像违规: ${avatarReview.violations.join(', ')}`);
          if (avatarReview.riskLevel === 'high') {
            reviewResult.riskLevel = 'high';
          }
        }
      }

      if (reviewResult.violations.length > 0) {
        reviewResult.reason = reviewResult.violations.join('; ');
      }

      console.log('用户资料审核完成:', reviewResult);
      return reviewResult;

    } catch (error) {
      console.error('用户资料审核失败:', error);
      return {
        passed: false,
        reason: '审核服务异常',
        violations: ['审核服务异常'],
        riskLevel: 'high',
        reviewTime: new Date()
      };
    }
  }

  /**
   * 文本内容审核
   */
  static async reviewText(text) {
    try {
      if (!text || text.trim() === '') {
        return { passed: true, violations: [], riskLevel: 'low' };
      }

      const violations = [];
      let riskLevel = 'low';

      // 只进行微信云内容安全API审核
      console.log('开始文本内容安全审核');
      
      try {
        // 调用微信文本安全审核API
        const textSecResult = await cloud.openapi.security.msgSecCheck({
          content: text.trim()
        });
        
        console.log('微信文本安全审核结果:', textSecResult);
        
        if (textSecResult.errCode !== 0) {
          violations.push('文本内容违规');
          riskLevel = 'high';
          
          // 根据错误码判断具体违规类型
          switch (textSecResult.errCode) {
            case 87014:
              violations.push('文本包含违法违规内容');
              break;
            case 87015:
              violations.push('文本包含敏感词');
              break;
            case 87016:
              violations.push('文本包含垃圾信息');
              break;
            default:
              violations.push(`文本审核失败: ${textSecResult.errMsg}`);
          }
          
          return {
            passed: false,
            violations: violations,
            riskLevel: riskLevel
          };
        } else {
          console.log('微信API审核通过');
          return {
            passed: true,
            violations: [],
            riskLevel: 'low'
          };
        }
      } catch (apiError) {
        console.error('微信文本安全API调用失败:', apiError);
        console.error('API错误详情:', {
          code: apiError.errCode,
          message: apiError.errMsg
        });
        
        if (apiError.errCode === -604101) {
          console.log('权限不足,无法调用微信API,设置为人工审核');
          return {
            passed: false,
            violations: ['微信API权限不足,需要人工审核'],
            riskLevel: 'high'
          };
        } else {
          console.log('API调用失败,设置为人工审核');
          return {
            passed: false,
            violations: ['微信API调用失败,需要人工审核'],
            riskLevel: 'high'
          };
        }
      }

    } catch (error) {
      console.error('文本审核失败:', error);
      return {
        passed: false,
        violations: ['文本审核异常'],
        riskLevel: 'high'
      };
    }
  }

  /**
   * 图片内容审核(使用最新的mediaCheckAsync接口)
   * 
   * 注意:mediaCheckAsync是微信最新的异步内容安全审核接口
   * - 支持更准确的图片内容识别
   * - 支持更多违规类型检测
   * - 异步处理,成功时返回trace_id
   * - 审核结果会在30分钟内推送到消息接收服务器
   * - 建议使用v2版本获得最佳效果
   * 
   * 重要:由于是异步接口,当前实现暂时标记为通过
   * 实际审核结果需要等待异步推送,或考虑使用同步的imgSecCheck接口
   */
  static async reviewImages(images) {
    try {
      if (!images || images.length === 0) {
        return { passed: true, violations: [], riskLevel: 'low' };
      }

      const violations = [];
      let riskLevel = 'low';

      // 只进行微信云内容安全API进行图片审核
      for (let i = 0; i < images.length; i++) {
        const image = images[i];
        
        console.log(`审核图片 ${i + 1}/${images.length}:`, image);
        
        try {
          // 获取图片的Buffer数据
          let imageBuffer;
          let imageUrl = '';
          
          // 处理图片对象,提取URL
          if (typeof image === 'object' && image.url) {
            imageUrl = image.url;
          } else if (typeof image === 'string') {
            imageUrl = image;
          } else {
            console.log(`图片 ${i + 1} 格式无效,跳过审核`);
            continue;
          }
          
          console.log(`处理图片 ${i + 1} URL: ${imageUrl}`);
          
          if (imageUrl.startsWith('cloud://')) {
            // 云存储图片,下载后审核
            console.log(`下载云存储图片: ${imageUrl}`);
            const downloadResult = await cloud.downloadFile({
              fileID: imageUrl
            });
            imageBuffer = downloadResult.fileContent;
            console.log(`图片下载成功,大小: ${imageBuffer ? imageBuffer.length : 0} bytes`);
            
            // 记录图片下载操作(异步执行,不阻塞审核流程)
            try {
              cloud.callFunction({
                name: 'storageResourceManager',
                data: {
                  action: 'recordFileDownload',
                  fileID: imageUrl,
                  options: {
                    functionName: 'securityReview',
                    operationType: 'content_review'
                  }
                }
              }).catch((error) => {
                console.error('记录图片下载失败:', error);
              });
            } catch (error) {
              console.error('记录图片下载异常:', error);
            }
          } else if (imageUrl.startsWith('http://tmp/')) {
            // 临时文件,直接读取
            console.log(`处理临时文件: ${imageUrl}`);
            const tempResult = await cloud.getTempFileURL({
              fileList: [imageUrl]
            });
            if (tempResult.fileList && tempResult.fileList[0]) {
              imageBuffer = tempResult.fileList[0].tempFileURL;
            } else {
              console.log(`临时文件获取失败: ${imageUrl}`);
              continue;
            }
          } else {
            console.log(`跳过非云存储图片: ${imageUrl}`);
            continue;
          }

          // 检查图片数据是否有效
          if (!imageBuffer) {
            console.log(`图片 ${i + 1} 数据无效,跳过审核`);
            violations.push(`图片${i + 1}数据无效`);
            continue;
          }

          // 检查图片大小限制(微信API限制1MB)
          if (imageBuffer.length > 1024 * 1024) {
            console.log(`图片 ${i + 1} 过大,跳过审核`);
            violations.push(`图片${i + 1}文件过大`);
            continue;
          }

          // 调用微信图片安全审核API(使用最新的mediaCheckAsync接口)
          // 注意:mediaCheckAsync是异步接口,需要先获取图片的临时URL
          let mediaUrl = '';
          
          if (imageUrl.startsWith('cloud://')) {
            // 获取云存储图片的临时URL
            const tempUrlResult = await cloud.getTempFileURL({
              fileList: [imageUrl]
            });
            if (tempUrlResult.fileList && tempUrlResult.fileList[0]) {
              mediaUrl = tempUrlResult.fileList[0].tempFileURL;
            } else {
              console.log(`图片 ${i + 1} 获取临时URL失败`);
              violations.push(`图片${i + 1}获取临时URL失败`);
              continue;
            }
          } else if (imageUrl.startsWith('http://tmp/')) {
            // 临时文件直接使用
            mediaUrl = imageUrl;
          } else {
            console.log(`图片 ${i + 1} 不是有效的云存储文件`);
            violations.push(`图片${i + 1}不是有效的云存储文件`);
            continue;
          }
          
          const imgSecResult = await cloud.openapi.security.mediaCheckAsync({
            media_url: mediaUrl,
            media_type: 2// 2:图片 1:音频 3:视频
            version: 2// 使用v2版本
            openid: wxContext.OPENID, // 用户openid
            scene: 1 // 场景值,1:资料,2:评论,3:论坛,4:社交日志
          });
          
          console.log(`图片 ${i + 1} 审核结果:`, imgSecResult);
          
          if (imgSecResult.errCode !== 0) {
            violations.push(`图片${i + 1}审核未通过`);
            riskLevel = 'high';
            
            // 根据错误码判断具体违规类型(mediaCheckAsync的错误码)
            switch (imgSecResult.errCode) {
              case 40001:
                violations.push(`图片${i + 1}access_token无效`);
                break;
              case 40003:
                violations.push(`图片${i + 1}openid无效`);
                break;
              case 40004:
                violations.push(`图片${i + 1}media_type错误`);
                break;
              case 43104:
                violations.push(`图片${i + 1}appid与openid不匹配`);
                break;
              case 44991:
                violations.push(`图片${i + 1}超出接口每分钟调用限制`);
                break;
              case 45009:
                violations.push(`图片${i + 1}超出接口每日调用限制`);
                break;
              case 61010:
                violations.push(`图片${i + 1}用户访问记录超时`);
                break;
              default:
                violations.push(`图片${i + 1}审核失败: ${imgSecResult.errMsg}`);
            }
          } else {
            console.log(`图片 ${i + 1} 审核任务提交成功`);
            
            // mediaCheckAsync是异步接口,成功时返回trace_id
            if (imgSecResult.trace_id) {
              console.log(`图片 ${i + 1} 审核任务ID: ${imgSecResult.trace_id}`);
              
              // 注意:mediaCheckAsync是异步接口,结果会在30分钟内推送到消息接收服务器
              // 这里暂时标记为通过,实际结果需要等待异步推送
              // 如果需要同步处理,可以考虑使用imgSecCheck接口
              console.log(`图片 ${i + 1} 异步审核已提交,等待结果推送`);
            }
          }
        } catch (imgError) {
          console.error(`图片 ${i + 1} mediaCheckAsync API调用失败:`, imgError);
          console.error(`图片错误详情:`, {
            image: image,
            code: imgError.errCode,
            message: imgError.errMsg
          });
          
          if (imgError.errCode === -1) {
            console.log(`图片 ${i + 1} 系统错误,设置为人工审核`);
            violations.push(`图片${i + 1}系统错误,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 40001) {
            console.log(`图片 ${i + 1} access_token无效,设置为人工审核`);
            violations.push(`图片${i + 1}access_token无效,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 40003) {
            console.log(`图片 ${i + 1} openid无效,设置为人工审核`);
            violations.push(`图片${i + 1}openid无效,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 40004) {
            console.log(`图片 ${i + 1} media_type错误,设置为人工审核`);
            violations.push(`图片${i + 1}media_type错误,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 43104) {
            console.log(`图片 ${i + 1} appid与openid不匹配,设置为人工审核`);
            violations.push(`图片${i + 1}appid与openid不匹配,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 44991) {
            console.log(`图片 ${i + 1} 超出接口每分钟调用限制,设置为人工审核`);
            violations.push(`图片${i + 1}超出接口每分钟调用限制,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 45009) {
            console.log(`图片 ${i + 1} 超出接口每日调用限制,设置为人工审核`);
            violations.push(`图片${i + 1}超出接口每日调用限制,需要人工审核`);
            riskLevel = 'high';
          } else if (imgError.errCode === 61010) {
            console.log(`图片 ${i + 1} 用户访问记录超时,设置为人工审核`);
            violations.push(`图片${i + 1}用户访问记录超时,需要人工审核`);
            riskLevel = 'high';
          } else {
            console.log(`图片 ${i + 1} mediaCheckAsync API调用失败,设置为人工审核`);
            violations.push(`图片${i + 1}API调用失败,需要人工审核`);
            riskLevel = 'high';
          }
        }
      }

    } catch (error) {
      console.error('图片审核失败:', error);
      return {
        passed: false// 图片审核失败时需要人工审核
        violations: ['图片审核服务异常'],
        riskLevel: 'high'
      };
    }
  }

  /**
   * 审核用户资料
   */
}

/**
 * 更新帖子状态
 */
async function updatePostStatus(postId, status, reviewResult = null{
  try {
    const updateData = {
      status: status,
      updateTime: new Date()
    };

    if (reviewResult) {
      // 先删除现有的reviewResult字段,再设置新的
      await db.collection('posts').doc(postId).update({
        data: {
          reviewResult: db.command.remove()
        }
      });
      
      // 等待一下确保删除完成
      await new Promise(resolve => setTimeout(resolve, 100));
      
      // 设置新的reviewResult
      updateData.reviewResult = reviewResult;
      updateData.reviewTime = reviewResult.reviewTime;
      
      // 根据审核结果设置reviewStatus
      if (reviewResult.passed) {
        updateData.reviewStatus = 'approved';
      } else {
        updateData.reviewStatus = 'rejected';
      }
    } else {
      // 如果没有审核结果,保持pending状态
      updateData.reviewStatus = 'pending';
    }

    await db.collection('posts').doc(postId).update({
      data: updateData
    });

    console.log(`帖子 ${postId} 状态更新为: ${status}, 审核状态: ${updateData.reviewStatus}`);
    console.log(`更新数据详情:`, updateData);
  } catch (error) {
    console.error('更新帖子状态失败:', error);
  }
}

// 发送审核结果模板通知
async function sendReviewResultNotification(postId, reviewResult{
  try {
    console.log(`开始发送审核结果通知: 帖子 ${postId}`);
    
    // 获取帖子信息
    const postResult = await db.collection('posts').doc(postId).get();
    if (!postResult.data) {
      console.error(`帖子 ${postId} 不存在`);
      return;
    }
    
    const post = postResult.data;
    const userId = post.userId;
    
    // 获取用户信息
    const userResult = await db.collection('users').doc(userId).get();
    if (!userResult.data) {
      console.error(`用户 ${userId} 不存在`);
      return;
    }
    
    const user = userResult.data;
    
    // 检查用户是否有openid
    if (!user.openid) {
      console.error(`用户 ${userId} 没有openid,无法发送通知`);
      return;
    }
    
    // 构建模板消息数据
    const templateData = {
      thing1: { value: reviewResult.passed ? '审核通过' : '审核未通过' },
      thing2: { value: post.content.substring(020) + (post.content.length > 20 ? '...' : '') },
      thing3: { value: reviewResult.passed ? '您的内容已通过审核,现在可以正常显示' : (reviewResult.reason || '内容不符合规范') },
      time4: { value: new Date().toLocaleString() }
    };
    
    console.log(`准备发送模板通知:`, {
      touser: user.openid,
      templateData: templateData
    });
    
    // 发送模板消息
    const result = await cloud.openapi.subscribeMessage.send({
      touser: user.openid,
      template_id: TEMPLATE_CONFIG.REVIEW_RESULT, // 使用配置的模板ID
      page: 'pages/home/index',
      data: templateData,
      miniprogram_state: 'formal'
    });
    
    if (result.errCode === 0) {
      console.log(`审核结果通知发送成功: 帖子 ${postId}, 用户 ${user.openid}`);
    } else {
      console.error(`审核结果通知发送失败:`, result.errMsg);
    }
    
  } catch (error) {
    console.error('发送审核结果通知异常:', error);
  }
}

/**
 * 异步审核帖子
 */
async function asyncReviewPost(postId, content, images{
  try {
    console.log(`=== 开始异步审核帖子: ${postId} ===`);
    console.log(`内容: ${content}`);
    console.log(`图片数量: ${images ? images.length : 0}`);
    
    // 执行内容审核
    console.log(`开始执行内容审核...`);
    const reviewResult = await SecurityReviewer.reviewPostContent(content, images);
    
    console.log(`审核结果:`, reviewResult);
    console.log(`审核通过: ${reviewResult.passed}`);
    console.log(`违规项: ${reviewResult.violations.join(', ')}`);
    console.log(`风险等级: ${reviewResult.riskLevel}`);
    
    // 根据审核结果更新帖子状态
    if (reviewResult.passed) {
      // 审核通过,设置为正常状态
      console.log(`准备更新帖子状态为正常 (status: 0)`);
      await updatePostStatus(postId, 0, reviewResult);
      console.log(`帖子 ${postId} 审核通过,状态已更新`);
    } else {
      // 审核未通过,设置为违规状态
      console.log(`准备更新帖子状态为违规 (status: 3)`);
      await updatePostStatus(postId, 3, reviewResult);
      console.log(`帖子 ${postId} 审核未通过:`, reviewResult.reason);
    }

    // 记录审核日志
    await db.collection('review_logs').add({
      data: {
        postId: postId,
        reviewType: 'post_content',
        reviewResult: reviewResult,
        createTime: new Date()
      }
    });

    // 发送审核结果模板通知
    try {
      await sendReviewResultNotification(postId, reviewResult);
    } catch (notificationError) {
      console.error(`发送审核结果通知失败:`, notificationError);
    }

  } catch (error) {
    console.error(`=== 异步审核帖子 ${postId} 失败 ===`);
    console.error(`错误详情:`, error);
    console.error(`错误堆栈:`, error.stack);
    
    // 审核异常时,设置为审核中状态,等待管理员审核
    console.log(`设置帖子状态为审核中 (status: 1)`);
    await updatePostStatus(postId, 1, {
      passed: false,
      reason: '审核服务异常,等待管理员审核',
      violations: ['审核服务异常'],
      riskLevel: 'high',
      reviewTime: new Date()
    });
    console.log(`异常处理完成,帖子状态已设置为审核中`);
  }
}

// 云函数入口函数
exports.main = async (event, context) => {
  const { action } = event;
  
  try {
    console.log('=== securityReview云函数被调用 ===');
    console.log('action:', action);
    console.log('event:'JSON.stringify(event, null2));
    
    switch (action) {
      case 'reviewPostContent':
        // 审核发帖内容
        const { content, images } = event;
        const postReviewResult = await SecurityReviewer.reviewPostContent(content, images);
        return {
          success: true,
          data: postReviewResult
        };

      case 'reviewUserProfile':
        // 审核用户资料
        const { userData } = event;
        const userReviewResult = await SecurityReviewer.reviewUserProfile(userData);
        return {
          success: true,
          data: userReviewResult
        };

      case 'asyncReviewPost':
        // 异步审核帖子
        const { postId, content: postContent, images: postImages } = event;
        console.log(`收到审核请求:`, { postId, postContent, postImages });
        console.log(`开始执行异步审核...`);
        await asyncReviewPost(postId, postContent, postImages);
        console.log(`异步审核执行完成`);
        return {
          success: true,
          message: '异步审核已完成'
        };

      default:
        return {
          success: false,
          message: '未知的操作类型'
        };
    }
  } catch (error) {
    console.error('云审核函数执行失败:', error);
    return {
      success: false,
      message: '审核服务异常',
      error: error.message
    };
  }
};

/**
 * 通用模板消息发送方法
 */
async function sendTemplateMessage(openid, templateId, templateData, page = 'pages/home/index'{
  try {
    console.log(`发送模板消息:`, { openid, templateId, templateData, page });
    
    const result = await cloud.openapi.subscribeMessage.send({
      touser: openid,
      template_id: templateId,
      page: page,
      data: templateData,
      miniprogram_state: 'formal'
    });
    
    if (result.errCode === 0) {
      console.log(`模板消息发送成功: 用户 ${openid}`);
      return { success: true, result };
    } else {
      console.error(`模板消息发送失败:`, result.errMsg);
      return { success: false, error: result.errMsg };
    }
    
  } catch (error) {
    console.error('发送模板消息异常:', error);
    return { success: false, error: error.message };
  }
}


函数执行日志 

Request ID: 20fcd358-ab16-44b6-bb42-debceedf3f7c

执行时间: 1471ms内存使用: 29.46 MB

返回结果

{"success":true,"message":"异步审核已完成"}

日志

START RequestId: 20fcd358-ab16-44b6-bb42-debceedf3f7c

Event RequestId: 20fcd358-ab16-44b6-bb42-debceedf3f7c

2025-10-14T08:00:59.395Z === securityReview云函数被调用 ===

2025-10-14T08:00:59.396Z action: asyncReviewPost

2025-10-14T08:00:59.396Z event: {

"action": "asyncReviewPost",

"content": "嘎嘎嘎哈慈",

"images": [

{

"compressed": true,

"fileID": "cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg",

"name": "hc0pudpfio.jpg",

"originalSize": 2074229,

"size": 2074229,

"tempFilePath": "http://tmp/BmHPnp1aWtntd913cbe0c5b49a18f7c90dc9996dee94.jpg",

"url": "cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg"

}

],

"postId": "a292647f68ee033b02abd2987277469b",

"tcbContext": {},

"userInfo": {

"appId": "wx50e9743c7db9c712"

}

}

2025-10-14T08:00:59.397Z 收到审核请求: {

postId: 'a292647f68ee033b02abd2987277469b',

postContent: '嘎嘎嘎哈慈',

postImages: [

{

compressed: true,

fileID: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg',

name: 'hc0pudpfio.jpg',

originalSize: 2074229,

size: 2074229,

tempFilePath: 'http://tmp/BmHPnp1aWtntd913cbe0c5b49a18f7c90dc9996dee94.jpg',

url: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg'

}

]

}

2025-10-14T08:00:59.399Z 开始执行异步审核...

2025-10-14T08:00:59.399Z === 开始异步审核帖子: a292647f68ee033b02abd2987277469b ===

2025-10-14T08:00:59.399Z 内容: 嘎嘎嘎哈慈

2025-10-14T08:00:59.399Z 图片数量: 1

2025-10-14T08:00:59.399Z 开始执行内容审核...

2025-10-14T08:00:59.400Z 开始审核发帖内容...

2025-10-14T08:00:59.400Z 开始文本内容安全审核

2025-10-14T08:00:59.602Z 微信文本安全API调用失败: CloudSDKError: errCode: -604101 function has no permission to call this API | errMsg: system error: error code: -604101

at callGeneralOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:487:27)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2364:28)

at async Function.reviewText (/var/user/index.js:166:31)

at async Function.reviewPostContent (/var/user/index.js:36:26)

at async asyncReviewPost (/var/user/index.js:603:26)

at async exports.main (/var/user/index.js:691:9) {

errCode: -604101,

errMsg: 'system error: error code: -604101'

}

2025-10-14T08:00:59.604Z API错误详情: { code: -604101, message: 'system error: error code: -604101' }

2025-10-14T08:00:59.604Z 权限不足,无法调用微信API,设置为人工审核

2025-10-14T08:00:59.605Z 审核图片 1/1: {

compressed: true,

fileID: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg',

name: 'hc0pudpfio.jpg',

originalSize: 2074229,

size: 2074229,

url: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg'

tempFilePath: 'http://tmp/BmHPnp1aWtntd913cbe0c5b49a18f7c90dc9996dee94.jpg',

}

2025-10-14T08:00:59.605Z 处理图片 1 URL: cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg

2025-10-14T08:00:59.605Z 下载云存储图片: cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg

2025-10-14T08:01:00.131Z 图片下载成功,大小: 253099 bytes

2025-10-14T08:01:00.243Z 图片 1 mediaCheckAsync API调用失败: ReferenceError: wxContext is not defined

at Function.reviewImages (/var/user/index.js:370:21)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async Function.reviewPostContent (/var/user/index.js:45:29)

at async asyncReviewPost (/var/user/index.js:603:26)

at async exports.main (/var/user/index.js:691:9)

2025-10-14T08:01:00.243Z 图片错误详情: {

image: {

compressed: true,

fileID: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg',

name: 'hc0pudpfio.jpg',

originalSize: 2074229,

size: 2074229,

tempFilePath: 'http://tmp/BmHPnp1aWtntd913cbe0c5b49a18f7c90dc9996dee94.jpg',

url: 'cloud://tong-da-2gwptex949b4db43.746f-tong-da-2gwptex949b4db43-1380747349/posts/1760428839217-0-44v0my966.jpg'

},

code: undefined,

message: undefined

}

2025-10-14T08:01:00.243Z 图片 1 mediaCheckAsync API调用失败,设置为人工审核

2025-10-14T08:01:00.244Z 发帖内容审核失败: TypeError: Cannot read properties of undefined (reading 'passed')

at Function.reviewPostContent (/var/user/index.js:46:26)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async asyncReviewPost (/var/user/index.js:603:26)

at async exports.main (/var/user/index.js:691:9)

2025-10-14T08:01:00.244Z 审核结果: {

passed: false,

reason: '审核服务异常,需要人工审核',

violations: [ '审核服务异常' ],


回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签