怎么一直在添加记录,帮我看看
发布于 5 年前 作者 juanwei 11066 次浏览 来自 问答

 

    db.collection(‘yhxx’).where({

      _openid: that.data.openid

    }).count({

      success: function (res) {

        that.setData({

          yhs: res.total

        })

      }

    })

    var jls = that.data.yhs;

    if (jls > 0) {

      db.collection(‘yhxx’)

        .where({

          _openid: that.data.openid

        })

        .get({

          success: function (res) {

            that.setData({

              showview: res.data[0].rz

            })

          }

        });

    }

    else {

      db.collection(‘yhxx’).add({

        data: {

          xm: that.data.srxm,

          rz: false

        },

        success: function (res) {

          that.setData({

            showview: false

          })

        }

      });

    }

1 回复

明明jls>0了,怎么还在一直添加

回到顶部