index.obj.js 907 字节
Newer Older
雪洛's avatar
雪洛 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
module.exports = {
  async add(title, content) {
    console.log(title, content)
    return {
      showMessage: `Todo added, title: ${title}, content: ${content}`
    }
  },
  async randomFail() {
    const random = Math.random()
    console.log(random);
    if (random > 0.5) {
      return {
        errCode: 'RANDOM_FAIL',
        errMsg: 'todo.randomFail failed'
      }
    } else {
      return {
        errCode: 0,
        errMsg: '',
        showMessage: 'todo.randomFail successed'
      }
    }
  },
  async fail() {
    return {
      errCode: 'TEST_ERROR_CODE',
      errMsg: 'todo.fail failed',
    }
  },
  async success() {
    return {
      errCode: 0,
      errMsg: '',
      showMessage: 'todo.success successed'
    }
  }
}