diff --git a/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js b/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js index c1f6839d36b7a4c336eaf2f9d9a34fb408ae5f1e..4d55b7948a64c9cbe7dd312b87f69a4a547929d0 100644 --- a/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js +++ b/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js @@ -45,9 +45,8 @@ module.exports = { /* 判断剩余多少积分:拒绝对话、扣除配置的积分数 */ let {data:[{score}]} = await userscollection.doc(this.current_uid).field({'score':1}).get() console.log('score----',score); - // 如果积分数小于等于0 则抛出错误提醒客户端 - // 注意需要判断小于0 因为特殊的情况下可能花超过 - if(score == 0 || score < 0){ + // 如果积分不足 则抛出错误提醒客户端 + if(score < config.spentScore){ throw "insufficientScore" } // 扣除对应的积分值