基于账户/密码去sync数据库

def sync(self):
        """基于账户/密码去sync数据库
        """
        if self.wechat_id is not None:

            res = self.client.find_one({'wechat_id': self.wechat_id})
        else:
            res = self.client.find_one(
                {
                    'username': self.username,
                    'password': self.password
                }
            )
        if res is None:

            if self.client.find_one({'username': self.username}) is None:
                self.client.insert_one(self.message)
                return self
            else:
                raise RuntimeError('账户名已存在且账户密码不匹配')

        else:
            self.reload(res)

            return self