将 Web 服务数据消费到数据库中?
我创建了一个网站,其中包含我们公司商店的 store
表。 store
表数据将根据通过 Web 服务接收的数据进行填充。它将必须添加新商店,将已关闭的商店标记为关闭,并将已重新开业的商店标记为营业。
如何使用 Web 服务填充此表?
1)是否有一些(cron)脚本可以使用Web服务并将数据与stores表同步?
2)将其内置到应用程序本身中?那么在应用程序启动时,它会同步数据吗?然后也许会以某种方式修改我的模型,以便在每 10 分钟查找一次后同步数据(不太确定这将如何工作)?
3)还有其他想法吗?
I have created a website that has a store
table of our company stores. The store
table data will be populated from data it receives via web service. It will have to add new stores, mark stores closed that have been closed, and mark stores as open that have been reopened.
How do I populate this table with the web service?
1) Have some (cron) script that consumes the web service and syncs the data with the stores table?
2) Build this in to the app itself? So that on app start, it syncs the data? Then maybe somehow modify my model to sync data after every 10 minutes of a find (not really sure how this would work)?
3) Any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会选择做一个 cron 工作。这将使数据总体与使用该数据的应用程序分开。此外,这意味着即使您的应用程序离线,您也可以保持数据最新。最后,这些数据也可能被不同的应用程序使用吗?如果是这种情况,将数据总体与使用该数据的应用程序之一联系起来就没有多大意义。
I would go with having a cron job. That would keep the population of the data separate from your application that uses the data. Also, it would mean you can keep your data up to date, even if your application goes offline. Finally, the data could potentially be used by a different application as well? If this is the case, it wouldn't make much sense to tie the population of the data to one of the applications that uses the data.
为什么需要数据库?根据您正在执行的操作,直接与 Web 服务对话可能更实用。
Why do you need a database? Depending on what you're doing, it may be more practical to just talk to the Web service directly.