首页
样例
文档
论坛
需求
联系
APIBase
APIBase介绍
让Android开发,IOS开发摆脱购买云服务器的烦恼,让更多的客户使用优质、高性能、高带宽的API服务资源。
什么是APIBase
APIBase(Application Programming Interface Base,应用程序编程接口基地),目的是提供应用程序接口服务帮开发人员基于某些软件或功能得以快速实现。
APIBase优点
APIBase使用集群服务器部署方案,数据库(文字、文本)服务器100MB带宽及以上,文件服务器(图片、视频)1G带宽及以上,各服务器独立机器独立联网高带宽,防止数据出现高延时。
如何使用APIBase
浏览器访问https://apibase.cn/,用手机号在APIBase中注册,创建应用程序后,需缴费启用应用,就能使用免费API接口服务。
APIBase安全性
应用程序编程接口使用appid(应用程序编号14位)、appkey(应用程序密钥32位)进行安全认证使用。
APIBase提供哪些服务
1、云数据库服务Cloud database Service【多库】
云数据库支持远程连接,使用SSD固态硬盘储存,保证数据高性能调用。
2、云数据库接口服务Cloud database interface Service【多站+集群】
数据库接口2.0,支持快速开发、多样式使用、高性能调用。访问域名https://www.dbihelper.cn。
3、HTTP云文件接口服务Cloud File Interface Service【多站】
云文件服务器使用1G带宽,文件流量免费使用。访问域名https://www.filehelper.cn。
4、即时聊天接口服务WebSocket Interface Service【多站】
WebSocket即时聊天支持javascript直接连接使用、即时群发,聊天日志查询。访问域名https://www.chathelper.cn
5、短信验证码接口服务Short Message Interface Service【多站+集群】
短信验证码代发,避免了短信签名、短信模板审核,验证码发送用时非常短。访问域名https://www.dbihelper.cn
APIBase法律法规
根据《中华人民共和国计算机信息系统安全保护条例》、《计算机信息网络国际联网安全保护管理办法》、《互联网安全保护技术措施规定》、《互联网交互式服务安全保护要求》、《互联网服务安全评估基本程序及要求》(超链)等相关法律法规以及安全管理标准规范,使用者必须履行违法信息过滤、公共信息巡查、用户资质查验、日志信息留存和应急快速处置等安全保护义务,落实安全管理责任和相关安全保护技术措施;
强制处理
根据以上相关法律法规、对违规使用者进行强制关闭接口服务,并打包相关数据移送网络公安处理。
APIBase使用规范
所用接口统一使用HTTP协议调用,并且使用appid、appkey密钥认证,统一保存接口调用日志记录。
资源规范
appid是14位字符串,由yyMMdd+8位随机数组成。查看appid源码
appkey是32位字符串,由32位随机数组成。查看随机数源码
数据库名,由cloud+mysql+6位随机数组成。
数据库用户名,由cloud+user+6位随机数组成。
调用频次规范
同类型接口调用,根据IP来限制,3秒内调用10次。
获取全部服务地址
为了方便用户更换APIBase资源服务,特意提供服务地址列表
访问https://apibase.cn/service/http/“appid”.htm
如:https://apibase.cn/service/http/20192d878yebvt.htm
获取JSON内容如:
{"httpdbi":"https://www.dbihelper.cn/",
"httpchat":"https://www.chathelper.cn/",
"httpfile":"https://www.filehelper.cn/"}
云数据库
云数据库介绍
数据库部署到云集群服务器中,可以实现按需付费使用、按需扩展存储和性能等优势。
云数据库免费开通
用手机号登录https://apibase.cn/,首先创建并开通应用程序后,在任何接口详情页点击【开通】, 选择免费型云mysql,远程连接选择“开放用户远程连接数据库”,点击【免费开通】,可免费使用100MB云数据库,2年时间有效,后续可以续费。
数据库接口
数据库接口介绍
数据库接口2.0,支持快速开发、多样性使用、高速高性能调用。
数据库接口免费开通
用手机号登录https://apibase.cn/,首先创建并开通应用程序后,在数据库接口接口详情页点击【开通】, 选择免费型数据库接口,接口日志选择“开启”,点击【免费开通】,接口可免费调用100000次,2年时间有效,后续可以续费。。
数据库接口快速开发
用手机号登录https://apibase.cn/,首先创建并开通应用程序后,在数据库接口详情页开通接口, 点击【接口开发】,在接口列表页面点击【新增】,在接口编号中输入英文编号,接口名称中输入好记名称,在文本框输入SQL语句,点击【接口保存】,一个接口在几秒内开发成功。
接口地址 https://www.dbihelper.cn/linkdb 开通
https://dbihelper.cn/linkdb 未配置
https://dbihelp.cn/linkdb 官用
https://dbihelp.cn/linkdb 未配置
...
测试地址: https://www.dbihelper.cn/test/dbi.jsp
https://dbihelper.cn/test/dbi.jsp
样例 数据查询接口sqlid为demoselect
接口中SQL语句:select * from mysql.demo_log where logfont like ?'[logfont]' and createuser=?'[createuser]' and createip=?'[createip]' order by [orderby]
接口调用参考JS下载测试样例
function demoselectpager(pagnum){
  var url="https://www.dbihelper.cn/linkdb?"+Math.random();
  var where={appid:appid,appkey:appkey,sqlid:"demoselect",orderby:"createtime desc",
  logfont:valget("logfont"),pagnum:pagnum,pagsize:"10"};
  jquery.ajax({url:url,method:"post",data:{values:where}},
  function(res,err){
    if("y"==res.ok){
      var list=res.demoselectlist;
      var html="<table cellpadding="0" cellspacing="1" border="0" class="demo_tablist">";
      html+="<tr><th>logid</th><th>logfont</th><th>createtime</th><th>updatetime</th></tr>";
      for(var a=0;a<list.length;a++){
         html+="<tr><td>"+list[a].logid+"</td><td>"+list[a].logfont+"</td>";
         html+="<td>"+list[a].createtime+"</td><td>"+list[a].updatetime+"</td></tr>";
      }
      if(list.length==0){
         html+="<tr><td colspan="6"><center>未查询到相关数据</center></td></tr>";}
      html+="</table>";
      document.getElementById("listhtml").innerHTML=html;
   }else{tishimsg(res.msg);}
   });
}
接口名称用户密码登录
接口的SQLselect * from mysql.user_info where mobile='[mobile]' and loginpwd='[loginpwd]';
测试参数{"mobile":"13272087162","loginpwd":"apibase123","pagnum":"1","pagsize":"1"}
运行结果 {"ok":"y","msg":"","pwduserloginok":"y","pwduserloginmsg":"","msg":"","pwduserloginrow":1,
"sys.sessionid":"E08FF946348404564F3F299DFA9C8D0C","sys.userid":"生效,通过sys.sessionid自动获取",
"rows":[1],"sqlerr":[],"usems":2,"dbilogerr":"",
"pwduserloginlist":[{"userid":"pj0o396m0s4b66bz","usname":"李婷基","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"上海市","logintime":"2018-12-23 14:17:23.0"}],
"listsql":["select * from cloud7mysql.user_info where 1=1 and mobile='13272087162' and loginpwd='apibase123' limit 0,1"]}
接口编号sqlid为userpwdlogin
参数注解ok,*ok,msg,*msg,*row,*list,rows,usems,sqlerr,listsql,dbilogerr,sessionid
ok如:"ok":"y",y:是所有SQL运行正确,n:是所有SQL云有错误,注意运行多个SQL有一个失败是n。。
sqlid+ok如:"userpwdloginok":"y",y/n(成功/失败),注意运行多个SQL有一个失败是n。
msg如:"msg","SQL运行错误,...",所有SQL运行正确无内容,当"ok":"n"是第一个SQL运行错误内容。
sqlid+msgSQL运行错误提示内容
sqlid+row接口查询数据行数,注意:如果接口内有多个SQL查询只保留最后一个。
sqlid+list每个接口内最后一个SQL语句查询结果集。
rows接口内每个SQL运行查询、修改、删除、插入的行数记录。
usems接口运行毫秒时长
sqlerr接口内每个SQL运行错误内容记录。
listsql接口内每个SQL语句。注意:接口测试,接口日志才有。
dbilogerr接口运行日志入库失败提示内容。
sys.sessionid系统参数,sqlid以login结尾,查获一行数据时,系统发放sys.sessionid(40位秘钥)关联userid值(查获一行数据userid列),让SQL语句中的sys.userid生效。注意sys.sessionid有效3天,每次使用会刷新时效(3天未使用会失效)。javascript使用json["sys.sessionid"]取出。
数据库接口使用规范
调用地址https://www.dbihelper.cn/linkdb,https://dbihelper.cn/linkdb,https://dbihelper.cn/linkdb
调用方式接口使用HTTP访问,HTTP是一个客户端和服务器端请求和应答的标准(TCP)
接口必带参数sqlid:接口编号
接口分页参数pagnum:分页页码(第几页),pagsize:分页行数(条数)
SQL行数控制sqllid.rows=行数:让接口内的insert、delete、update语句多条运行。用途:接口内的SQL语句“[参数名]”自动支持“[参数名.行数序号]”,序号从1开始。如参数名:[userid.1]
相关限制数据库接口有调用次数和时间限制,调用次数按照请求次数统计。一个接口的SQL语句可包含多个inset、update、delete语句,限最后一个select有效。
数据库接口语言规范
sys.date系统字符串参数,输入无效,当前日期。如:2021-10-18
sys.time系统字符串参数,输入无效,当前时间。如:2021-10-18 18:53:48.426
sys.ip系统字符串参数,输入无效,当前操作用户IP
sys.id系统字符串参数,输入无效,11至12位组成,终身不重复。
支持sys.id.序号。如:kuwji4ui10 查看sys.id源码
sys.userid系统字符串参数,输入无效,请求参数加sys.sessionid获取userid(sqlid以login结尾,查获一行数据userid列),让用户操作更安全。
sys.sessionid系统字符串参数,输入有效,系统发放40位访问秘钥。用途:通过此参数获得sys.userid值,让多次请求userid(用户)数据同步。
sqlid系统规定调用接口参数名。数据库接口编号。
如:sysuserlogin
*login系统规定特殊接口名称。用途:sqlid以login结尾,利用SQL查询数据库获取一条数据,取出列名是userid和值,关联sys.sessionid存入内存,让sys.userid生效。
*where系统规定特殊接口名称。用途:sqlid以where结尾,利用SQL查询数据库获取第一行数据,取出所有列名和值,列名前添加sql.存入到参数中。如:sql.mobile=13272087162,从数据库中获取。
sql.*系统规定用参数名,输入无效。
*payback系统规定特殊接口名称。用途:sqlid以payback结尾用于支付回调数据库接口
where.*系统规定用参数名。支付回调数据库接口人工追加的参数。
pagnum系统规定接口使用参数名,分页页码(第几页)。用途:让接口查询语句支持分页。
pagsize系统规定接口使用参数名,查询分页条数(行数),导入数据条数。用途:查询语句支持分页,插入语句导入条数。
.rows系统规定接口使用参数名,参数行数。用途:让接口内的SQL语句支持多条同时运行。
如:sqlid.rows=6
mysql.系统规定接口SQL语法,数据库名,让接口内的SQL语句,表名称前必带库名。
如:select * from mysql.user_info
limit系统规定接口SQL语法,限制条数,让接口内的SQL语句分页查询或取数条数,内容不能包含limit。
方括号“[]”系统规定接口SQL语法,用途:包裹参数名。
如:[参数名]
问号“?”系统规定接口SQL语法,用途:SQL语句中where条件判断,参数名有值时条件有用。
如:select * from mysql.user_info where 5=5 and userid =? '[userid]'
分号“;”系统规定接口SQL语法,用途:一个接口内的SQL语句支持多条SQL语句分隔符号。
如:update mysql.user_info set age='[age]' where 5=5 and userid =? '[userid]' ;select * from mysql.user_info where 5=5 and userid =? '[userid]'
分号“;”系统规定接口调用语法,用途:多个接口编号串行运行分隔符。
如:update mysql.user_info set age='[age]' where 5=5 and userid =? '[userid]' ;select * from mysql.user_info where 5=5 and userid =? '[userid]'
双减号“--”接口调用参数值,双减号被屏蔽。
数据库接口开发select语句
接口
系统表
create table if not exists mysql.sys_dbi_sql(
ifid varchar(30) NOT NULL comment '主键',
appid varchar(30) not null comment '应用编号',
userid int null comment '所属用户' ,
sqlid varchar(255) null comment '接口编号',
sqlname varchar(255) null comment '接口名称' ,
sqltxt varchar(9999) null comment '接口的SQL',
createtime datetime null comment '创建时间',
primary key(ifid)
)engine=myisam default charset=gbk ;
接口
日志
系统表
create table if not exists mysql.sys_dbi_log(
logid bigint(20) AUTO_INCREMENT NOT NULL,
appid varchar(30) not null comment '应用编号',
input text null comment '输入参数',
output text null comment '输出参数' ,
sqlstr text null comment 'SQL语句',
sqlerr text null comment '执行财务内容',
createtime datetime comment '执行结束时间',
usems int null comment '执行用时MS',
ip varchar(30) not null comment '使用者IP',
primary key(logid)
) engine=myisam default charset=gbk;
用户
测试表
create table mysql.user_info(
userid varchar(30) not null,
usname varchar(255) null comment '用户名',
mobile varchar(255) null comment '手机号',
loginpwd varchar(255) null comment '登录密码' ,
age int null comment '年龄',
address varchar(255) null comment '所在城市' ,
logintime datetime null comment '登录时间',
primary key(userid)
)engine=myisam default charset=gbk;
用户
登录
日志
测试表
create table mysql.user_login_log(
logid bigint auto_increment not null,
userid varchar(30) not null,
ip varchar(255) null comment '用户名',
logintime datetime null comment '登录时间',
primary key(logid)
)engine=myisam default charset=gbk;
单表Aselect * from mysql.user_info where usname like '%[usname]%' order by [orderby]
参数1{"sqlid":"userlist","usname":"婷","orderby":"usname desc","pagnum":"1","pagsize":"20"}
得SQL1select * from cloud7mysql.user_info where 1=1 and usname like '%婷%' order by usname desc limit 0,20
注解1必带条件usname
结果1 {"ok":"y","msg":"","userlistok":"y","userlistmsg":"","userlistrow":2, "rows":[2],"sqlerr":[],"usems":2,"dbilogerr":"",
"userlistlist":[{"userid":"pj0o396m0s4bfgdr","usname":"张婷蓉","mobile":"18822557162","loginpwd":"apibase567","age":"30","address":"上海市","logintime":"2018-12-25 11:09:09.0"},{"userid":"pj0o396m0s4b66bz","usname":"李婷基","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"上海市","logintime":"2018-12-24 11:23:44.0"}],
"listsql":["select * from cloud7mysql.user_info where 1=1 and usname like '%婷%' order by usname desc limit 0,20"]}
参数2{"sqlid":"userlist","orderby":"usname desc","pagnum":"1","pagsize":"20"}
得SQL2select * from cloud7mysql.user_info where 1=1 and usname like '%usname%' order by usname desc limit 0,20
注解2必带条件usname
结果2 {"ok":"y","msg":"","userlistok":"y","userlistmsg":"","userlistrow":0,"rows":[0],"sqlerr":[],"usems":0,"dbilogerr":"",
"userlistlist":[],"
listsql":["select * from cloud7mysql.user_info where 1=1 and usname like '%usname%' order by usname desc limit 0,20"]}
单表Bselect * from mysql.user_info where mobile like '[mobile]%' and age=?'[age]' order by [orderby]
参数1{"sqlid":"userlist","mobile":"1","age":"30","orderby":"usname desc","pagnum":"1","pagsize":"20"}
得SQL1select * from cloud7mysql.user_info where 1=1 and mobile like '1%' and age='30' order by usname desc limit 0,20
注解1必带条件mobile,条件age判断有值带,空值不带
结果1 {"ok":"y","msg":"","userlistok":"y","userlistmsg":"","userlistrow":1,"rows":[1],"sqlerr":[],"usems":0,"dbilogerr":"",
"userlistlist":[{"userid":"pj0o396m0s4bfgdr","usname":"张婷蓉","mobile":"18822557162","loginpwd":"apibase567","age":"30","address":"上海市","logintime":"2018-12-25 11:09:09.0"}],
"listsql":["select * from cloud7mysql.user_info where 1=1 and mobile like '1%' and age='30' order by usname desc limit 0,20"]}
参数2{"sqlid":"userlist","mobile":"1","orderby":"usname desc","pagnum":"1","pagsize":"20"}
得SQL2select * from cloud7mysql.user_info where 1=1 and mobile like '1%' order by usname desc limit 0,20
注解2必带条件mobile,条件age判断有值带,空值不带
结果2 {"ok":"y","msg":"","userlistok":"y","userlistmsg":"","userlistrow":2,"rows":[2],"sqlerr":[],"usems":1,"dbilogerr":"",
"userlistlist":[{"userid":"pj0o396m0s4bfgdr","usname":"张婷蓉","mobile":"18822557162","loginpwd":"apibase567","age":"30","address":"上海市","logintime":"2018-12-25 11:09:09.0"},{"userid":"pj0o396m0s4b66bz","usname":"李婷基","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"上海市","logintime":"2018-12-24 11:23:44.0"}],
"listsql":["select * from cloud7mysql.user_info where 1=1 and mobile like '1%' order by usname desc limit 0,20"]}
认证Cselect address from mysql.user_info where mobile='[mobile]' and loginpwd='[loginpwd]';
参数1{"sqlid":"myuserlogin","mobile":"13272087162","loginpwd":"apibase123","pagnum":"1","pagsize":"20"}
得SQL1
注解1sqlid以userlogin结尾,让系统参数sys.userid生效,让用户操作更安全。
结果1
认证Cselect * from mysql.user_info where userid='[sys.userid]' ;
参数1{"sqlid":"userinfo","sys.sessionid":"","pagnum":"1","pagsize":"20"}
得SQL1
注解1用sys.sessionid获取用户登录信息sys.userid
结果1
多表Dselect * from mysql.user_info where 1=1 and usname like? '%usname%' and mobile? in (select mobile from mysql.sys_sms_log where mobile like '[mobile]%') order by [orderby]
参数1{"sqlid":"userlist","orderby":"usname desc","pagnum":"1","pagsize":"20"}
得SQL1select * from cloud7mysql.user_info where 1=1 and usname like '%usname%' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%') order by usname desc limit 0,20
注解1注意:where条件后的问号都无效
结果1 {"ok":"y","msg":"","userlist1ok":"y","userlist1msg":"","userlist1row":0,"rows":[0],"sqlerr":[],"usems":0,"dbilogerr":"",
"userlist1list":[],"listsql":["select * from cloud7mysql.user_info where 1=1 and usname like '%usname%' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%') order by usname desc limit 0,20"]}
数据库接口开发update语句
单表Aupdate mysql.user_info set usname='[usname]',age=?'[age]',address=?'[address]' where userid='[userid]' and mobile like?'[mobile]%'
参数1{"sqlid":"userupdate","usname":"匿名","age":"22","userid":"uid"}
得SQL1update cloud7mysql.user_info set usname='匿名',age='22' where 1=1 and userid='uid'
注解1必修改usname,修改age、address判断有值改,空值不改。
必带条件userid,条件mobile判断有值带,空值不带
结果1 {"ok":"y","msg":"","userupdateok":"y","userupdatemsg":"","userupdateupdate":0,"rows":[0],"sqlerr":[],"usems":0,"dbilogerr":"","userupdatelist":[],
"listsql":["update cloud7mysql.user_info set usname='匿名',age='22' where 1=1 and userid='uid' "]}
参数2{"sqlid":"userupdate","userid":"uid"}
得SQL2update cloud7mysql.user_info set usname='usname' where 1=1 and userid='uid'
结果2 {"ok":"y","msg":"","userupdateok":"y","userupdatemsg":"","userupdateupdate":0,"rows":[0],"sqlerr":[],"usems":0,"dbilogerr":"","userupdatelist":[],
"listsql":["update cloud7mysql.user_info set usname='usname' where 1=1 and userid='uid' "]}
注解2必修改usname,修改age、address判断有值改,空值不改。
必带条件userid,条件mobile判断有值带,空值不带
多表Bupdate mysql.user_info set usname='[usname]',age=?'[age]',address=?'[address]' where userid='[userid]' and mobile in? (select mobile from mysql.sys_sms_log where mobile like '[mobile]%')
参数1{"sqlid":"userupdate","usname":"匿名","age":"22","userid":"uid"}
得SQL1update cloud7mysql.user_info set usname='匿名',age='22' where userid='uid' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%')
结果1 {"ok":"y","msg":"","userupdateok":"y","userupdatemsg":"","userupdateupdate":0,"rows":[0],"sqlerr":[],"usems":1,"dbilogerr":"","userupdatelist":[],
"listsql":["update cloud7mysql.user_info set usname='匿名',age='22' where userid='uid' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%')"]}
注解1注意:where条件后的问号都无效
数据库接口开发delete语句
单表Adelete from mysql.user_info where age='[age]' and address =? '[address]'
参数1{"sqlid":"userdelete","age":"22","address":"上海1"}
得SQL1delete from cloud7mysql.user_info where 1=1 and age='22' and address = '上海1'
结果1 {"ok":"y","msg":"","userdeleteok":"y","userdeletemsg":"","userdeleteupdate":0,"rows":[0],"sqlerr":[],"usems":4,"dbilogerr":"","userdeletelist":[],
"listsql":["delete from cloud7mysql.user_info where 1=1 and age='22' and address = '上海1'"]}
注解1必带条件age,条件address判断有值带,空值不带
参数2{"sqlid":"userdelete"}
得SQL2delete from cloud7mysql.user_info where 1=1 and age='age'
结果2 {"ok":"y","msg":"","userdeleteok":"y","userdeletemsg":"","userdeleteupdate":0,"rows":[0],"sqlerr":[],"usems":1,"dbilogerr":"","userdeletelist":[],
"listsql":["delete from cloud7mysql.user_info where 1=1 and age='age' "]}
注解2必带条件age,条件address判断有值带,空值不带
多表Bdelete from mysql.user_info where age=?'[age]' and userid in? (select userid from mysql.user_info where age='[age]' and address =? '[address]')
参数1{"sqlid":"userdelete"}
得SQL1delete from cloud7mysql.user_info where age='age' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%')
结果1 {"ok":"y","msg":"","userdeleteok":"y","userdeletemsg":"","userdeleteupdate":0,"rows":[0],"sqlerr":[],"usems":2,"dbilogerr":"","userdeletelist":[],
"listsql":["delete from cloud7mysql.user_info where age='age' and mobile in (select mobile from cloud7mysql.sys_sms_log where mobile like 'mobile%')"]}
注解1注意:where条件后的问号都无效
数据库接口开发insert语句
单表Ainsert into mysql.user_info(userid,usname,mobile,age,address,logintime)values
('[userid]','[usname]','[mobile]','[age]','[address]','[sys.time]')
参数1{"sqlid":"userinsert","userid":"sys.id","usname":"李琪","address":"长沙市","mobile":"13272087162","age":"22"}
得SQL1insert into cloud7mysql.user_info(userid,usname,mobile,age,address,logintime)values
('sys.id','李琪','13272087162','22','长沙市','2018-12-25 14:18:58.196')
结果1 {"ok":"y","msg":"","userinsertok":"y","userinsertmsg":"","userinsertupdate":1,"rows":[1],"sqlerr":[],"usems":2,"dbilogerr":"","userinsertlist":[],
"listsql":["insert into cloud7mysql.user_info(userid,usname,mobile,age,address,logintime)values ('sys.id','李琪','13272087162','22','长沙市','2018-12-25 14:18:58.196')"]}
注解1必插入userid,usname,mobile,age,address所有列
多表B insert into mysql.user_info(userid,usname,mobile,age,address)
select userid,usname,mobile,age,address from mysql.user_info where userid='[userid]' and mobile=?'[mobile]'
参数1{"sqlid":"userinsert","userid":"uid"}
得SQL1insert into cloud7mysql.user_info(userid,usname,mobile,age,address)
select userid,usname,mobile,age,address from cloud7mysql.user_info where userid='uid' and mobile='mobile' limit 0,1
结果1 {"ok":"y","msg":"","userinsertok":"y","userinsertmsg":"","userinsertupdate":0,"rows":[0],"sqlerr":[],"usems":1,"dbilogerr":"","userinsertlist":[],
"listsql":["insert into cloud7mysql.user_info(userid,usname,mobile,age,address) select userid,usname,mobile,age,address from cloud7mysql.user_info where userid='uid' and mobile='mobile' limit 0,1"]}
参数2{"sqlid":"userinsert","userid":"uid","pagsize":"12"}
得SQL2insert into cloud7mysql.user_info(userid,usname,mobile,age,address)
select userid,usname,mobile,age,address from cloud7mysql.user_info where userid='uid' and mobile='mobile' limit 0,12
结果2 {"ok":"y","msg":"","userinsertok":"y","userinsertmsg":"","userinsertupdate":0,"rows":[0],"sqlerr":[],"usems":1,"dbilogerr":"","userinsertlist":[],
"listsql":["insert into cloud7mysql.user_info(userid,usname,mobile,age,address) select userid,usname,mobile,age,address from cloud7mysql.user_info where userid='uid' and mobile='mobile' limit 0,12"]}
注解1必插入userid,usname,mobile,age,address所有列,注意:where条件后的问号无效
数据库接口开发高级用法
功能1sqlid.rows=条数,让一个接口的insert、delete、update语句多条运行,select语句只有一条执行
SQL1 insert into mysql.user_info(userid,usname,mobile,age,address,logintime)values
('[sys.id]','[usname]','[mobile]','[age]','[address]','[sys.time]');
select * from mysql.user_info where address like '%[address]%' order by [orderby]
参数1 {"sqlid":"userinsert","userinsert.rows":"3","orderby":"age",
"userid.1":"sys.id","usname.1":"李南","address.1":"长沙南","mobile.1":"13272087161","age.1":"21",
"userid.2":"sys.id","usname.2":"李北","address.2":"长沙北","mobile.2":"13272087162","age.2":"22",
"userid":"sys.id","usname":"李琪","address":"长沙","mobile.3":"13272087163","age.3":"23"}
结果1 {"ok":"y","msg":"","userinsertok":"y","userinsertmsg":"","userinsertupdate":3,"userinsertrow":3,"rows":[3,3],"sqlerr":[],"usems":3,"dbilogerr":"","userinsertlist":[
{"userid":"pj3rljdinpslj5my","usname":"李南","mobile":"13272087161","loginpwd":"","age":"21","address":"长沙南","logintime":"2018-12-25 14:40:32.0"},
{"userid":"pj3rljdi1u08r5id","usname":"李北","mobile":"13272087162","loginpwd":"","age":"22","address":"长沙北","logintime":"2018-12-25 14:40:32.0"},
{"userid":"pj3rljdi24rds7lv","usname":"李琪","mobile":"13272087163","loginpwd":"","age":"23","address":"长沙","logintime":"2018-12-25 14:40:32.0"}],
"listsql":["insert into cloud7mysql.user_info(userid,usname,mobile,age,address,logintime)values ('pj3rljdinpslj5my','李南','13272087161','21','长沙南','2018-12-25 14:40:32.968')",
"select * from cloud7mysql.user_info where 1=1 and address like '%长沙%' order by age limit 0,1"]}
注解1sqlid.rows:序号从1开始,参数名+.第几条序号。
功能2一个接口内的多条SQL语句执行,用户短信注册,用户密码登录,用户短信登录,修改短信失效,记录登录日志,修改登录时间
SQL2 insert into mysql.user_info(userid,usname,mobile,loginpwd,age,address)
select * from (select '[sys.id]','[usname]','[mobile]','[loginpwd]','[age]','[address]' ) tab
where 0=(select count(1) from mysql.user_info where mobile='[mobile]' )
and 1=(select count(1) from mysql.sys_sms_log
where smstype='register' and mobile='[mobile]' and smscode='[smscode]' and flag='y');
select * from mysql.user_info where mobile='[mobile]' and loginpwd='[loginpwd]';
select * from mysql.user_info where mobile in (select mobile from mysql.sys_sms_log where type='login' and mobile='[mobile]' and smscode='[smscode]' and flag='y');
update mysql.sys_sms_log set flag='n'
where smstype='login' and mobile='[mobile]' and smscode='[smscode]';
insert into mysql.user_login_log(userid,ip,logintime)
select userid,'[sys.id]','[sys.time]' from mysql.user_info where mobile='[mobile]' ;
update mysql.user_info set logintime='[sys.time]' where mobile='[mobile]' ;
参数2 {"sqlid":"sysuserlogin","smscode":"668878","usname":"李学友","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"长沙市"}
结果2 {"ok":"y","msg":"","sysuserloginok":"y","sysuserloginmsg":"","sysuserloginupdate":1,"sysuserloginrow":1,
"sys.sessionid":"EB04EDD8AB21F653AC03A94C4BAE665F","sys.userid":"生效,通过sys.sessionid自动获取",
"rows":[1,1,1,1,1,1],"sqlerr":[],"usems":22,"dbilogerr":"",
"sysuserloginlist":[{"userid":"pj3twb17nw1kmykp","usname":"李学友","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"长沙市","logintime":""}],
"listsql":["insert into cloud7mysql.user_info(userid,usname,mobile,loginpwd,age,address) select * from (select 'pj3twb17nw1kmykp','李学友','13272087162','apibase123','22','长沙市' ) tab where 0=(select count(1) from cloud7mysql.user_info where mobile='13272087162' ) and 1=(select count(1) from cloud7mysql.sys_sms_log where type='login' and mobile='13272087162' and smscode='668878' and flag='y') limit 0,1",
"select * from cloud7mysql.user_info where 1=1 and mobile='13272087162' and loginpwd='apibase123' limit 0,1",
"select * from cloud7mysql.user_info where mobile in (select mobile from cloud7mysql.sys_sms_log where type='login' and mobile='13272087162' and smscode='668878' and flag='y') limit 0,1",
"update cloud7mysql.sys_sms_log set flag='n' where 1=1 and type='login' and mobile='13272087162' and smscode='668878'",
"insert into cloud7mysql.user_login_log(userid,ip,logintime) select userid,'pj3twb174z5xsbq2','2018-12-25 14:55:27.738' from cloud7mysql.user_info where mobile='13272087162' limit 0,1",
"update cloud7mysql.user_info set logintime='2018-12-25 14:55:27.738' where 1=1 and mobile='13272087162' "]}
数据库接口开发多个串联运行

功能用户短信注册,用户密码登录,用户短信登录,修改短信失效,记录登录日志,修改登录时间
第一个接口sqlid:pwduserlogin
SQL语句:select * from mysql.user_info where mobile='[mobile]' and loginpwd='[loginpwd]';
第二个接口sqlid:userlike
SQL语句:select * from mysql.user_info where usname like '%[usname]%'
串联参数{"sqlid":"pwduserlogin;userlike","mobile":"13272087162","loginpwd":"apibase123","usname":"婷","pagnum":"1","pagsize":"1"}
结果 {"ok":"y","msg":"","pwduserloginok":"y","pwduserloginmsg":"","pwduserloginrow":1,"sys.sessionid":"E08FF946348404564F3F299DFA9C8D0C","sys.userid":"生效,通过sys.sessionid自动获取","userlikeok":"y","userlikemsg":"","userlikerow":1,"rows":[1,1],"sqlerr":[],"usems":4,"dbilogerr":"",
"pwduserloginlist":[{"userid":"pj0o396m0s4b66bz","usname":"李婷基","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"上海市","logintime":"2018-12-24 11:23:44.0"}],
"userlikelist":[{"userid":"pj0o396m0s4b66bz","usname":"李婷基","mobile":"13272087162","loginpwd":"apibase123","age":"22","address":"上海市","logintime":"2018-12-24 11:23:44.0"}],
"listsql":["select * from cloud7mysql.user_info where 1=1 and mobile='13272087162' and loginpwd='apibase123' limit 0,1","select * from cloud7mysql.user_info where 1=1 and usname like '%婷%' limit 0,1"]}
微信相关接口
1、微信code
获得openid
接口地址:https://www.dbihelper.cn/open
请求参数:
{"appid":"20192d878y****",//APIBase系统appid
"appkey":"hnudh6i78mvlgnlrthclld1djg6c****",//APIBase系统appkey
"paytype":"wxxcx",//付款类型,匹配微信appid、appsecret秘钥
"wxurltype":"openid",//接口类型固定值
"code":"021oQYkl2Y7JP54ZCNkl2R2Et52oQYkl"//wx.login({success:function(res){console.log(res.code);}});获取
};
返回参数:
{"ok":"y","msg":"获取成功",
"session_key":"HOSw2t4QWTP0LghlAX+fRg==",//会话密钥
"openid":"oQowZ0RkayWpNLbAbghU8bMR26EI",//微信唯一标识
"expires_in":"7200"//时效
};
2、微信获取
token
接口地址:https://www.dbihelper.cn/open
请求参数:
{"appid":"20192d878y****",//APIBase系统appid
"appkey":"hnudh6i78mvlgnlrthclld1djg6c****",//APIBase系统appkey
"paytype":"wxxcx",//付款类型,匹配微信appid、appsecret秘钥
"wxurltype":"token"//接口类型固定值
};
返回参数:
{"ok":"y","msg":"获取成功",
"access_token":"38_CljP3GSYC1aBuTsMgu7u-VOkc-uE7W3bSKi2x_V87IJXrwI......",//会话token
"expires_in":"7200"//时效
};
3、微信
encryptedData
解密
接口地址:https://www.dbihelper.cn/open
请求参数:
{"appid":"20192d878y****",//APIBase系统appid
"appkey":"hnudh6i78mvlgnlrthclld1djg6c****",//APIBase系统appkey
"paytype":"wxxcx",//付款类型,匹配微信appid、appsecret秘钥
"wxurltype":"encrypted",//接口类型固定值
"session_key":"mRSnqsvJsoizEfw58wETKg==",//会话密钥,来源微信code获得openid返回结果中
"iv":"GRzAU4/CQlaJJL0Ukovcuw==",//加密算法的初始向量
"encryptedData":"DqI/+VRMr7SHg98XQ725peiXGkJ8JENWHdK97Ah......"//包括敏感数据在内的完整用户信息的加密数据
};
返回参数:
{"ok":"y","msg":"获取成功",
"phoneNumber":"1327208716",//用户绑定的手机号(国外手机号会有区号)
"purePhoneNumber":"1327208716",//没有区号的手机号
"countryCode":"86",//区号
"watermark":"...."//时效
};
数据库接口开发不支持的SQL语法
删除表drop table mysql.tablename
truncate表truncate table tablename
alter表变更表变更相关语法
=======================================================
HTTP云文件
HTTP云文件介绍
HTTP云文件服务器使用1G带宽,流量免费使用。访问域名https://www.filehelper.cn,https://filehelper.cn。
HTTP云文件使用规范
域名地址https://www.filehelper.cn,https://filehelper.cn/,https://filehelper.cn/
主要功能上传文件、HTTP访问、删除、缩略图、mp4视频切割(m3u8)、图片水印
文件安全应用程序操作文件必须使用filerole(用户操作文件权限)。
filerole 是应用程序里的用户安全操作文件权限,由年月日时分+24位随机数组成。
限制:每天只能在5个IP地址下操作。
安全:有唯一对应的filekey。
filekeyfilekey:用户操作文件权限的密钥,filekey用于文件路径中。
文件路径如:appid路径 + 文件路径 + filekey + 文件类型。
如:/2018/ct/az2m6dss + /img/3k1/11/om1/dsa1 + .syx5wj. + xls
安全说明使用filerole获取filekey,操作文件路径需包含filekey。
上传限制单次上传文件限制100MB。
HTTP云文件获取用户操作文件权限
接口地址https://www.filehelper.cn/filetool,https://filehelper.cn/filetool,https://filehelper.cn/filetool
form表单用POST提交。
输入参数 appid:应用程序编号
appkey:应用程序密钥
method:等于filerole,调用方法
spare:备用字段,由0至99个数字或小写字母组成
测试地址: https://www.filehelper.cn/test/filerole.jsp
https://filehelper.cn/test/filerole.jsp
输入参数:{"appid":"2018ctaz****","appkey":"9ncxzmrda20z6509r******","method":"filerole","spare":"userid"}
返回参数:{"filerole":"3k1114l1snu3cczxhixfxkv2xgfaf6v2","dbilog":{"msg":"文件权限入库成功"},"ok":"y","msg":"操作成功","httpfile":"https://filehelper.cn/"}
自动记录filerole,filekey,spare存入sys_file_role表
filerole
记录
系统表
create table if not exists sys_file_role(
filerole varchar(50) not null comment '文件管理权限',
filekey varchar(99) not null comment '文件管理密钥',
createtime datetime null comment '创建时间',
spare varchar(255) null comment '备注内容',
changerole varchar(255) null comment '文件管理权限变更',
primary key(filerole)
) engine=myisam default charset=gbk;
HTTP云文件上传文件
接口地址https://www.filehelper.cn/fileup,https://filehelper.cn/fileup,https://filehelper.cn/fileup
form表单使用enctype="multipart/form-data"数据格式,用POST提交。
输入参数名 appid:应用程序编号
appkey:应用程序密钥
filerole:文件操作权限
type:文件类型,由1至8个数字或小写字母组成。如:chat,是聊天文件自动转发。
zipyn:是否压缩文件,取值范围:y,空值。
file:文件参数名,支持多个文件上传,单次上传文件限制100MB。
imgwidth:限制图片最大宽度,空值无效。
输出参数fileurl:图片路径中包含图宽像素X图高像素(widthXheight)。
测试地址: https://www.filehelper.cn/test/fileup.jsp
https://filehelper.cn/test/fileup.jsp
输入参数 {"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****", "type":"img","zipyn":"","file":"appbase.cn.png","file1":"filehelp.cn.png", "file2":"filehelper.cn.png","file3":"appbase.cn.pdf","file4":"appbase.cn.mp4"}
返回参数: {"usems":376,"list":[ {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/41/0y/cfz.mowblf.temp.1920X1080.png","name":"appbase.cn.png","type":"png","md5":"3412e02d7932ccc63b21dbbd0e2a54d1","kb":343}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/41/0y/akz.mowblf.temp.1920X1080.png","name":"filehelp.cn.png","type":"png","md5":"1e8496a987aca44c6bbd60b7c4e725c4","kb":1021}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/41/0y/xnz.mowblf.temp.1920X1080.png","name":"filehelper.cn.png","type":"png","md5":"3d54bebfc2f67a7461ac3f91dac4c95f","kb":325}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/41/0y/9pz.mowblf.temp.pdf","name":"appbase.cn.pdf","type":"pdf","md5":"4b7fb118c8d60bb36b0f9c4562ecde1f","kb":721}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/41/0y/gpz.mowblf.temp.mp4","name":"appbase.cn.mp4","type":"mp4","md5":"635f9b2aa37903865db44d127adc46ea","kb":1291}], "httpfile":"https://www.filehelper.cn/", "appid":"2018ctaz****","ok":"y","method":"img","msg":"文件上传成功,单次限100MB。"}
操作记录fileurl,appid,filekb,filetype,ip延时几秒自动存入sys_file_url表
文件路劲
记录
系统表
create table if not exists sys_file_url(
fileurl varchar(50) not null comment '文件路径',
appid varchar(99) not null comment '应用程序appid',
filekb int null comment '文件KB',
filetype varchar(255) null comment '文件类型(jpg,png,zip,mp4,doc)',
type varchar(255) null comment '文件归属类型 ', del varchar(255) null comment 'y删除 ',
ip varchar(30) not null comment '使用者IP',
altertime datetime null comment '改变时间',
primary key(fileurl)
) engine=myisam default charset=gbk;
HTTP云文件操作文件存档、压缩、切割、缩放、水印、删除等
接口地址https://www.filehelper.cn/filetool,https://filehelper.cn/filetool,https://filehelper.cn/filetool
form表单用POST提交。
存档是文件路径中temp被清除。
输入参数 appid:应用程序编号
appkey:应用程序密钥
filerole:文件操作权限
method:调用方法。save(存档),zip(压缩自动存档),cover(切割自动存档),imgsmall(缩放自动存档),imgprintfont(水印自动存档),delete(删除)
fileurl:单个文件路径:如:/2018/ct/az2m6dss/img/3k1/11/om1/dsa1.syx5wj.temp.xls
filenum:多个文件数量序号(序号从1开始)。
fileurl1:多个文件路径,第一个。
fileurl2:多个文件路径,第二个。
imgwidth:缩小图片宽度,常用于图片列表显示 。
输出参数 smallurl:缩小图片地址。
smallkb:缩小图片kb(容量)。
变更记录fileurl,filekb,filetype,ip,del延时几秒自动存入sys_file_url表
文件删除表sys_file_url的字段del=y
测试地址: https://www.filehelper.cn/test/filetool.jsp
https://filehelper.cn/test/filetool.jsp
save
单文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"save","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/fxa.syx5wj.temp.xl"}
save
单文件
返回参数
{"ok":"y","msg":"文件存档成功","usems":"3","list":["fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/fxa.syx5wj.temp.xl","ok":"y","msg":"文件存档成功"],"httpfile":"https://filehelper.cn/"}
save
多文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"save","filenum":"3","fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/kxa.syx5wj.temp.xls","fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/zxa.syx5wj.tmp.xlsx","fileurl3":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/3ya.syxwj.temp.xlsx"}
save
多文件
返回参数
{"ok":"y","msg":"操作成功","usems":"3","list":[{"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/kxa.syx5wj.xls","ok":"y","msg":"文件存档成功"}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/zxa.syx5wj.tmp.xlsx","ok":"n","msg":"文件不存在"}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/3ya.syxwj.temp.xlsx","ok":"n","msg":"文件权限不对"}],"httpfile":"https://filehelper.cn/"}
zip
单文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"zip","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/zxa.syx5wj.temp.xlsx"}
zip
单文件
返回参数
{"ok":"y","msg":"文件成功压缩",list:[{"ok":"y","msg":"文件成功压缩","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/fn1/zxa.syx5wj.xlsx.zip","name":"zxa.syx5wj.xlsx.zip","usems":"3","type":"zip","kb":9,"kbold":9,"md5":"c29979e383c0c4b37488815eeebcaa57"}],"httpfile":"https://filehelper.cn/"}
zip
多文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"zip","filenum":"3", "fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/pi71.syx5wj.temp.xls", "fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/ui71.syx5wj.temp.xls", "fileurl3":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/xi71.syx5wj.temp.xlsx"}
zip
多文件
返回参数
{"ok":"y","msg":"操作成功","usems":"3", "list":[{"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/pi71.syx5wj.xls.zip","name":"pi71.syx5wj.xls.zip","type":"zip","usems":"3","kb":100,"kbold":9,"md5":"a2507b1a954f022ba6a1c1e4b0c88774","ok":"y","msg":"文件成功压缩"}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/ui71.syx5wj.xls.zip","name":"ui71.syx5wj.xls.zip","type":"zip","usems":"3","kb":100,"kbold":9,"md5":"ad9dc5fe969e2ca6c9b12068e6b017a3","ok":"y","msg":"文件成功压缩"}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/pn1/xi71.syx5wj.xlsx.zip","name":"xi71.syx5wj.xlsx.zip","type":"zip","usems":"3","kb":8,"kbold":9,"md5":"c2526e4fa19a271953db53b09c7e5b7e","ok":"y","msg":"文件成功压缩"}],"httpfile":"https://filehelper.cn/"}
cover
单视频
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"cover", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/in1/rc9.syx5wj.temp.mp4"}
cover
单视频
返回参数
{"ok":"y","msg":"文件切割成功","list":["ok":"y","msg":"文件切割成功","gifurl":"/file_/2018/ct/az2m6dss/img/3k1/11/in1/rc9.syx5wj.gif", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/in1/rc9.syx5wj.m3u8","usems":"3"],"httpfile":"https://filehelper.cn/"}
cover
多视频
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"cover","filenum":"3", "fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/tto.syx5wj.temp.mp4", "fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/v0p.syx5wj.temp.mp4", "fileurl3":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/a6p.syx5wj.temp.mp4"}
cover
多视频
返回参数
{"ok":"y","msg":"操作成功","usems":"3","list":[ {"gifurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/tto.syx5wj.gif","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/tto.syx5wj.m3u8","ok":"y","usems":"3","ok":"y","msg":"mp4视频切成m3u8成功"}, {"gifurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/v0p.syx5wj.gif","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/v0p.syx5wj.m3u8","ok":"y","usems":"3","ok":"y","msg":"mp4视频切成m3u8成功"}, {"gifurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/a6p.syx5wj.gif","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/nn1/a6p.syx5wj.m3u8","ok":"y","usems":"3","ok":"y","msg":"mp4视频切成m3u8成功"}],"httpfile":"https://filehelper.cn/"}
imgsmall
单图片
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"imgsmall","imgwidth":"120", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/suh.1veu9b.png"}
imgsmall
单图片
返回参数
{"ok":"y","msg":"图片缩放成功","usems":326,"list":["ok":"y","msg":"图片缩放成功","fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/suh.1veu9b.png" ,"smallurl":"/2018/ct/az2m6dss/img/3k1/31/mb1/suh.1veu9b.120X170.png","smallkb":5],"httpfile":"https://www.filehelper.cn/"}
imgsmall
多图片
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"imgsmall","imgwidth":"100", "filenum":"2","fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/31/jq1/vgm.udv11x.temp.png", "fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/31/jq1/1hm.udv11x.temp.png"}
imgsmall
多图片
返回参数
{"ok":"y","msg":"操作成功","usems":1040,"list":[ {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/jq1/vgm.udv11x.png","smallurl":"/2018/ct/az2m6dss/img/3k1/31/jq1/vgm.udv11x.100X90.png","smallkb":5,"ok":"y","msg":"图片缩放成功","usems":504}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/jq1/1hm.udv11x.png","smallurl":"/2018/ct/az2m6dss/img/3k1/31/jq1/1hm.udv11x.100X90.png","smallkb":5,"ok":"y","msg":"图片缩放成功","usems":534}] ,"httpfile":"https://www.filehelper.cn/"}
imgprintfont
单图片
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"imgprintfont","align":"top", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cth.1veu9b.temp.png"}
imgprintfont
单图片
返回参数
{"ok":"y","msg":"图片水印透明字体成功","usems":456,"list":["ok":"y","msg":"图片水印透明字体成功", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cth.1veu9b.png"],"httpfile":"https://www.filehelper.cn/"}
imgprintfont
多图片
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"imgprintfont","align":"center","filenum":"3", "fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/suh.1veu9b.temp.png", "fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cvh.1veu9b.temp.pdf", "fileurl3":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/8uh.1veu9b.temp.png"}
imgprintfont
多图片
返回参数
{"ok":"y","msg":"操作成功","usems":157,"list":[ {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/suh.1veu9b.png","ok":"y","msg":"图片水印透明字体成功","usems":156}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cvh.1veu9b.temp.pdf","msg":"不是图片","ok":"n","usems":0}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/8uh.1veu9b.temp.png","ok":"n","msg":"文件不存在"}],"httpfile":"https://www.filehelper.cn/"}
delete
单文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****","method":"delete", "fileurl":"/file_/2018/ct/az2m6dss/img/3k1/11/dn1/lxk.syx5wj.temp.xlsx"}
delete
单文件
返回参数
{"ok":"y","msg":"删除成功","usems":"3","list":[{"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/8uh.1veu9b.png","ok":"y","msg":"删除成功"}],"httpfile":"https://filehelper.cn/"}
delete
多文件
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****", "method":"delete","filenum":"2","fileurl1":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/8uh.1veu9b.png", "fileurl2":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cvh.1veu9b.temp.pdf"}
delete
多文件
返回参数
{"ok":"y","msg":"操作成功","usems":5,"list":[ {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/8uh.1veu9b.png","ok":"y","msg":"删除成功"}, {"fileurl":"/file_/2018/ct/az2m6dss/img/3k1/31/mb1/cvh.1veu9b.temp.pdf","ok":"y","msg":"删除成功"}],"httpfile":"https://www.filehelper.cn/"}
生成二维码
接口地址https://www.filehelper.cn/imagecode,https://filehelper.cn/imagecode,https://filehelper.cn/imagecode
form表单用GET提交。
测试地址: https://www.filehelper.cn/test/imagecode.jsp
https://filehelper.cn/test/imagecode.jsp
参数 codeurl16:二维码内容16进制,encode16("codeurl16")
logopath16:图码中间图片地址16进制,encode16("logopath16")
codetitle16:图码中标题字体16进制,encode16("codetitle16")
codecontent16:图码中描述字体16进制,encode16("codecontent16"),用“|”换行。
codecolor:二维码颜色,如:0099bc。
fontcolor:字体颜色,如:000000。
举例<img src="https://www.filehelper.cn/imagecode?codeurl16=encode16("https://apibase.cn")" />
图解
=======================================================
即时聊天
即时聊天介绍
WebSocket即时聊天支持javascript直接连接使用、即时群发,聊天日志查询。访问域名https://chathelper.cn
即时聊天使用规范
域名地址https://www.chathelper.cn,https://chathelper.cn,https://chathelper.cn
相关参数 collect_user:收消息人,由2至20个数字、小写字母组成。
collect_group:收消息分组,由2至20个数字、小写字母组成。
send_user:发送消息人,由2至20个数字、小写字母组成。
text:消息内容,限500字,不能为空,不能包含单引号、双引号。
type:消息类型,由0至12个数字、小写字母组成。
记录日志用户、分组聊天日志延时几秒自动入库。
链接成功
接收参数
{"appid":"2018ctaz****","ok":"y","type":"sys","msg":"即时通讯链接成功"}
被提出
接收参数
{"appid":"2018ctaz****","ok":"n","type":"sys","msg":"你被他人踢出即时通讯"}
用户聊天
日志
系统表
create table if not exists sys_chat_user(
logid bigint(20) AUTO_INCREMENT NOT NULL comment '主键',
collect_user varchar(50) null comment '消息接收人',
send_user varchar(50) null comment '消息发送人',
type varchar(255) null comment '类型',
createtime datetime null comment '服务器接收时间',
text varchar(3000) null comment '消息内容',
ip varchar(30) not null comment '使用者IP',
primary key(logid)
)engine=myisam default charset=gbk ;
分组聊天
日志
系统表
create table if not exists sys_chat_group(
logid bigint(20) AUTO_INCREMENT NOT NULL comment '主键',
collect_group varchar(50) null comment '消息接收分组号',
send_user varchar(50) null comment '消息发送人',
type varchar(255) null comment '类型',
createtime datetime null comment '服务器接收时间',
text varchar(3000) null comment '消息内容',
ip varchar(30) not null comment '使用者IP',
primary key(logid)
)engine=myisam default charset=gbk ;
用户聊天
日志
接口语句
select * from sys_chat_user where (( collect_user='[collect_user]' and send_user= '[send_user]' )
or (collect_user= '[send_user]' and send_user='[collect_user]'))
order by createtime desc
分组聊天
日志
接口语句
select * from sys_chat_group where collect_group='[collect_group]' order by createtime desc
即时聊天用户与分组操作
接口地址https://www.chathelper.cn/helper,https://chathelper.cn/helper,https://chathelper.cn/helper
form表单用POST提交。
methoduser_add_group:分组添加用户,user_del_group:分组删除用户,
user_get_group:用户有哪些分组列表,group_get_user:分组有哪些用户列表
功能 appid:应用程序编号
appkey:应用程序密钥
method:调用方法。
collect_group:收消息分组id
collect_user:收消息用户id。
dbilog:关系同步入库提示内容。
测试地址: https://www.chathelper.cn/test/helper.jsp
https://chathelper.cn/test/helper.jsp
关系入库collect_group,collect_user自动存入sys_chat_groupid表
分组关系
记录
系统表
create table if not exists sys_chat_groupid(
group_user varchar(50) NOT NULL comment '主键分组ID,用户ID',
collect_group varchar(50) null comment '分组ID',
collect_user varchar(50) null comment '用户ID',
createtime datetime null comment '服务器接收时间',
primary key(group_user)
)engine=myisam default charset=gbk ;
user_add_group
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_add_group","collect_group":"groupaa","collect_user":"user11"}
user_add_group
返回参数
{"dbilog":{"msg":"分组关系入表成功"},"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
user_del_group
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_del_group","collect_group":"groupaa","collect_user":"user11"}
user_del_group
返回参数
{"dbilog":{"msg":"分组关系删除成功"},"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
user_get_group
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_get_group","collect_user":"user22"}
user_get_group
返回参数
{"list":["groupaa","groupbb","groupcc"],"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
group_get_user
输入参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"group_get_user","collect_group":"groupaa"}
group_get_user
返回参数
{"list":["user11","user22","user33"],"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
即时聊天发送消息
接口地址https://www.chathelper.cn/chat,https://chathelper.cn/chat,https://chathelper.cn/chat
form表单用POST提交。
相关参数名 appid:应用程序编号
appkey:应用程序密钥
text:消息内容,限500字,不能为空,不能包含单引号、双引号。
type:消息类型,由0至12个数字、小写字母组成。
collect_user:收消息人,由2至20个数字、小写字母组成。
collect_group:收消息分组,由2至20个数字、小写字母组成。
send_user:发送消息人,由2至20个数字、小写字母组成。
注意:collect_group与collect_user二选一,都有值collect_group优先。
groupuser:分组人数。
grouplineuser:分组在线人数。
聊天记录延时几秒自动存入sys_chat_user,sys_chat_group表
测试地址: https://www.chathelper.cn/test/chat.jsp
https://chathelper.cn/test/chat.jsp
发送
分组参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****", "text":"apibase欢迎你发送分组信息","type":"","collect_group":"groupaa","send_user":"apibase"}
返回
分组参数
{"groupuser":3,"grouplineuser":3,"appid":"2018ctaz****","ok":"y","type":"","msg":"发送成功","usems":"3"}
接收
分组参数
{"appid":"2018ctaz****","collect_group":"groupaa","collect_user":"","send_user":"apibase","type":"","text":"apibase欢迎你发送分组信息","time":"2019-01-03 16:16:01.564"}
发送
用户参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","text":"apibase欢迎你发送用户信息","type":"","collect_user":"user11","send_user":"apibase"}
返回
用户参数
{"appid":"2018ctaz****","ok":"y","type":"","msg":"发送成功,在线消息","usems":"3"}
{"appid":"2018ctaz****","ok":"y","type":"","msg":"发送成功,离线消息","usems":"3"}
接收
用户参数
{"appid":"2018ctaz****","collect_group":"","collect_user":"user11","send_user":"apibase","type":"","text":"apibase欢迎你发送用户信息","time":"2019-01-03 16:14:58.982"}
即时聊天接收消息
接口地址ws://www.chathelper.cn/link/appid/userid,
ws://chathelper.cn/link/appid/userid
wss://chathelper.cn/link/appid/userid
相关参数名 appid:应用程序编号
userid:应用程序密钥
测试地址: https://www.chathelper.cn/test/chatget.jsp
https://chathelper.cn/test/chatget.jsp
输入参数
返回参数 {"appid":"2018ctaz****","ok":"y","type":"sys","msg":"即时通讯链接成功"}
即时聊天发送文件
接口地址https://www.filehelper.cn/fileup,https://filehelper.cn/fileup,https://filehelper.cn/fileup
form表单使用enctype="multipart/form-data"数据格式,用POST提交。
相关参数名 appid:应用程序编号
appkey:应用程序密钥
filerole:文件操作权限
type:文件归属类型为chat
zipyn:是否压缩文件,y压缩。
httpchat:即时聊天接口地址。https://www.chathelper.cn/chat,https://chathelper.cn/chat
collect_group:接收消息分组。(collect_group与collect_user必须有一个有值)。
collect_user:接收消息用户。
file1:选择本地文件路径。
file2:选择本地文件路径。
文件记录延时几秒自动存入sys_file_url表
聊天记录延时几秒自动存入sys_chat_user,sys_chat_group表
文件删除表sys_file_url的字段del=y
测试地址: https://www.filehelper.cn/test/chat.jsp
https://filehelper.cn/test/chat.jsp
输入参数 {"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","filerole":"3k1115l1fxen2ob*****", "type":"chat","httpchat":"https://chathelper.cn/chat","zipyn":"y", "collect_group":"groupaa","collect_user":"","send_user":"apibase" ,"file":"专项附加扣除信息电子模版.xls","file1":"专项附加采集表.xlsx"}
返回参数 {"appid":"2018ctaz****","collect_group":"groupaa","collect_user":"","send_user":"apibase", "type":"chat","text":[{"fileurl":"/file_/2018/ct/az2m6dss/chat/3k1/11/fq1/gr51.syx5wj.temp.xls.zip", "name":"专项附加扣除信息电子模版.xls.zip","type":"zip","md5":"f1ec5ec7d62b9e7b6cd3b4804077a100","kb":110}, {"fileurl":"/file_/2018/ct/az2m6dss/chat/3k1/11/fq1/cs51.syx5wj.temp.xlsx.zip","name":"专项附加采集表.xlsx.zip", "type":"zip","md5":"b1babc32b6f78f302e8dee4bfc58ef8e","kb":12}],"time":"2019-01-02 21:47:53.173", "httpfile":"https://filehelper.cn/","usems":"3"}
即时聊天在线用户
接口地址https://www.chathelper.cn/helper,https://chathelper.cn/helper,https://chathelper.cn/helper
form表单用POST提交。
相关参数名 appid:应用程序编号
appkey:应用程序密钥
method:调用方法为user_online。
collect_group:收消息分组id
collect_user:收消息用户id。
注意:collect_group与collect_user二选一,都有值collect_group优先。
groupuser:分组人数。
grouplineuser:分组在线人数。
askuser:请求人数。
asklineuser:请求在线人数。
alllineuser:所有在线人数
测试地址: https://www.chathelper.cn/test/line.jsp
https://chathelper.cn/test/line.jsp
单用户
在线参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_online","collect_user":"user11"}
单用户
返回参数
{"collect_user":"user11","line":"在线","alllineuser":3,"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
多用户
在线参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_online","collect_usernum":"3","collect_user1":"user11","collect_user2":"user22","collect_user3":"user33"}
多用户
返回参数
{"list":[{"collect_user":"user11","line":"在线"},{"collect_user":"user22","line":"在线"},{"collect_user":"user33","line":"在线"}] ,"askuser":3,"asklineuser":3,"alllineuser":3,"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
分组员
在线参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"user_online","collect_group":"groupaa"}
分组员
返回参数
{"groupuser":3,"grouplineuser":3,"alllineuser":3,"list":[{"collect_user":"user11","line":"在线"},{"collect_user":"user22","line":"在线"},{"collect_user":"user33","line":"在线"}],"alllineuser":3,"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功","usems":"3"}
即时聊天最后一条消息、离线时间
接口地址https://www.chathelper.cn/helper,https://chathelper.cn/helper,https://chathelper.cn/helper
form表单用POST提交。
相关参数名 appid:应用程序编号
appkey:应用程序密钥
method:调用方法为last_log:用户最后一条消息,leave_time:离开时间。
collect_user:收消息用户id。
测试地址: https://www.chathelper.cn/test/last.jsp
https://chathelper.cn/test/last.jsp
leave_time
传送参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"leave_time","collect_user":"user11"}
leave_time
返回参数
{"time":"2019-01-03 16:19:54.723","usems":0,"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功"}
last_log
传送参数
{"appid":"2018ctaz****","appkey":"9ncxzmrda20z*****","method":"last_log","collect_user":"user11"}
last_log
返回参数
{"list":[{"send_user":"apibase","text":"apibase欢迎你发送用户信息","time":"2019-1-3 16:14:58"}, {"collect_group":"groupaa","text":"apibase欢迎你发送分组信息","time":"2019-1-3 16:16:01"}] ,"usems":12,"appid":"2018ctaz****","ok":"y","type":"sys","msg":"执行成功"}
短信接口
短信接口介绍
提供短信验证码代发,避免了短信签名、短信模板审核,验证码发送用时非常短。访问域名https://dbihelper.cn
短信接口使用规范
调用地址https://dbihelper.cn/sendsms,https://dbihelper.cn/sendsms
调用方式接口使用HTTP访问,HTTP是一个客户端和服务器端请求和应答的标准(TCP)
接口必带参数mobile:手机号,smstype:短信类型,smsmsg:短信内容
接口其它参数短信升级后确定
短信发送
日志
系统表
create table if not exists mysql.sys_sms_log(
logid varchar(30) not null comment '主键',
mobile varchar(255) null comment '接收手机号',
smscode varchar(255) null comment '6位验证码',
smsmsg varchar(999) null comment '短信内容' ,
smstype varchar(255) null comment '短信类型',
back varchar(255) null comment '返回内容y/n' ,
userid varchar(255) null comment '发送人',
ipnut text null comment '输入参数',
createtime datetime null comment '创建时间' ,
flag varchar(255) null comment 'y' ,
ip varchar(255) not null comment '操作者IP',
primary key(logid)
) engine=myisam default charset=gbk;
APICloud
为列
function sendsms(){
  var where={"appid":"2018ctaz****","appkey":"9ncxzmrda20z6509r******",
  "mobile":"13272087162","smstype":"userlogin",
  "smsmsg":"【APIBase】关联手机动态安全验证码是:smscode,请保密使用不要告诉任何人。"};
  api.ajax({url:"https://dbihelper.cn/sendsms",method:"post",timeout:"60",data:{values:where}},
  function(res,err){
    if("y"==res.ok){ alert("短信发送成功");}
    else{ alert("操作失败,"+res.msg) }
  }); }
短信接口发送短信
appnameAPP名称
smscode6位验证码
短信内容如:【美团】注册验证码是:smscode,工作人员不会向您索要,请勿向任何人泄露,以免造成账户或资金损失。
请求参数{"mobile":"13272087162","smstype":"userlogin","smsmsg":"【美团】注册验证码是:smscode,工作人员不会向您索要,请勿向任何人泄露,以免造成账户或资金损失。"}
返回结果 {"ok":"y","smslog":"y","msg":"发送成功","msglog":"发送成功","usems":"3","msglog":""}
ok短信发送y/n(成功/失败)。
oklog短信日志入库发送y/n(成功/失败)。
msg短信发送提示内容。
msglog短信日志入库提示内容。
usems短信发送用时毫秒。
短信接口替发验证码
请求参数{"mobile":"13272087162","smstype":"短信类型"}
返回结果 {"ok":"y","smslog":"y","msg":"发送成功","msglog":"发送成功","usems":"3","msglog":""}
收到短信【APIBase】替APP名称,发短信验证码:666888,请勿泄露,工作人员不会向你索要。
第三方支付
介绍
代收费扣费3个点
参数 appid:
appkey:
ordertitle:下单商品名称
orderdetail:下单商品详情
ordermoney:下单金额(元)
paytype:付款类型,zfbapp、zfbweb、zfbxcx、wxapp、wxweb、wxxcx
sqlid:支付成功回调数据库接口编号,以payback结尾。
where.*:人工追加参数,用于支付回调数据库接口。
公司开户
材料需要带:营业执照、法人身份证、公章、财务章、法人章(私章)
视频
支付宝APP支付
公账开通
apicloud
源码
function zfbapp(ordertitle,orderdetail,ordermoney){/* 支付宝APP支付 */
  var url="https://www.dbihelper.cn/paysend?"+Math.random();
  var where={
    appid:20192d878y****,
    appkey:hnudh6i78mvlgnlrthclld1djg6c****,
    ordertitle:"购买apibase服务",
    orderdetail:"数据接口服务",
    ordermoney:"1",/* 元 */
    paytype:"zfbapp",
    sqlid:"zfbpayback",
    where.userid:"支付回调追加参数1",
    where.appid:"支付回调追加参数2"
  };
  api.ajax({url:url,method:"post",data:{values:where}},   function(res,err){     if("y"==res.ok){
      var orderpayid=res.orderpayid;/*付款订单号码*/
      var orderinfo="partner="+res.partner+"&seller_id="+res.seller_id;
      orderinfo+="&out_trade_no="+res.out_trade_no+"&subject="+res.subject;
      orderinfo+="&body="+res.body+"&total_fee="+res.total_fee;
      orderinfo+="&notify_url="+res.notify_url+"&service="+res.service;
      orderinfo+="&payment_type="+res.payment_type+"&_input_charset="+res._input_charset;
      orderinfo+="&it_b_pay="+res.it_b_pay+"&sign="+res.sign+"&sign_type="+res.sign_type;
      var aliPay=api.require("aliPay");
      aliPay.payOrder({orderInfo:orderinfo},
      function(res,err){
        var backcode=res.code;
        if("9000"==backcode){backcode="支付成功";}
        else if("4000"==backcode){backcode="系统异常";}
        else if("4001"==backcode){backcode="数据格式不正确";}
        else if("4003"==backcode){backcode="该用户绑定的支付宝账户被冻结或不允许支付";}
        else if("4004"==backcode){backcode="该用户已解除绑定";}
        else if("4005"==backcode){backcode="绑定失败或没有绑定";}
        else if("4006"==backcode){backcode="订单支付失败";}
        else if("4010"==backcode){backcode="重新绑定账户";}
        else if("6000"==backcode){backcode="支付服务正在进行升级操作";}
        else if("6001"==backcode){backcode="用户中途取消支付操作";}
        if(backcode.indexOf("成功")>=0){ alert(backcode); }
        else{ alert(backcode); }
      });
    }else{alert(res.msg);}
  });
};
支付宝网页支付
测试地址https://www.dbihelper.cn/test/payzfb.jsp 测试
截图
支付宝小程序支付
支付宝回调参数
日志表 create table mysql.pay_zfbinfo(
orderpayid varchar(50) comment 'apibase付款订单号' not null,
ordermoney double comment 'apibase付款金额' not null,
trade_no varchar(255) comment '支付宝订单号' not null,
subject varchar(255) comment '订单名称' not null,
body varchar(255) comment '订单详情' not null,
trade_status varchar(255) comment '付款查询状态 TRADE_SUCCESS' not null,
total_fee double comment '付款金额合计元' not null,
price double comment '付款金额元' not null,
out_trade_no varchar(255) comment '付款订单号' not null,
notify_time varchar(255) comment '发生时间' not null,
notify_id varchar(255) comment '支付宝订单号重要' not null,
seller_id varchar(255) comment '收款者支付宝账户ID' not null,
seller_email varchar(255) comment '收款商户号邮箱' not null,
buyer_id varchar(255) comment '付款者支付宝账户ID' not null,
buyer_email varchar(255) comment '付款者邮箱' not null,
primary key(orderpayid)
)
注意支付宝付款成功才会调用数据库接口编号(sqlid)
支付
成功
回调
参数
样例
orderpayid:发起支付订单号,如:1903092228imsaga
ordermoney:发起支付订单金额(元),如:0.10
trade_status:支付宝订单交易状态成功,如:TRADE_SUCCESS
subject:支付宝订单标题,如:购买apibase服务
body:支付宝商品描述,如:数据接口服务
trade_no:支付宝交易凭证号,如:20190309220014998110231*****
out_trade_no:商户订单号,如:1903092228imsaga
buyer_id:支付宝买家用户号,如:20889020625*****
buyer_email:支付宝买家账号,如:476***@qq.com
seller_id:支付宝卖家用户号,如:20882219107*****
seller_email:支付宝卖家账号,如:ser@dizan.vip
gmt_create:支付宝交易创建时间,如:2019-03-09 22:28:29
gmt_payment:支付宝交易付款时间,如:2019-03-09 22:28:30
notify_type:支付宝通知的类型,如:trade_status_sync
notify_time:支付宝通知时间,如:2019-03-09 22:28:30
notify_id:支付宝通知校验ID,如:20190309002222228300998110549*****
sign_type:支付宝签名类型,如:MD5
sign:支付宝签名内容,如:15c49fdde02492f96da71e2720fec9bd
where.userid:发起支付回调追加参数,如:支付回调追加参数1
where.appid:发起支付回调追加参数,如:支付回调追加参数2
paymsg:系统判断参数,如:付款成功
微信APP支付
支付签名提供微信APP、小程序、公众号支付签名JAVA源码,请找客服获取。
公账开通
apicloud
源码
function wxpayapp(openid){
  var url="https://www.dbihelper.cn/paysend?"+Math.random();
  var where={
    appid:"20192d878y****",
    appkey:"hnudh6i78mvlgnlrthclld1djg6c****",
    sqlid:"wxpayback",
    paytype:"wxapp",
    ordertitle:"购买apibase服务",
    orderdetail:"数据接口服务",
    ordermoney:"1",/* 元 */
    openid:openid
    where.userid:"支付回调追加参数1",
    where.appid:"支付回调追加参数2"
  };
  api.ajax({url:url,method:"post",data:{values:where}},
  function(res,err){
    if("y"==res.ok){
      var wxPay = api.require('wxPay');
      var wherepay={
      apiKey:res.appid, /* wxappid */
      orderId:res.prepayid,
      mchId:res.mchid,
      nonceStr:res.noncestr,
      timeStamp:res.timestamp,
      package:res.package,
      sign:res.sign
      };
      wxPay.payOrder(wherepay, function(res,err){
      if(res.status){
        tishimsg("付款成功");
        /* 微信支付成功主动回调 res.notify_url */
        }else{alert("付款错误,"+err.code);}
      });
    }else{tishimsg(res.msg);}
  });
}
微信网页支付
测试地址https://www.dbihelper.cn/test/paywx.jsp 测试
截图
微信小程序支付
源码 function getopenid(){
  wx.login({success:function(res){
    console.log("微信的code==="+res.code);
    wx.request({url:"https://www.dbihelper.cn/open",method: 'POST',
      header:{'content-type': 'application/x-www-form-urlencoded'},
      data:{
      appid:"20192d878y****",
      appkey:"hnudh6i78mvlgnlrthclld1djg6c****",
      code:res.code,
      paytype:"wxxcx",
      wxurltype:"openid"
    },success:function(res){
      var json=res.data;
      if("y"==json.ok){
        console.log("微信的 openid==="+json.openid);
      }
    }});
    console.log("微信的code==="+res.code);
  }});
}

function wxxcxpay(openid){
  var loadurl="https://www.dbihelper.cn/paysend";
  wx.request({url:loadurl,method:"POST",
  header:{"content-type": "application/x-www-form-urlencoded"},
  data:{
    appid:"20192d878y****",
    appkey:"hnudh6i78mvlgnlrthclld1djg6c****",
    sqlid:"wxpayback",
    paytype:"wxxcx",
    ordertitle:"购买apibase服务",
    orderdetail:"数据接口服务",
    ordermoney:"1",/* 元 */
    openid:openid
    where.userid:"支付回调追加参数1",
    where.appid:"支付回调追加参数2"
  },fail:function(res){ console.log("失败");
  },success:function(res){
    var json=res.data;
    if("y"==json.ok){
      wx.requestPayment({
      "timeStamp":json.timestamp,
      "nonceStr":json.noncestr,
      "package":json.packages,
      "signType":"MD5",
      "paySign":json.paysign,
      "fail":function(res){},
      "success":function(resok){//付款成功
        console.log("pay_success "+resok.errMsg);
      }});
    }else{console.log(json.msg);}
    }
  });
}
微信回调参数
日志表 create table mysql.pay_wxinfo(
orderpayid varchar(50) comment 'apibase付款订单号' not null,
ordermoney double comment 'apibase付款金额' not null,
appid varchar(255) comment '微信公众/开发账号ID' not null,
mch_id varchar(255) comment '微信商户号' not null,
openid varchar(255) comment '微信用户标识' not null,
transaction_id varchar(255) comment '微信支付订单号' not null,
is_subscribe varchar(255) comment '微信是否关注公众账号' not null,
total_fee double comment '微信标价金额(分)' not null,
cash_fee double comment '微信现金支付金额(分)' not null,
return_code varchar(255) comment '查询微信订单返回状态码' not null,
return_msg varchar(255) comment '微信返回信息' not null,
bank_type varchar(255) comment '微信付款银行' not null,
time_end varchar(255) comment '微信支付完成时间' not null,
primary key(orderpayid)
)
注意微信付款成功才会调用数据库接口编号(sqlid)
支付
成功
回调
参数
样例
orderpayid:发起支付订单号,如:1904041515wh2zd
ordermoney:发起支付订单金额(元),如:0.1
openid:微信用户标识,如:oUOdg5lNy_bj7_Y5d3MhMBQ78CDA
transaction_id:微信支付订单号,如:4200000298201904049398417099
out_trade_no:微信商户订单号,如:1904041515wh2zd
appid:微信公众/开发账号ID,如:wx28ed7b13054191a4
mch_id:微信商户号,如:1527536991
time_end:微信支付完成时间,如:20190404151559
trade_state:微信交易状态,如:SUCCESS
result_code:查询微信订单业务结果,如:SUCCESS
return_code:查询微信订单返回状态码,如:SUCCESS
total_fee:微信标价金额(分),如:10
cash_fee:微信现金支付金额(分),如:10
return_msg:微信返回信息,如:OK
is_subscribe:微信是否关注公众账号,如:N
fee_type:微信标价币种,如:CNY
trade_type:微信交易类型,如:JSAPI
sign:微信签名内容,如:B1694326CAE0E4C03AB9B9459818EC13
attach:微信附加数据,如:数据接口服务
nonce_str:随机字符串,如:4yf90MI231MW9D58
bank_type:微信付款银行,如:COMM_DEBIT
trade_state_desc:微信交易状态描述,如:支付成功
paymsg:系统判断参数,如:付款成功
where.userid:发起支付回调追加参数,如:支付回调追加参数1
where.appid:发起支付回调追加参数,如:支付回调追加参数2
MySQL语法
MySQL语法数据类型
数据类型数据类型格式化
datecast(create_time as char(10)):2018-12-26
datetimecast(create_time as char(10)):2018-12-26
datetimecast(create_time as char(16)):2018-12-26 15:16
datetimecast(create_time as char(19)):2018-12-26 15:16:17
timestampcast(create_time as char(10)):2018-12-26
timestampcast(create_time as char(16)):2018-12-26 15:16
timestampcast(create_time as char(19)):2018-12-26 15:16:17
double,floatformat(column,2):四舍五入保留2位小数
样例下载
下载demo
demo测试安卓包下载
demo测试html源码下载
demo测试建表语句下载
demo测试数据库接口下载
demo测试内容
java源码
key private static String[] key={"0","1","2","3","4","5","6","7","8","9"
,"a","b","c","d","e","f","g","h","i","j","k","l","m","n"
,"o","p","q","r","s","t","u","v","w","x","y","z"};
private static int key_len=key.length;
余数 public static String timeyu(int xuhao){return key[xuhao];}
随机数 public static String randStr(int len){
  StringBuilder sb=new StringBuilder();
  Random ran=new Random();
  for (int i=0;i < len;i++) {
    sb.append(key[ran.nextInt(key_len)]);
  }return sb.toString(); }
appid public static String appid(){
  Calendar cal = Calendar.getInstance();
  String appid=cal.get(Calendar.YEAR)+
  DateHelper.timeyu(cal.get(Calendar.MONTH)+1)+
  DateHelper.timeyu(cal.get(Calendar.DAY_OF_MONTH))+
  DateHelper.randStr(8);
  File file=new File(filepath+"/"+appidpath(appid));
  if(file.exists()){return appid();}else{file.mkdirs(); return appid;}
}
sys.id private static long timeold=0;
private static long timexuhao=36;
public static String timeid(){
  long ms=System.currentTimeMillis();
  StringBuffer sbid=new StringBuffer();
  if(timeold-ms==0){timexuhao++;}else {timexuhao=36;timeold=ms;}
  long xuhao=timexuhao;
  if(xuhao==36){
    sbid.append("01");
  }else{
    while(xuhao>0){
      sbid.append(key[(int) (xuhao%key_len)]);
      xuhao=xuhao/key_len;
    }
  }
  while(ms>0){sbid.append(key[(int)(ms%key_len)]);ms=ms/key_len;}
  sbid.reverse();
  return sbid.toString();
}
Encode16 public static String encode16(String str){
  StringBuilder sb=new StringBuilder();
  String ling="0000";
  char[] data=str.toCharArray();
  for (int i = 0; i < data.length; i++) {
    String unicode=Integer.toHexString(data[i]);
    int len=unicode.length();
    if(len<4){sb.append(ling.substring(4-len));}
    sb.append(unicode);
  }
  return sb.toString() ;
}

JavaScript
function encode16(str){
  var back="";
  for(var i=0;i<str.length;i++){
    var one="0000"+str.charCodeAt(i).toString(16);
    back+=one.substring(one.length-4,one.length);
  }
  return back;
}
微信签名提供微信APP、小程序、公众号支付签名JAVA源码,请找客服获取。
阿里云提供服务
湘ICP备14008315号
湘公网安备43011102001667号
联系客服