收藏
回答

怎么一直在添加记录,帮我看看

 


    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 个回答

  • 璀灿
    璀灿
    2018-10-24

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

    2018-10-24
    有用
    回复
登录 后发表内容