xuguohong

add wegame version

No preview for this file type
import commonH5Utils from"./commonH5Utils.js";export default class{constructor(){this.hasInit=!1;this.hasLogout=!1;this.hasSwitchAccount=!1;this.hasFloatView=!1;this.hasUserCenter=!1;this.hasExitDialog=!1;this.sdkInfo={};this.loginExt="1";this.gameSettingData={has_micro_client:0,is_share:0,is_focus:0,is_apple_pay:0,is_open_pay:1,is_desktop:0,is_switch_account:0,is_realverify:0,is_real_name_verify:-1,birthday:"",is_super_kefu:0,is_backtogame:0,is_lock:0,is_focus_gift:0,is_bindphone:0,is_msgseccheck:0,is_checkbalance:0,is_showad:0,is_usercenter:0,is_kefu:0,is_score:0,is_query_products_info:0,is_event_track:0,is_blue_vip_function:0,is_subscribe_whats_new:0,msg_subscribe_code:0,is_get_scene_interface:0,is_show_vip:0,is_show_qqun:0}}init(){console.log("super init")}login(){console.log("super login")}logout(){console.log("super logout")}switchAccount(){console.log("super switchaccmount")}userCenter(){console.log("super userCenter")}submitData(){console.log("super submitData")}expansionInterface(n,t,i){var r,u;console.log("super expansionInterface");commonH5SDK.expansion_type.gameSetting==n?(r={code:0,message:"success",data:this.gameSettingData},i(r)):(u={code:-1,message:""},i(u))}createOrder(n){var t={onSuccess:function(t){commonH5SDK.h5Proxy.pay(n,t)},onFail:function(){console.log("create order fail");commonH5SDK.callback(commonH5SDK.code.PAY_FAIL,"创建订单错误")}};commonH5Utils.getInstance().payCheck(n,t)}pay(){console.log("super pay")}showExitDialog(){console.log("super showExitDialog")}exitGame(){}}
\ No newline at end of file
import commonBaseProxy from"./commonBaseProxy.js";import commonH5Utils from"./commonH5Utils.js";var n=require("./wxgame_sdk.js");export default class extends commonBaseProxy{constructor(){super()}init(){}login(){var i=commonH5Utils.getInstance().configInfoReturn.sdkAppId,t=commonH5Utils.getInstance();n.login(i,function(i,r){if(i==1){var u={gameSimpleName:t.sdkInfo.gameSimpleName,sdkSimpleName:t.sdkInfo.sdkSimpleName,sdkVersionCode:t.sdkInfo.sdkVersionCode,result:"",userType:"",openId:r.openId,userName:"",token:r.token,timestamp:r.timestamp,other:r.loginKey,serverSign:""};t.loginCheck(u);n.menuShareInit("")}else window.commonH5SDK.callback(commonH5SDK.code.LOGIN_FAIL,"sdk login fail"),console.log("login fail",r)})}submitData(t,i){switch(t){case window.commonH5SDK.type.enterGame:n.sdkUserCloudStorage("xizhai",i.roleLevel)}}pay(){}expansionInterface(t,i,r){switch(t){case commonH5SDK.expansion_type.mulShare:i&&i.type==0&&n.sdkShareContent(i.data);break;default:super.expansionInterface(t,i,r)}}}
\ No newline at end of file
import commonH5Proxy from"./commonH5Proxy.js";import commonH5Utils from"./commonH5Utils.js";window.commonH5SDK={sdk_isShowLog:!1,code:{INIT_SUCCESS:1,INIT_FAIL:-1,LOGIN_SUCCESS:10,LOGIN_FAIL:-10,LOGOUT_SUCCESS:100,LOGOUT_FAIL:-100,SWITCH_SUCCESS:1e3,SWITCH_FAIL:-1e3,PAY_SUCCESS:2,PAY_FAIL:-2,PAY_CANCEL:-3,EXIT_SUCCESS:4,EXIT_CANCEL:-4},type:{arriveServerSelectPage:1,createRole:2,enterGame:3,upRoleLevel:4,arriveEntrance:5,enterServer:6,arriveFirstScene:7,arriveLoadingFinish:8,arriveLoadingZero:9,arriveCreateRolePage:10,newcomerFinish:11,checkpointStart:12,checkpointEnd:13,selectRole:14,renameRole:15,newcomerStart:16},expansion_type:{gameSetting:100,downloadMicroClent:101,share:102,focus:103,save2Desktop:104,realVerify:105,back2Game:106,bindPhone:107,msgSecCheck:108,checkBalance:109,showAd:110,score:111,kefu:112,queryProductsInfo:113,userCenter:114,eventTrack:115,realNameVerify:116,mulShare:117,blueVip:118,blueVipBuy:119,whatsNewSubscriptionsSetting:120,subscribeWhatsNew:121,firstEnterGameScene:122,msgSubscribe:123},callback:{},h5Proxy:"",init:function(n,t){this.callback=t;var i=this,r={onCheckConfigSuccess:function(){i.h5Proxy=new commonH5Proxy;i.h5Proxy.init({});i.h5Proxy.hasInit||t(commonH5SDK.code.INIT_SUCCESS,"初始化成功")},onCheckConfigFail:function(){console.log("onCheckConfigFail");i.callback(i.code.INIT_FAIL,"初始化错误")}};commonH5Utils.getInstance().configCheck(n,r)},login:function(n){commonH5Utils.getInstance().submitInfo("event:openSDKLogin",null);this.h5Proxy.loginExt=n;this.h5Proxy.login(n)},pay:function(n){this.h5Proxy.createOrder(n)},hasLogout:function(){return this.h5Proxy.hasLogout},logout:function(){this.h5Proxy.logout()},hasSwitchAccount:function(){return this.h5Proxy.hasSwitchAccount},switchAccount:function(){return this.h5Proxy.switchAccount()},hasShowExitDialog:function(){return this.h5Proxy.hasExitDialog},showExitDialog:function(){this.h5Proxy.showExitDialog()},exitGame:function(){this.h5Proxy.exitGame()},submitData:function(n,t){console.log("submitData type:"+n);switch(n){case this.type.enterGame:commonH5Utils.getInstance().submitInfo("enter",t)}this.h5Proxy.submitData(n,t)},getParamValueByKey:function(n){return commonH5Utils.getInstance().sdkInfo[n]},expansionInterface:function(n,t,i){this.h5Proxy.expansionInterface(n,t,i)},statistics:function(n,t){var i={onStatisticsSuccess:function(){t.onStatisticsSuccess()},onStatisticsFail:function(){t.onStatisticsFail()}};commonH5Utils.getInstance().statistics(n,i)}};module{}.exports=window.commonH5SDK
\ No newline at end of file
var n=require("./commonMd5.js");export default class t{constructor(){this.checkConfigListener="";this.checkOrderListener="";this.statisticsListenerProxy="";this.location="";this.configInfoReturn;this.gzyasjhInfo={};this.configCheckUrl="https://static.public.sdk.guangkatf.com/config";this.sdkInfo={gameSimpleName:"",sdkSimpleName:"",sdkVersionCode:"",sdkClientVersion:"",loginCheckUrl:"",payOrderUrl:"",payCheckUrl:"",logReportUrl:"",statisticsUrl:"",channelParameter1:"",channelParameter2:"",channelId:"",custom:""};this.loginInfo={gameSimpleName:"",sdkSimpleName:"",sdkVersionCode:"",result:"",userType:"",openId:"",userName:"",sign:"",timestamp:"",other:"",serverSign:"",custom:"",custom2:"",di:"",nt:"",gv:"",ot:navigator.platform,imei:"",rl:"",c1:"",c2:""};this.payInfo={serverId:"",serverName:"",playerId:"",playerName:"",playerLevel:"",postAmount:"",productId:"",productName:"",productDesc:"",custom:"",exchange:"",otherInfo:"",timestamp:"",tsign:"",userId:"",di:"",nt:"",gv:"",ot:navigator.platform,imei:"",rl:"",c1:"",c2:"",coinName:"",coinNum:""};this.orderInfo={queryID:"",serverID:"",roleId:"",postTime:"",postAmount:"",productID:"",currency:"",other:"",products:"",danjiConfig:""};this.roleInfo={roleId:"",roleName:"",roleLevel:"",roleSex:"",serverId:"",serverName:"",roleCTime:"",partyName:"",roleType:"",roleChangeTime:"",vipLevel:"",diamond:"",moneyType:"",custom:""}}static getInstance(){return t.instance||(t.instance=new t),t.instance}connection(n,t,i){var u=this,r=new XMLHttpRequest,f,e;r.onreadystatechange=function(){if(r.readyState==4)if(r.status>=200&&r.status<300||r==304){u.sdkLog("H5SDKLog||"+n+"||Connect server successful:"+r.responseText);try{u.sdkLog(typeof r.responseText);u.responseListener(n,JSON.parse(r.responseText),r.status)}catch(t){u.sdkLog(t)}}else u.noResponse(n),u.sdkLog("H5SDKLog||"+n+"||Fail to connect server!");u.sdkLog("readyState: "+r.readyState)};n=="login"?(r.open("post",t,!1),f="data="+JSON.stringify(this.loginInfo),u.sdkLog("login url: "+t),u.sdkLog("login data: "+f),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(f)):n=="submitInfo"?(f=this.addUrlParam("",i),r.open("post",t,!1),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(f.substring(1))):n=="statistics"?(r.open("post",t,!1),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),f=JSON.stringify(i),r.send(f)):(n=="configInfo"?(t=t+"/"+this.sdkInfo.gameSimpleName+"/"+this.sdkInfo.sdkSimpleName+"/"+this.sdkInfo.sdkVersionCode+"/config.json",u.sdkLog("configInfo url:"+t)):n=="location"||(n=="payCheck"?(e=JSON.stringify(i),window.conch||(e=encodeURIComponent(e)),t=t+"/"+this.sdkInfo.gameSimpleName+"/"+this.sdkInfo.sdkSimpleName+"/"+this.sdkInfo.sdkVersionCode+"?data="+e):(t=t+"/"+this.sdkInfo.gameSimpleName+"/"+this.sdkInfo.sdkSimpleName+"/"+this.sdkInfo.sdkVersionCode,t=this.addUrlParam(t,i))),u.sdkLog(t),r.open("get",t,!1),r.send(null))}configCheck(n,t){typeof n=="string"&&(n=JSON.parse(n));for(var i in n)this.sdkInfo[i]=n[i],i==="otherInfo"&&this.setGzyasjhInfo(n[i]),this.sdkLog(this.sdkInfo[i]);this.checkConfigListener=t;this.sdkLog("H5SDKLog||Ask configCheck to server with sdkInfo:"+JSON.stringify(this.sdkInfo));this.connection("configInfo",this.configCheckUrl,this.sdkInfo)}loginCheck(n){for(var t in n)this.loginInfo[t]=n[t];this.loginInfo.sign=n.token;this.loginInfo.custom=commonH5SDK.h5Proxy.loginExt;this.loginInfo=this._addDataToTable(this.loginInfo);this.sdkLog("H5SDKLog||Ask loginCheck to server with loginInfo:"+JSON.stringify(this.loginInfo));this.connection("login",this.sdkInfo.loginCheckUrl,this.loginInfo)}payCheck(t,i){for(var r in t)this.payInfo[r]=t[r];t.openId!=undefined&&t.openId.length>0&&(this.payInfo.userId=t.openId);this.payInfo.tsign=n(this.payInfo.timestamp+"12*&#**@321");this.checkOrderListener=i;this.payInfo=this._addDataToTable(this.payInfo);this.sdkLog("H5SDKLog||Ask payCheck to server with payInfo:"+JSON.stringify(this.payInfo));this.connection("payCheck",this.sdkInfo.payOrderUrl,this.payInfo)}submitInfo(t,i){var f,e,u,r,s;if(i!=null)for(f in i)this.roleInfo[f]=i[f];e="";t.indexOf(":")!=-1&&(e=t.substring(t.indexOf(":")+1));u={pid:this.roleInfo.roleId,pn:this.roleInfo.roleName,sid:this.roleInfo.serverId,sn:this.roleInfo.serverName,lv:this.roleInfo.roleLevel,openId:this.loginInfo.openId,gameSimpleName:this.sdkInfo.gameSimpleName,sdkSimpleName:this.sdkInfo.sdkSimpleName,sdkVersionCode:this.sdkInfo.sdkVersionCode,di:"",nt:"",gv:"",ot:navigator.platform,imei:"",rl:"",c1:this.sdkInfo.channelParameter1,c2:this.sdkInfo.channelParameter2,eventName:e};u=this._addDataToTable(u);r=(new Date).getTime().toString();r=r.substring(0,r.length-3);this.sdkLog(JSON.stringify(u));var h="action="+t+"jssdk=yt="+r+"12909asdask23",o={action:t,data:JSON.stringify(u),jssdk:"y",t:r,ta:"default",test:"test",sign:n(h)};this.sdkLog("H5SDKLog||Submit to server with roleCheckInfo:"+JSON.stringify(o));s=this.sdkInfo.logReportUrl+"?ya_game="+this.sdkInfo.gameSimpleName+"&ya_sn="+this.sdkInfo.sdkSimpleName+"&ya_ssv="+this.sdkInfo.sdkVersionCode;this.connection("submitInfo",s,o)}statistics(n,t){this.statisticsListenerProxy=t;this.connection("statistics",this.sdkInfo.statisticsUrl,n)}addUrlParam(n,t){for(var i in t)n+=n.indexOf("?")==-1?"?":"&",n=n+i+"="+t[i];return n}responseListener(n,t,i){var f,u,e,r;if(n=="configInfo")t.code==1?(this.sdkInfo.payCheckUrl=t.data.payCheckUrl,this.sdkInfo.payOrderUrl=t.data.payOrderUrl,this.sdkInfo.loginCheckUrl=t.data.loginCheckUrl,this.sdkInfo.logReportUrl=t.data.logReportUrl,this.sdkInfo.channelParameter1=t.data.channelParameter1,this.sdkInfo.custom=t.data.custom,this.sdkInfo.channelId=t.data.channelSimpleName,this.loginInfo.c1=t.data.channelParameter1,this.payInfo.c1=t.data.channelParameter1,this.sdkInfo.channelParameter2=t.data.channelParameter2,this.loginInfo.c2=t.data.channelParameter2,this.payInfo.c2=t.data.channelParameter2,this.sdkLog("H5SDKLog||ConfigCheck successful with configInfo:"+JSON.parse(t.data.clientConfig)),this.configInfoReturn=JSON.parse(t.data.clientConfig),this.checkConfigListener.onCheckConfigSuccess()):(this.sdkLog("H5SDKLog||No configs!Please check whether the sdkInfo is matching or not!"),this.checkConfigListener.onCheckConfigFail());else if(n=="login")t.code==1?(this.sdkLog("H5SDKLog||LoginCheck successful with loginInfo:"+JSON.stringify(t)),this.loginInfo.openId=t.openId,this.payInfo.userId=t.openId,this.loginInfo.custom=commonH5SDK.h5Proxy.loginExt,t.custom=commonH5SDK.h5Proxy.loginExt,t.custom2=this.loginInfo.custom2,commonH5SDK.callback(commonH5SDK.code.LOGIN_SUCCESS,t)):(this.sdkLog("H5SDKLog||LoginCheck fail with message:"+t.message),commonH5SDK.callback(commonH5SDK.code.LOGIN_FAIL,"login error"));else if(n=="payCheck"){for(r in t)r=="code"?f=t[r]:r=="data"?u=t[r]:r=="message"&&(e=t[r]);if(this.sdkLog(f),this.sdkLog(u),this.sdkLog(e),f==1){this.sdkLog("H5SDKLog||PayCheck successful with orderInfo:"+JSON.stringify(u));this.checkOrderListener.onSuccess(u)}else this.sdkLog("H5SDKLog||PayCheck fail with message:"+e),this.checkOrderListener.onFail()}else n=="roleInfo"?this.sdkLog("H5SDKLog||Submit roleInfo result:"+t):n=="statistics"?i==200?(this.sdkLog("H5SDKLog||Statistics result:"+i),this.statisticsListenerProxy.onStatisticsSuccess()):(this.sdkLog("H5SDKLog||Statistics result:"+i),this.statisticsListenerProxy.onStatisticsFail()):n=="location"&&(t.code==0?(this.location=t.data,this.sdkLog("Location:"+t.data)):this.sdkLog("Location:Fail!"))}noResponse(n){n=="configInfo"?this.checkConfigListener.onCheckConfigFail():n=="login"?commonH5SDK.callback(commonH5SDK.code.LOGIN_FAIL,"login check network error"):n=="payCheck"?this.checkOrderListener.onFail():n=="roleInfo"||(n=="statistics"?this.statisticsListenerProxy.onStatisticsFail():n=="location"&&this.sdkLog("Location:Fail!"))}setGzyasjhInfo(n){if(n&&n.length>0){var t=JSON.parse(decodeURIComponent(n));t&&(this.gzyasjhInfo=t)}typeof this.gzyasjhInfo!="object"&&(this.gzyasjhInfo={})}_addDataToTable(n){if(typeof n=="object"){var t=navigator.platform;this.gzyasjhInfo.ot==null&&navigator.userAgent&&(t=t+"|"+JSON.stringify(this.allinfo()));n.di=this.gzyasjhInfo.di||"";n.nt=this.gzyasjhInfo.nt||"";n.gv=this.gzyasjhInfo.gv||"";n.ot=(this.gzyasjhInfo.ot||"")+"|"+t;n.imei=this.gzyasjhInfo.imei||"";n.rl=this.gzyasjhInfo.rl||""}return n}allinfo(){return{userAgent:(navigator.userAgent||"").replace(/[;/]/g," "),appName:navigator.appName||"",appVersion:(navigator.appVersion||"").replace(/[;/]/g," "),cookieEnabled:navigator.cookieEnabled||"",cpuClass:navigator.cpuClass||"",mimeType:navigator.mimeTypes||"",platform:navigator.platform||"",userLanguage:navigator.userLanguage||"",systemLanguage:navigator.systemLanguage||"",oscpu:navigator.oscpu||"",product:navigator.product||"",productSub:navigator.productSub||"",vender:navigator.vender||"",vendorSub:navigator.vendorSub||"",webkitPersistentStorage:navigator.webkitPersistentStorage||"",language:navigator.language||"",appCodeName:navigator.appCodeName||""}}getPayUrlCallBack(){return this.sdkInfo.payCheckUrl+"/"+this.sdkInfo.gameSimpleName+"/"+this.sdkInfo.sdkSimpleName+"/"+this.sdkInfo.sdkVersionCode}sdkLog(n){commonH5SDK.sdk_isShowLog&&console.log("commonH5SDK:"+n)}}
\ No newline at end of file
function common_md5(n){function a(n,t){return n<<t|n>>>32-t}function o(n,t){var f,e,r,u,i;return(r=n&2147483648,u=t&2147483648,f=n&1073741824,e=t&1073741824,i=(n&1073741823)+(t&1073741823),f&e)?i^2147483648^r^u:f|e?i&1073741824?i^3221225472^r^u:i^1073741824^r^u:i^r^u}function vt(n,t,i){return n&t|~n&i}function yt(n,t,i){return n&i|t&~i}function pt(n,t,i){return n^t^i}function wt(n,t,i){return t^(n|~i)}function s(n,t,i,r,u,f,e){return n=o(n,o(o(vt(t,i,r),u),e)),o(a(n,f),t)}function h(n,t,i,r,u,f,e){return n=o(n,o(o(yt(t,i,r),u),e)),o(a(n,f),t)}function c(n,t,i,r,u,f,e){return n=o(n,o(o(pt(t,i,r),u),e)),o(a(n,f),t)}function l(n,t,i,r,u,f,e){return n=o(n,o(o(wt(t,i,r),u),e)),o(a(n,f),t)}function bt(n){for(var r,u=n.length,o=u+8,s=(o-o%64)/64,e=(s+1)*16,i=Array(e-1),f=0,t=0;t<u;)r=(t-t%4)/4,f=t%4*8,i[r]=i[r]|n.charCodeAt(t)<<f,t++;return r=(t-t%4)/4,f=t%4*8,i[r]=i[r]|128<<f,i[e-2]=u<<3,i[e-1]=u>>>29,i}function v(n){for(var i="",r="",u,t=0;t<=3;t++)u=n>>>t*8&255,r="0"+u.toString(16),i=i+r.substr(r.length-2,2);return i}function kt(n){var i,r,t;for(n=n.replace(/\r\n/g,"\n"),i="",r=0;r<n.length;r++)t=n.charCodeAt(r),t<128?i+=String.fromCharCode(t):t>127&&t<2048?(i+=String.fromCharCode(t>>6|192),i+=String.fromCharCode(t&63|128)):(i+=String.fromCharCode(t>>12|224),i+=String.fromCharCode(t>>6&63|128),i+=String.fromCharCode(t&63|128));return i}var e=Array(),f,ht,ct,lt,at,t,i,r,u,y=7,p=12,w=17,b=22,k=5,d=9,g=14,nt=20,tt=4,it=11,rt=16,ut=23,ft=6,et=10,ot=15,st=21;for(n=kt(n),e=bt(n),t=1732584193,i=4023233417,r=2562383102,u=271733878,f=0;f<e.length;f+=16)ht=t,ct=i,lt=r,at=u,t=s(t,i,r,u,e[f+0],y,3614090360),u=s(u,t,i,r,e[f+1],p,3905402710),r=s(r,u,t,i,e[f+2],w,606105819),i=s(i,r,u,t,e[f+3],b,3250441966),t=s(t,i,r,u,e[f+4],y,4118548399),u=s(u,t,i,r,e[f+5],p,1200080426),r=s(r,u,t,i,e[f+6],w,2821735955),i=s(i,r,u,t,e[f+7],b,4249261313),t=s(t,i,r,u,e[f+8],y,1770035416),u=s(u,t,i,r,e[f+9],p,2336552879),r=s(r,u,t,i,e[f+10],w,4294925233),i=s(i,r,u,t,e[f+11],b,2304563134),t=s(t,i,r,u,e[f+12],y,1804603682),u=s(u,t,i,r,e[f+13],p,4254626195),r=s(r,u,t,i,e[f+14],w,2792965006),i=s(i,r,u,t,e[f+15],b,1236535329),t=h(t,i,r,u,e[f+1],k,4129170786),u=h(u,t,i,r,e[f+6],d,3225465664),r=h(r,u,t,i,e[f+11],g,643717713),i=h(i,r,u,t,e[f+0],nt,3921069994),t=h(t,i,r,u,e[f+5],k,3593408605),u=h(u,t,i,r,e[f+10],d,38016083),r=h(r,u,t,i,e[f+15],g,3634488961),i=h(i,r,u,t,e[f+4],nt,3889429448),t=h(t,i,r,u,e[f+9],k,568446438),u=h(u,t,i,r,e[f+14],d,3275163606),r=h(r,u,t,i,e[f+3],g,4107603335),i=h(i,r,u,t,e[f+8],nt,1163531501),t=h(t,i,r,u,e[f+13],k,2850285829),u=h(u,t,i,r,e[f+2],d,4243563512),r=h(r,u,t,i,e[f+7],g,1735328473),i=h(i,r,u,t,e[f+12],nt,2368359562),t=c(t,i,r,u,e[f+5],tt,4294588738),u=c(u,t,i,r,e[f+8],it,2272392833),r=c(r,u,t,i,e[f+11],rt,1839030562),i=c(i,r,u,t,e[f+14],ut,4259657740),t=c(t,i,r,u,e[f+1],tt,2763975236),u=c(u,t,i,r,e[f+4],it,1272893353),r=c(r,u,t,i,e[f+7],rt,4139469664),i=c(i,r,u,t,e[f+10],ut,3200236656),t=c(t,i,r,u,e[f+13],tt,681279174),u=c(u,t,i,r,e[f+0],it,3936430074),r=c(r,u,t,i,e[f+3],rt,3572445317),i=c(i,r,u,t,e[f+6],ut,76029189),t=c(t,i,r,u,e[f+9],tt,3654602809),u=c(u,t,i,r,e[f+12],it,3873151461),r=c(r,u,t,i,e[f+15],rt,530742520),i=c(i,r,u,t,e[f+2],ut,3299628645),t=l(t,i,r,u,e[f+0],ft,4096336452),u=l(u,t,i,r,e[f+7],et,1126891415),r=l(r,u,t,i,e[f+14],ot,2878612391),i=l(i,r,u,t,e[f+5],st,4237533241),t=l(t,i,r,u,e[f+12],ft,1700485571),u=l(u,t,i,r,e[f+3],et,2399980690),r=l(r,u,t,i,e[f+10],ot,4293915773),i=l(i,r,u,t,e[f+1],st,2240044497),t=l(t,i,r,u,e[f+8],ft,1873313359),u=l(u,t,i,r,e[f+15],et,4264355552),r=l(r,u,t,i,e[f+6],ot,2734768916),i=l(i,r,u,t,e[f+13],st,1309151649),t=l(t,i,r,u,e[f+4],ft,4149444226),u=l(u,t,i,r,e[f+11],et,3174756917),r=l(r,u,t,i,e[f+2],ot,718787259),i=l(i,r,u,t,e[f+9],st,3951481745),t=o(t,ht),i=o(i,ct),r=o(r,lt),u=o(u,at);return(v(t)+v(i)+v(r)+v(u)).toLowerCase()}module.exports=common_md5
\ No newline at end of file
function wxNetworkRequest(n,t,i,r){wx.request({url:"https://sdk.xizhai2021.com"+n,data:t,header:{"content-type":r},method:"POST",success(n){console.log(n.data);i&&i(1,n.data)},fail(n){console.log(n);i&&i(0,"network request error")}})}function loginDataHandler(n,t){var u=n;if(u.code==0){var i=u.msg,f=i.open_id,e=i.login_key,s=i.token,h=i.pay_channel_id,r=i.wechat,o=r.openid,c=r.unionid,l=r.session_key,a=i.share_str,v=i.share_pic,y=i.timestamp;try{wx.setStorageSync("common_sdkOpenId",f+"");wx.setStorageSync("common_wxOpenId",o);wx.setStorageSync("common_wxUnionid",c);wx.setStorageSync("common_sdkLoginKey",e);wx.setStorageSync("common_sdkPayChannelId",h);wx.setStorageSync("common_wxSessionKey",l);wx.setStorageSync("common_wxShareTitle",a);wx.setStorageSync("common_wxShareImage",v)}catch(p){}t(1,{openId:f,loginKey:e,token:s,wxOpenId:o,timestamp:y})}else console.log("loginResult:",n),t(0,"server callback error")}function commonSdkLogin(n,t){console.log("commonSdkLogin1111");wx.setStorageSync("common_sdkAppId",n);console.log("commonSdkLogin");wx.login({success(i){if(i.code){var r="code="+i.code+"&app_id="+n;wxNetworkRequest("/sdk/login?format=json&type=7&mk=",r,function(n,i){n==1?loginDataHandler(i,t):t(0,"login fail")},"application/x-www-form-urlencoded")}else t&&t(0,i.errMsg)}})}function wxMenuShareInit(n){wxMenuShareInit2(wx.getStorageSync("common_wxShareTitle"),wx.getStorageSync("common_wxShareImage"),n)}function wxMenuShareInit2(n,t,i){wx.showShareMenu({withShareTicket:!0});wx.onShareAppMessage(function(){return{title:n,imageUrl:t,query:i}})}function wxSdkShareContent(n){wxSdkShareContent2(wx.getStorageSync("common_wxShareTitle"),wx.getStorageSync("common_wxShareImage"),n)}function wxSdkShareContent2(n,t,i){wx.shareAppMessage({title:n,imageUrl:t,query:i})}function wxMenuShareTimelineInit(n){wxMenuShareTimelineInit2(wx.getStorageSync("common_wxShareTitle"),wx.getStorageSync("common_wxShareImage"),n)}function wxMenuShareTimelineInit2(n,t,i){wx.showShareMenu({withShareTicket:!0});wx.onShareTimeline(function(){return{title:n,imageUrl:t,query:i}})}function wxUserCloudStorage(n,t){var i={wxgame:{score:parseInt(t),update_time:Date.parse(new Date)/1e3}},r={key:n,value:JSON.stringify(i)};wx.setUserCloudStorage({KVDataList:[r]})}function sdkConfirmOrderRequest(){}function sdkCreateOrderRequest(n,t){var i="role_name="+n.roleName;i+="&encode=0";i+="&login_key="+wx.getStorageSync("common_sdkLoginKey");i+="&pay_channel_id="+wx.getStorageSync("common_sdkPayChannelId");i+="&productid="+n.productId;i+="&money="+n.amount;i+="&open_id="+wx.getStorageSync("common_sdkOpenId");i+="&role_id="+n.roleId;i+="&callback="+n.orderId;i+="&game_amount="+n.exchage*n.amount;i+="&serverid="+n.serverId;i+="&app_id="+wx.getStorageSync("common_sdkAppId");i+="&wx_open_id="+wx.getStorageSync("common_wxOpenId");wxNetworkRequest("/sdk/pay?format=json",i,t,"application/x-www-form-urlencoded")}function wxSdkPay(n){sdkCreateOrderRequest(n,function(n,t){console.log("create order result:"+t)})}module{}.exports={login:commonSdkLogin,menuShareInit:wxMenuShareInit,menuShareInit2:wxMenuShareInit2,sdkShareContent:wxSdkShareContent,menuShareTimeline:wxMenuShareTimelineInit,menuShareTimeline2:wxMenuShareTimelineInit2,sdkUserCloudStorage:wxUserCloudStorage,sdkPay:wxSdkPay}
\ No newline at end of file
# **公共SDK-小游戏接入文档** #
>版本:**1.5.3**
>
>最后修改:**2020年12月17日**
## **一、接入准备** ##
游戏页面引入公共SDK相关JS文件(复制sdk下的所有js文件到游戏工程)
let commonH5SDK = require('./commonH5SDK.js')
## **二、JS接口(对接可参考demo.js中的例子)** ##
1. **初始化SDK(必接)**
//设置公共sdk回调方法
/**
code: {
INIT_SUCCESS: 1,
INIT_FAIL: -1,
LOGIN_SUCCESS: 10,
LOGIN_FAIL: -10,
LOGOUT_SUCCESS: 100,
LOGOUT_FAIL: -100,
SWITCH_SUCCESS: 1000,
SWITCH_FAIL: -1000,
PAY_SUCCESS: 2,//充值以服务端回调结果为准
PAY_FAIL: -2,
PAY_CANCEL:-3,//支付取消
EXIT_SUCCESS: 4,//退出成功
EXIT_CANCEL: -4//取消退出
}
@param {*} code commonH5SDK.code中对应值
@param {*} msg
*/
callback: function (code, msg) {
console.log(code, msg);
switch (code) {
case commonH5SDK.code.INIT_SUCCESS://初始化成功 msg为描述
console.log("game init success")
break;
case commonH5SDK.code.LOGIN_SUCCESS://登录成功
/**
*custom: "test"//透传参数
*openId: "x1111dc104b800724d112195b61e1ff5"
*serverSign: "ccb0488a46be85b9fc1b5bd55b532376"//签名校验sign
*timestamp: "1554174508038"
**/
console.log("game login success");
console.log("openId:" + msg.openId + "custom:" + msg.custom + "serverSign:" + msg.serverSign + "timestamp:" + msg.timestamp);
break;
case commonH5SDK.code.LOGOUT_SUCCESS:
console.log("game logout success")
break;
case commonH5SDK.code.SWITCH_SUCCESS:
console.log("game switch account success")
break;
case commonH5SDK.code.PAY_SUCCESS://不一定有回调,看渠道通知,以服务端通知为准
console.log("game pay success")
break;
case commonH5SDK.code.EXIT_SUCCESS:
//游戏处理退出逻辑
break;
}
},
//参数找运营获取
var sdkInfo = {
"gameSimpleName": "fytx_test",//游戏简称
"sdkSimpleName": "huoshu_wx",//sdk简称
"sdkVersionCode": "V1_0",//sdk服务端版本号
"sdkClientVersion": "1.0"//sdk客户端版本号
}
commonH5SDK.init(sdkInfo,this.callback);
2. **账号登录**
var param = "test";//透传参数
//启用账号登录接口
commonH5SDK.login(param);
3. **注销账号/切换账号(小游戏不用接)**
//注销接口
if(commonH5SDK.hasLogout()){//判断是否存在注销接口
commonH5SDK.logout();
}
//切换账号接口
if(commonH5SDK.hasSwitchAccount()){//判断是否存在切换账号接口
commonH5SDK.switchAccount();
}
例子:
/**
* commonH5SDK.hasLogout()
* commonH5SDK.hasSwitchAccount()
* 游戏可以根据上面两个接口判断是否提供切换账号接口
*/
switchAccount: function () {
if (commonH5SDK.hasLogout()) {//存在注销接口,注销后会回调到初始化接口的注销类型的回调中
commonH5SDK.logout();
}else if (commonH5SDK.hasSwitchAccount()) {//存在切换账号接口,切换账号成功后会回调到初始化接口中的切换账号类型回调中
console.log("end switch account");
commonH5SDK.switchAccount();
}else{//不存在切换账号接口,游戏自己处理
}
}
4. **提交数据信息**
- 注:进入游戏类型为必接接口
在游戏中对应点根据不同的type进行调用
/**
* commonH5SDK.type中对应类型值
type: {
arriveServerSelectPage: 1, //到达选服页面
createRole: 2, //创建角色时调用
enterGame: 3, //进入游戏时调用
upRoleLevel: 4, //角色升级日志
arriveEntrance: 5, //首屏日志
enterServer: 6, //选服完成,点击进入对应服时
arriveFirstScene: 7, //到达游戏内第一场景时调用
arriveLoadingFinish: 8, //资源加载完成
arriveLoadingZero: 9, //刚开始加载资源类型
arriveCreateRolePage: 10, //到达创建角色页面
newcomerFinish:11, //新手完成上报
checkpointStart:12,//关卡开始
checkpointEnd:13,//关卡结束
selectRole:14,//选角色
renameRole:15,//角色改名
newcomerStart:16//新手开始
}
*/
var submitType = commonH5SDK.type.enterGame;//进入游戏
//设置角色信息
var roleInfo = {
"roleId": "角色ID",
"roleName": "角色名称",
"roleLevel": "角色等级",
"roleSex": "角色性别 1:男 0:女",
"serverId": "服务器ID",
"serverName": "服务器名称",
"roleCTime": "角色创建时间",
"partyName": "工会名字",
"roleType": "角色类型",
"roleChangeTime": "角色更新时间",
"vipLevel": "VIP等级",
"diamond": "角色金币数量",
"moneyType": "商品单位",
"custom": "微信小游戏分享的query参数,与扩展接口的分享时data一致",
"isNew":"新创建角色第一次登录进游戏为1,其他为0",
"score":"战力",
"isFinishNewComer":"是否已完成新手,0否1是",
"roleLevelReborn":"转生等级,没有传0",
"partyId":"工会id(请用数字,如无请传"0")",
"checkPointId":"关卡id(请用数字,如无请传"0")",
"checkPointName":"关卡名(没有的传 "无")",
"checkPointResult":"关卡结果,1中途退出2胜利3失败4打平",
"professionId":"职业id(请用数字,如无请传"0")",
"professionName":"职业名称(没有的传 "无")"
};
//以上信息中,游戏如没有传空值即可
//启用提交信息接口
commonH5SDK.submitData(submitType, roleInfo);
5. **支付**
//设置订单参数
var payInfo = {
"serverId": "服务器ID",
"serverName": "服务器名字",
"playerId": "角色ID",
"openId":"渠道用户ID",
"playerName": "角色名字",
"playerLevel": "角色等级",
"postAmount": "金额",
"productId": "商品ID",
"productName": "商品名称",
"productDesc": "商品描述",
"custom": "自定义透传参数",
"exchange": "游戏币与人民币(元)的兑换比例",
"otherInfo": "额外信息",
"timestamp": "时间戳",
"payType":"1:好友代付,0:正常支付(自己付款)"
};
//以上信息中,游戏如没有传空值即可
//启用支付接口
commonH5SDK.pay(payInfo);
6. **退出游戏**
if(commonH5SDK.hasShowExitDialog()){//渠道含有退出框,游戏在回调中处理退出逻辑
commonH5SDK.showExitDialog();
}else{
//游戏自己处理退出逻辑后调用exitGame()接口
commonH5SDK.exitGame();
}
7. **获取公共层参数接口**
说明:本接口通过键获取对应的参数值,需要在初始化成功后才能调用
/**
获取公共层参数
@param {string} key
*/
getParamValueByKey:function (key)
例子:
commonH5SDK.getParamValueByKey("custom");//获取公共后台的自定义参数
commonH5SDK.getParamValueByKey("channelParameter1");//渠道标识1
commonH5SDK.getParamValueByKey("channelParameter2");//渠道标识2
commonH5SDK.getParamValueByKey("channelId");//渠道号
8. **扩展接口(游戏可根据渠道要求看是否接入)**
/**
扩展接口
@param {*} type 扩展类型
/**
* data参数传递
* type为msgSecCheck时传检验内容(eg:"内容")
* type:realVerify/realNameVerify时传递身份证信息(eg:{id:"身份证号",name:"姓名"})
* type:share时传递的是平台api收到的query参数(内容格式必须是 eg:'key1=value1&key2=value2')
* type:mulShare时data例子:
* {
* type:0,//分享类型 0:普通分享 1:朋友圈分享
* data:"key1=value1&key2=value2"//平台api收到的getLaunchOptionsSync.query参数(内容格式必须是 eg:'key1=value1&key2=value2')
* }
* type:showAd时数据例子:
{
type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告
style:{//type等于2时需要传style其它类型可不传
left:0,//banner左上角横坐标位置
top:0,//banner左上角纵坐标位置
width:0,//宽度
height:0//高度
}
}
* type:bindPhone时数据
{
type:1,//0:为获取验证码 1:为绑定操作
phone:"18xxxxx",//手机号
smsCode:"058961"//验证码
}
* type:getUserInfo时传按钮样式(eg:{
type: 'text',
text: '授权',
style: {
left: 10,
top: 76,
width: 200,
height: 40,
lineHeight: 40,
backgroundColor: '#ff0000',
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
borderRadius: 4
}
})
* 其他暂传空
*/
@param {*} data 传递数据
@param {*} callback 回调方法
*/
expansionInterface: function (type, data, callback);
字段说明:
/**
* 传公共sdk扩展类型
* {
gameSetting: 100, //功能设置
downloadMicroClent: 101, //下载微端
share: 102, //分享 data:"key1=value1&key2=value2"//平台api收到的getLaunchOptionsSync.query参数(内容格式必须是 eg:'key1=value1&key2=value2')
focus: 103, //关注
save2Desktop: 104, //保存到桌面
realVerify: 105, //实名认证(已弃用)
back2Game: 106, //返回游戏
bindPhone: 107, //绑定手机有奖接口
{
type:1,//0:为获取验证码 1:为绑定操作
phone:"18xxxxx",//手机号
smsCode:"058961"//验证码
}
msgSecCheck: 108, //违规内容判断接口 data为验证的数据内容
checkBalance: 109, //查询余额
showAd: 110, //广告类型
score: 111,//评分
kefu: 112,//客服接口
queryProductsInfo: 113,//根据sku(商品ID)查询商品信息
userCenter: 114,//用户中心
eventTrack: 115, //事件上报
realNameVerify: 116, //新实名认证
mulShare:117, //分享功能(适应不同类型的分享功能)
118,//蓝钻查询
119,//蓝钻购买接口
120,//查询永久订阅状态
121,//调用永久订阅接口
122,//获取玩家首次进入游戏的场景值
123//消息订阅接口
}
*/
var expansion_type = commonH5SDK.expansion_type.gameSetting;//功能设置
/**
* {
code:0,//0:成功 其他为失败
message:"success",//返回结果描述
data:{//功能设置返回,其他接口暂时不返回data数据
has_micro_client: 0,//是否有微端 0:没有,1:有,2已经在微端中
is_share: 0,//是否有分享接口 0:没有,1:有
is_focus: 0,//是否有关注 0:没,1:有,2:已经关注
is_apple_pay: 0,//是否开启苹果支付 0:不开启 1:开启
is_open_pay: 1,//1开启充值入口,其他为关闭充值入口 默认开启
is_desktop: 0,//是否有保存桌面 0:没有 1:有
is_switch_account: 0,//是否有切换账号 0:没有 1有
is_realverify: 0,//是否有实名认证 0:没有 1:有 2:已认证
is_real_name_verify:-1,//是否有实名认证接口 -1:不存在实名功能(cp和渠道协商) 0:没有界面接口渠道内部有实名功能,1:有界面接口 2:已认证
birthday:"",//用户实名生日20200101(进行左移两位加密操作) is_real_name_verify为2时才有数据
is_super_kefu: 0,//是否有超级客服 0:没 1:有
is_backtogame: 0,//是否有返回按钮 0:没有,1:有
is_lock: 0,//是否竖屏 0:研发默认样式 1:强制竖屏
is_focus_gift: 0,//关注有礼 0:关闭 1:开启
is_bindphone: 0,//绑定手机 0:关闭 1:开启 2:已绑定手机
is_msgseccheck: 0, //违规内容判断接口 0:没有,1:有
is_checkbalance: 0,//是否有查询 0:没有,1:有
is_showad: 0,//是否有广告接口 0:没有,1:有
is_usercenter: 0,//是否有用户中心接口 0:没有 1:有
is_kefu: 0,//是否有客服 0:没有,1:有(调用对应的客服类型接口(kefu))
is_score: 0,//是否有评分接口 0:没有,1:有(调用对应的评分类型接口(score))
is_query_products_info: 0,//是否有查询商品信息接口 0,没有 1:有(调用对应的查询商品信息接口(queryProductsInfo))
is_event_track: 0,// 0:没有 1:有 是否有事件上报接口
is_blue_vip_function:0,//0:没有蓝钻功能 1:有蓝钻功能 (此状态配合蓝钻查询和蓝钻购买)
is_subscribe_whats_new:0,//0:没有游戏更新订阅接口 1:有游戏更新订阅
msg_subscribe_code:0,//0:没有消息订阅接口,1:表示有消息订阅接口 2:表示已经订阅
is_get_scene_interface:0//是否有获取首次进入游戏场景值接口,0:没有 1:有
}
data:{//余额类型返回数据 code为失败时此字段不返回
balance:0//余额
}
data:{//广告类型返回数据 code为失败时此字段不返回
isFinishTask:1//等于1时为广告任务完成,其他为任务未完成
}
}
* @param {*} result
*/
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(expansion_type,data,expansionCallBack);
8.1. **扩展接口(商品信息查询(目前用于海外渠道显示商场))**
/**
扩展接口
@param {*} type commonH5SDK.expansion_type.queryProductsInfo
@param {*} data "productId1,productId2" //传入要查询的商品ID字符串,多个之前用逗号隔开
@param {*} callback 回调方法
*/
expansionInterface: function (type, data, callback);
示例:
/**
* {
code:0,//0:成功 其他为失败
message:"success",//返回描述
data:{//查询商品信息返回数据(queryProductsInfo)
"android.test.purchased0": {//key为商品ID
"displayPrice": "₩1167.28",//显示价格
"price": "₩1,167", //实际价格(去除小数点) 充值传递
"priceAmountMicros": 1167284249, //数字价格
"priceCurrencyCode": "KRW", //货币代码
"sku": "android.test.purchased0",//商品ID
"title": "名称示例"
},
"android.test.purchased1": {
"displayPrice": "₩1167.28",
"price": "₩1,167",
"priceAmountMicros": 1167284249,
"priceCurrencyCode": "KRW",
"sku": "android.test.purchased1",
"title": "名称示例"
}
}
}
* @param {*} result
*/
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(commonH5SDK.expansion_type.queryProductsInfo,"test1,test2,test3",expansionCallBack);
8.3. **扩展接口(实名认证)**
/**
扩展接口(根据gameSetting中获取字段is_real_name_verify为有接口时调用)
@param {*} type commonH5SDK.expansion_type.realNameVerify
@param {*} data 当需要游戏自定义页面时传递{id:"身份证号",name:"姓名"},其他传""
@param {*} callback 回调方法
{
code:0,//0成功,其他失败
message:"",//空值不做处理
data:"20190101"//(游戏将获取到的密文右移两位 eg:19900101 >> 2)
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(commonH5SDK.expansion_type.realNameVerify,{id:"身份证号",name:"姓名"},expansionCallBack);
8.4. **扩展接口(蓝钻查询)**
/**
扩展接口 (根据gameSetting中获取字段is_blue_vip_function为有接口时调用)
@param {*} type 游戏直接传入int值118
@param {*} data 传""
@param {*} callback 回调方法
{
code:0,//0成功,其他失败
message:"success",//空值不做处理
data:{
"is_blue_vip": 0, //是否蓝钻, 1表示是,0表示不是
"server_time": 1605250960,//服务器时间,用于比较蓝钻开通时间和到期时间,unix时间戳,单位为秒
"is_blue_year_vip": 0,//是否年费蓝钻;1表示是,0表示不是
"seq": 0,
"expand_vip_reg_time": 0,//超级蓝钻开通时间,unix时间戳,单位为秒
"year_vip_reg_time": 0,//年费蓝钻开通时间,unix时间戳,单位为秒
"super_vip_reg_time": 0,//豪华蓝钻开通时间,unix时间戳,单位为秒
"vip_reg_time": 0,//蓝钻开通时间,unix时间戳,单位为秒
"ret": 0,
"uin": 0,
"pf": "qqgame",
"is_super_blue_vip": 0,//是否豪华蓝钻;1表示是,0表示不是
"is_have_growth": 0,//蓝钻是否具备成长值,1表示是,0表示不是
"msg": "",
"is_expand_blue_vip": 0,//是否超级蓝钻;1表示是,0表示不是
"blue_vip_level": 0,//蓝钻等级
"is_mobile_blue_vip": 0,//是否手机蓝钻;1表示是,0表示不是
"vip_valid_time": 0,//蓝钻到期时间,unix时间戳,单位为秒
"super_vip_valid_time": 0,//豪华蓝钻到期时间,unix时间戳,单位为秒
"expand_vip_valid_time": 0,//超级蓝钻到期时间,unix时间戳,单位为秒
"year_vip_valid_time": 0 //年费蓝钻到期时间,unix时间戳,单位为秒
}
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(118,"",expansionCallBack);
8.5. **扩展接口(蓝钻购买)**
/**
扩展接口 (根据gameSetting中获取字段is_blue_vip_function为有接口时调用)
@param {*} type 游戏直接传入int值119
@param {*} data 传""
@param {*} callback 此接口不会有结果回调
*/
expansionInterface: function (type, data, callback);
示例:
commonH5SDK.expansionInterface(119,"","");
8.6. **扩展接口(游戏更新提醒订阅查询)**
/**
扩展接口 (根据gameSetting中获取字段is_subscribe_whats_new为有接口时调用)
@param {*} type 游戏直接传入int值120
@param {*} data 传""
@param {*} callback
{
code:0,//0:表示用于已订阅,其他未订阅
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(120,"",expansionCallBack);
8.7. **扩展接口(游戏更新提醒订阅)**
/**
扩展接口 (根据gameSetting中获取字段is_subscribe_whats_new为有接口时调用)
@param {*} type 游戏直接传入int值121
@param {*} data 传""
@param {*} callback
{
code:0,//0:表示订阅成功,其他未订阅
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(121,"",expansionCallBack);
8.8. **扩展接口(分享接口)**
/**
扩展接口 (根据gameSetting中获取字段is_share为有接口时调用)
@param {*} type 游戏直接传入int值117
@param {*} data
{
type:0,//分享类型 0:普通分享 1:朋友圈分享
data:"key1=value1&key2=value2"
}
@param {*} callback(`分享不一定会返回`)
{
code:0,//0:分享成功 其他未分享失败
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
commonH5SDK.expansionInterface(117,"",expansionCallBack);
8.9. **扩展接口(绑定手机)**
/**
扩展接口 (根据gameSetting中获取字段is_bindphone为有接口时调用)
@param {*} type 游戏直接传入int值107
@param {*} data
{
type:1,//0:为获取验证码 1:为绑定操作
phone:"18xxxxx",//手机号
smsCode:"058961"//验证码 获取验证码时传""
}
@param {*} callback
{
code:0,//0:成功 其他失败
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
var data = {
type:1,//0:为获取验证码 1:为绑定操作
phone:"18xxxxx",//手机号
smsCode:"058961"//验证码 获取验证码时传""
}
commonH5SDK.expansionInterface(107,data,expansionCallBack);
8.10. **扩展接口(广告接口)**
/**
扩展接口 (根据gameSetting中获取字段is_showad为有接口时调用)
@param {*} type 游戏直接传入int值110
@param {*} data
{
type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告
style:{//type等于2时需要传style其它类型可不传
left:0,//banner左上角横坐标位置
top:0,//banner左上角纵坐标位置
width:0,//宽度
height:0//高度
}
}
@param {*} callback
{
code:0,//0:成功 其他失败
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
}
var data = {
type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告
style:{//type等于2时需要传style其它类型可不传
left:0,//banner左上角横坐标位置
top:0,//banner左上角纵坐标位置
width:0,//宽度
height:0//高度
}
}
commonH5SDK.expansionInterface(110,data,expansionCallBack);
8.11. **扩展接口(获取玩家首次进入游戏场景值接口)**
/**
扩展接口 (根据gameSetting中获取字段is_get_scene_interface为1时有此接口调用)
@param {*} type 游戏直接传入int值122
@param {*} data 传""
@param {*} callback
{
code:0,
message:"",
data:{
first_scene:"玩家首次进入的场景值",
current_scene:"玩家当次进入的场景值"
}
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
//result.code 0:时订阅成功,其他未失败
}
commonH5SDK.expansionInterface(122,"",expansionCallBack);
8.12. **扩展接口(消息订阅接口)**
/**
扩展接口 (根据gameSetting中获取字段msg_subscribe_code为1时有此接口调用)
@param {*} type 游戏直接传入int值123
@param {*} data 传""
@param {*} callback
{
code:0,//0:成功 其他失败
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
//result.code 0:时订阅成功,其他未失败
}
commonH5SDK.expansionInterface(123,"",expansionCallBack);
8.13. **扩展接口(添加桌面快捷键)**
/**
扩展接口 (根据gameSetting中获取字段is_desktop为1时有此接口调用)
@param {*} type 游戏直接传入int值104
@param {*} data 传""
@param {*} callback
{
code:0,//0:成功 其他失败
message:"success" //返回消息
}
*/
expansionInterface: function (type, data, callback);
示例:
var expansionCallBack = function(result){
//result.code 0:添加成功,添加失败
}
commonH5SDK.expansionInterface(104,"",expansionCallBack);
\ No newline at end of file
http://gitlab.9133.com:10080/sdk_9133/sdk_public_android/edit/master/doc/%E5%85%AC%E5%85%B1SDK%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3.md
\ No newline at end of file