如何实现实时业务数据查询? |
目前软件支持2种形式(函数和URL接口)直连实时业务系统进行获取数据,并让微信前端业务查询。
1.函数模式
dbo.函数名//注意:必须表值函数,如非可过渡一下,字段名 content
函数示例: {标题}dbo.getdata_shop(2)数据来源:店铺实时直播
数据库函数代码示例: Create FUNCTION [dbo].[getdata_shop](@uniqid int) RETURNS TABLE AS RETURN ( select top 1 '销售金额:¥'+value+'元'+char(13)+char(10)+'更新时间:'+convert(varchar(5),createtime,110)+' '+convert(varchar(8),createtime,114) as content from wx_extand_data(nolock) where uniqid=@uniqid );
2.URL接口模式
url地址//Json 必须是Content 字段名
URL接口示例: http://xxx.xxx.xxx.xxx/tp/?s=/Home/index/order&format=text&req_type=dp&req_params=total