天天看点

http://apibase.cn,云数据接口短信登录样例

/* 鐢ㄦ埛鐭俊鐧诲綍 */
function usersmslogin(mobile,smscode){
  var url="https://www.dbihelper.cn/linkdb?"+Math.random();;
  var where={appid:appid,appkey:appkey,
  sqlid:"usermobile;smsfind;usersmslogin",
  mobile:mobile,smscode:smscode,smstype:"login",
  deviceid:api.deviceId,devicename:api.deviceModel};  
  jquery.ajax({url:url,method:"post",data:{values:where}},
  function(res,err){
    if("y"==res.ok){
      if(res.usersmsloginlist.length==1){
        tishimsg("鐭俊鐧诲綍鎴愬姛锛宻ys.userid閫氳繃sys.sessionid鑷姩鑾峰彇");
      }else if(res.usermobilelist.length==0){
        tishimsg("鎵嬫満鍙锋湭娉ㄥ唽");
      }else if(res.smsfindlist.length==0){
        tishimsg("鎵嬫満鍙锋棤鐧诲綍鐭俊");
      }else if(res.smsfindlist.length==1){
        if("0"==res.smsfindlist[0].smscodeok){ tishimsg("鐭俊楠岃瘉鐮侀敊璇?); }
        else if("0"==res.smsfindlist[0].smsflagok){ tishimsg("鐭俊宸插け鏁?); }
      }
    }else{tishimsg(res.msg);}
  });
};
           
/* 鍙戦€佺煭淇?*/
var smstime=60;
function smssend(mobile,smstype){/* 鍙戦€佺煭淇?*/
  if(60==smstime){
/* 鐭俊鍐呭锛氥€怉PIBase銆戞浛appname锛屽彂鐭俊楠岃瘉鐮侊細smscode锛岃鍕挎硠闇诧紝宸ヤ綔浜哄憳涓嶄細鍚戜綘绱㈣銆? */
    
    var url="https://www.dbihelper.cn/sendsms?"+Math.random();;
    var where={appid:appid,appkey:appkey,mobile:mobile,smstype:smstype };
    
    jquery.ajax({url:url,method:"post",data:{values:where}},
    function(res,err){
      if("y"==res.ok){
        smssendtime();
        tishimsg("鐭俊鍙戦€佹垚鍔?);
      }else{tishimsg(res.msg);}
    });
  }else{ tishimsg("璇?+smstime+"绉掑悗鍙戦€佺煭淇?); }
}
function smssendtime(){/* 鍙戦€佺煭淇¤鏃剁 */
  smstime=parseInt(smstime)-1;
  if(smstime==0){smstime=60;return;}
  setTimeout(function(){smssendtime();},"1000");
}
           

浜戞暟鎹簱鎺ュ彛SQL鍐呭鎻愪緵涓嬭浇

涓嬭浇鏇村鏂囨。璇疯闂甴ttps://apibase.cn/api.jsp

浜戞暟鎹簱鎺ュ彛鍦板潃锛歨ttps://www.dbihelper.cn/linkdb

create table mysql.user_info(

userid varchar(30) not null comment '鐢ㄦ埛涓婚敭' ,

usname varchar(255) null comment '鐢ㄦ埛鍖垮悕',

mobile varchar(255) null comment '鎵嬫満鍙?,

loginpwd varchar(255) null comment '鐧诲綍瀵嗙爜',

deviceid varchar(255) null comment '璁惧鍙?,

devicename varchar(255) null comment '璁惧鍚嶇О',

logintime datetime null comment '鐧诲綍鏃堕棿',

loginnum int null comment '鐧诲綍娆℃暟',

loginip varchar(255) null comment '鐧诲綍IP',

primary key(userid)

) charset=gbk comment='鐢ㄦ埛琛?

鏌ヨ鐢ㄦ埛鎵嬫満鍙锋帴鍙o紝sqlid锛歶sermobile

SQL璇彞锛歴elect mobile from mysql.user_info where mobile='[mobile]'

鎻掑叆鐭俊鎺ュ彛(姝e紡鐜涓嶉渶瑕?锛宻qlid锛歴msinsert

SQL璇彞锛歩nsert into mysql.sys_sms_log(logid,mobile,smscode,smstype,createtime,usems,flag,ip) values('[sys.id]','[mobile]','[smscode]','[smstype]','[sys.time]','1','y','[sys.ip]')

鏌ヨ鐭俊楠岃瘉鐮佹帴鍙o紝sqlid锛歴msfind

SQL璇彞锛歴elect smscode='[smscode]' smscodeok,flag='y' smsflagok from mysql.sys_sms_log where mobile='[mobile]' and smstype='[smstype]'

鐢ㄦ埛鐭俊鐧诲綍鎺ュ彛锛宻qlid锛歶sersmslogin

SQL璇彞锛歴elect userid,mobile,deviceid,devicename,logintime from mysql.user_info where mobile='[mobile]' and 1<=(select count(1) from mysql.sys_sms_log where smstype='[smstype]' and mobile='[mobile]' and smscode='[smscode]' and flag='y'); update mysql.user_info set logintime=now(),loginnum=loginnum+1,loginip='[sys.ip]' where mobile='[mobile]' and 1<=(select count(1) from mysql.sys_sms_log where smstype='[smstype]' and mobile='[mobile]' and smscode='[smscode]' and flag='y'); update mysql.sys_sms_log set flag='n' where smstype='[smstype]' and mobile='[mobile]' and smscode='[smscode]' and flag='y';

鐢ㄦ埛淇℃伅鏌ヨ鎺ュ彛锛宻qlid锛歶serselect

SQL璇彞锛歴elect userid,usname,mobile,deviceid,devicename,logintime,loginnum,loginip from mysql.user_info where usname like? '%[usname]%' and mobilelike? '%[mobile]%' order by [orderby]

鐢ㄦ埛鐭俊娉ㄥ唽鎺ュ彛锛宻qlid锛歶serselect

insert into mysql.user_info(userid,mobile,deviceid,devicename,logintime)

select * from ( select '[sys.id]','[mobile]' mobile,'[deviceid]','[devicename]','[sys.time]' ) s聽

where mobile not in (select mobile from mysql.user_info ) and 1=(select count(1) from mysql.sys_sms_log where smstype='[smstype]' and mobile='[mobile]' and smscode='[smscode]' and flag='y');

update mysql.sys_sms_log set flag='n' where smstype='[smstype]' and mobile='[mobile]' and smscode='[smscode]' and flag='y';

鐢ㄦ埛鍒犻櫎鎺ュ彛(姝e紡鐜涓嶉渶瑕?锛宻qlid锛歶serdelete

SQL璇彞锛歞elete from mysql.user_info where mobile='[mobile]'

瀹㈡湇QQ锛?968629178

apibase.cn鎻愪緵

继续阅读