云开发数据库

云开发提供了一个 JSON 数据库,顾名思义,数据库中的每条记录都是一个 JSON 格局的对象。一个数据库能够有多个汇合(相当于关系型数据中的表),汇合可看做一个 JSON 数组,数组中的每个对象就是一条记录,记录的格局是 JSON 对象。

关系型数据库和 JSON 数据库的概念对应关系如下表:

次要表ER图

校友信息表

UserModel.DB_STRUCTURE = {    _pid: 'string|true',    USER_ID: 'string|true',    USER_NAME: 'string|true|comment=用户姓名',    USER_PIC: 'string|true|comment=用户头像',    USER_PIC_CLOUD_ID: 'string|false|comment=用户头像云存储地址',    USER_PHONE_CHECKED: 'string|true|comment=已校验的手机号码',    USER_MINI_QRCODE: 'object|false|comment=小程序码地址{url,cloudId}',    USER_MINI_OPENID: 'string|true|comment=小程序openid',    USER_MINI_ORI_OPENID: 'string|true|comment=小程序原始openid',    USER_UNIONID: 'string|false|comment=微信开放平台unionid',    USER_WX_OPENID: 'string|false|comment=公众号openid',    USER_IS_SUBSCRIBE: 'int|true|default=0|comment=公众号是否关注 0/1',    USER_SUBSCRIBE_TIME: 'int|true|default=0|comment=公众号关注工夫',    USER_IS_MASK: 'int|true|default=0|comment=是否马甲 0/1',    USER_STATUS: 'int|true|default=1|comment=状态 0=待审核,1=失常,8=VIP(###1-8为失常区间),9=禁用, 10=已删除',    USER_IS_SUPP: 'int|true|default=1|comment=待补充材料 0/1',    USER_INVITE_ID: 'string|false|comment=邀请码',    USER_TYPE: 'int|true|default=0|comment=用户类型 0=求学,1=教职工',    USER_CHECK_PIC: 'array|false|default=[]|comment=审核图片 对象数组[{cloudId,url}]',    USER_SEX: 'int|true|default=1|comment=性别 1=男,2=女',    USER_BIRTH: 'string|true|comment=出生年月',    USER_NATIVE: 'string|false|comment=籍贯',    USER_OPEN_SET: 'int|true|default=1|comment=分割材料公开形式 1=所有用户,8=认证用户和替换名片用户, 3=好友, 9=已替换名片的用户',    USER_WHOLE: 'int|true|default=0|comment=资料完整度',    USER_IS_CARD: 'int|true|default=1|comment=是否承受名片 0/1',    USER_IS_CARD_MSG: 'int|true|default=1|comment=是否承受替换名片音讯揭示 0/1',    USER_MOBILE: 'string|false|comment=联系电话',    USER_WECHAT: 'string|false|comment=微信',    USER_QQ: 'string|false|comment=QQ',    USER_EMAIL: 'string|false',    USER_ITEM: 'string|true|comment=班级',    USER_ENROLL: 'int|true|default=0|comment=退学年份',    USER_GRAD: 'string|true|default=0|comment=毕业年份',    USER_EDU: 'string|true|comment=学历 中学,高职,大专,本科,硕士,博士,博士后,其余',    USER_ITEM2: 'string|false|comment=班级2',    USER_ENROLL2: 'int|false|default=0|comment=退学年份2',    USER_GRAD2: 'string|false|default=0|comment=毕业年份2',    USER_EDU2: 'string|false|comment=学历2 中学,高职,大专,本科,硕士,博士,博士后,其余',    USER_ITEM3: 'string|false|comment=班级3',    USER_ENROLL3: 'int|false|default=0|comment=退学年份3',    USER_GRAD3: 'string|false|default=0|comment=毕业年份3',    USER_EDU3: 'string|false|comment=学历3 中学,高职,大专,本科,硕士,博士,博士后,其余',    USER_COMPANY: 'string|false|comment=以后单位',    USER_COMPANY_DEF: 'string|false|comment=以后单位性质 保留,机关部门,事业单位,国企,世界500强,外企,上市企业,民营企业,自有企业,个体经营,自由职业,其余',    USER_COMPANY_DESC: 'string|false|comment=公司/单位介绍',    USER_COMPANY_DUTY: 'string|false|comment=以后职位',    USER_TRADE: 'string|false|comment=以后行业',    USER_TRADE_EX: 'string|false|comment=以后行业补充阐明',    USER_CITY: 'string|false|comment=以后城市',    USER_WORK_STATUS: 'string|false|comment=工作状态 保留,全职,兼职,学生,待业,退休,老板,自由职业者,家庭主妇,其余',    USER_DESC: 'string|false|comment=自我介绍',    USER_RESOURCE: 'string|false|comment=可提供资源',    USER_NEED: 'string|false|comment=需要',    USER_SUPP: 'string|false|comment=注册补充阐明',    USER_FAV_CNT: 'int|true|default=0|comment=被珍藏人数',    USER_INVITE_CNT: 'int|true|default=0|comment=邀请人数',    USER_VIEW_CNT: 'int|true|default=0|comment=被查看次数',    USER_ALBUM_CNT: 'int|true|default=0|comment=发相册数量',    USER_INFO_CNT: 'int|true|default=0|comment=发互助数量',    USER_MEET_CNT: 'int|true|default=0|comment=发动流动次数',    USER_MEET_JOIN_CNT: 'int|true|default=0|comment=流动报名次数',    USER_MEET_CHECK_IN_CNT: 'int|true|default=0|comment=流动签到次数',    USER_WX_GENDER: 'int|true|default=0|comment=微信性别 0=未定义,1=男,2=女',    USER_WX_AVATAR_URL: 'string|false|comment=微信头像链接',    USER_WX_NICKNAME: 'string|false|comment=微信昵称',    USER_WX_LANGUAGE: 'string|false|comment=微信语言',    USER_WX_CITY: 'string|false|comment=微信城市',    USER_WX_PROVINCE: 'string|false|comment=微信省份',    USER_WX_COUNTRY: 'string|false|comment=微信国家',    USER_WX_UPDATE_TIME: 'int|false|comment=微信信息更新工夫',    USER_ACTIVE: 'array|false|comment=用户动静',    USER_LOGIN_CNT: 'int|true|default=0|comment=登陆次数',    USER_LOGIN_TIME: 'int|false|comment=最近登录工夫',    USER_ADD_TIME: 'int|true',    USER_ADD_IP: 'string|false',    USER_EDIT_TIME: 'int|true',    USER_EDIT_IP: 'string|false',}

后盾操作日志表

LogModel.DB_STRUCTURE = {    _pid: 'string|true',    LOG_ID: 'string|true',    LOG_CONTENT: 'string|true',    LOG_ADMIN_ID: 'string|true|comment=校友材料平台管理员',    LOG_TYPE: 'int|true|comment=日志类型 ',    LOG_ADD_TIME: 'int|true',    LOG_EDIT_TIME: 'int|true',    LOG_ADD_IP: 'string|false',    LOG_EDIT_IP: 'string|false',};

校友名片表

CardModel.DB_STRUCTURE = {    _pid: 'string|true',    CARD_ID: 'string|true',    CARD_MY_ID: 'string|true',    CARD_YOUR_ID: 'string|true|comment=所有者',    CARD_MSG: 'string|false|comment=留言',    CARD_STATUS: 'int|true|default=0|comment=状态 0=期待 1=回绝 9=通过',    CARD_ADD_TIME: 'int|true',    CARD_EDIT_TIME: 'int|true',    CARD_ADD_IP: 'string|false',    CARD_EDIT_IP: 'string|false',};

零碎设置表

SetupModel.DB_STRUCTURE = {    _pid: 'string|true',    SETUP_ID: 'string|true',    SETUP_TITLE: 'string|false|comment=网站名称',    SETUP_ABOUT: 'string|false|comment=对于咱们',    SETUP_SKIN: 'string|true|default=skin1|comment=皮肤',    SETUP_MARK: 'object|false|default={}|comment=校徽 对象{cloudId,url}',    SETUP_LOGO: 'object|false|default={}|comment=网站首页底图 对象{cloudId,url}',    SETUP_LOGO_USER: 'object|false|default={}|comment=网站用户详情底图 对象{cloudId,url}',    SETUP_LOGO_MY: 'object|false|default={}|comment=网站集体核心底图 对象{cloudId,url}',    SETUP_MINI_QRCODE: 'object|false|default={}|comment=学校小程序码 对象{cloudId,url}',    SETUP_AD_PIC: 'array|false|default=[]|comment=海报底图 对象数组[cloud1,cloud2,cloud3]',    SETUP_REG_CHECK: 'int|true|default=0|comment=注册是否审核 0/1',    SETUP_REG_CHECK_DESC: 'string|false|comment=注册审核阐明',    SETUP_REG_CHECK_PIC: 'int|true|default=0|comment=注册是否审核 0/1',    SETUP_REG_CHECK_PIC_DESC: 'string|false|comment=注册审核阐明',    SETUP_ALBUM_CHECK: 'int|true|default=0|comment=相册是否审核 0/1',    SETUP_MEET_CHECK: 'int|true|default=0|comment=流动是否审核 0/1',    SETUP_INFO_CHECK: 'int|true|default=0|comment=互助是否审核 0/1',    SETUP_ALBUM_COMMENT: 'int|true|default=1|comment=相册是否容许评论 0/1',    SETUP_MEET_COMMENT: 'int|true|default=1|comment=流动是否容许评论 0/1',    SETUP_INFO_COMMENT: 'int|true|default=1|comment=互助是否容许评论 0/1',    SETUP_NEWS_COMMENT: 'int|true|default=1|comment=资讯是否容许评论 0/1',    SETUP_REG_WORK: 'int|true|default=0|comment=注册是否容许教职工 0/1',    SETUP_ADD_TIME: 'int|true',    SETUP_EDIT_TIME: 'int|true',    SETUP_ADD_IP: 'string|false',    SETUP_EDIT_IP: 'string|false',};

我的项目代码GIT: https://github.com/ccliqi/CC-...