Showing
14 changed files
with
666 additions
and
0 deletions
.DS_Store
deleted
100644 → 0
No preview for this file type
File moved
File moved
game_Simulate.js
→
H5/game_Simulate.js
100755 → 100644
File mode changed
File moved
No preview for this file type
wegame/libs/commonBaseProxy.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/libs/commonH5Proxy.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/libs/commonH5SDK.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/libs/commonH5Utils.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/libs/commonMd5.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/libs/wxgame_sdk.js
0 → 100644
1 | +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 | ... | \ No newline at end of file |
wegame/光卡公共平台小游戏接入文档.md
0 → 100644
1 | +# **公共SDK-小游戏接入文档** # | ||
2 | + | ||
3 | +>版本:**1.5.3** | ||
4 | +> | ||
5 | +>最后修改:**2020年12月17日** | ||
6 | + | ||
7 | +## **一、接入准备** ## | ||
8 | + | ||
9 | +游戏页面引入公共SDK相关JS文件(复制sdk下的所有js文件到游戏工程) | ||
10 | + | ||
11 | + let commonH5SDK = require('./commonH5SDK.js') | ||
12 | + | ||
13 | +## **二、JS接口(对接可参考demo.js中的例子)** ## | ||
14 | + | ||
15 | +1. **初始化SDK(必接)** | ||
16 | + | ||
17 | + //设置公共sdk回调方法 | ||
18 | + /** | ||
19 | + code: { | ||
20 | + INIT_SUCCESS: 1, | ||
21 | + INIT_FAIL: -1, | ||
22 | + LOGIN_SUCCESS: 10, | ||
23 | + LOGIN_FAIL: -10, | ||
24 | + LOGOUT_SUCCESS: 100, | ||
25 | + LOGOUT_FAIL: -100, | ||
26 | + SWITCH_SUCCESS: 1000, | ||
27 | + SWITCH_FAIL: -1000, | ||
28 | + PAY_SUCCESS: 2,//充值以服务端回调结果为准 | ||
29 | + PAY_FAIL: -2, | ||
30 | + PAY_CANCEL:-3,//支付取消 | ||
31 | + EXIT_SUCCESS: 4,//退出成功 | ||
32 | + EXIT_CANCEL: -4//取消退出 | ||
33 | + } | ||
34 | + @param {*} code commonH5SDK.code中对应值 | ||
35 | + @param {*} msg | ||
36 | + */ | ||
37 | + callback: function (code, msg) { | ||
38 | + console.log(code, msg); | ||
39 | + switch (code) { | ||
40 | + case commonH5SDK.code.INIT_SUCCESS://初始化成功 msg为描述 | ||
41 | + console.log("game init success") | ||
42 | + break; | ||
43 | + case commonH5SDK.code.LOGIN_SUCCESS://登录成功 | ||
44 | + /** | ||
45 | + *custom: "test"//透传参数 | ||
46 | + *openId: "x1111dc104b800724d112195b61e1ff5" | ||
47 | + *serverSign: "ccb0488a46be85b9fc1b5bd55b532376"//签名校验sign | ||
48 | + *timestamp: "1554174508038" | ||
49 | + **/ | ||
50 | + console.log("game login success"); | ||
51 | + console.log("openId:" + msg.openId + "custom:" + msg.custom + "serverSign:" + msg.serverSign + "timestamp:" + msg.timestamp); | ||
52 | + break; | ||
53 | + case commonH5SDK.code.LOGOUT_SUCCESS: | ||
54 | + console.log("game logout success") | ||
55 | + break; | ||
56 | + case commonH5SDK.code.SWITCH_SUCCESS: | ||
57 | + console.log("game switch account success") | ||
58 | + break; | ||
59 | + case commonH5SDK.code.PAY_SUCCESS://不一定有回调,看渠道通知,以服务端通知为准 | ||
60 | + console.log("game pay success") | ||
61 | + break; | ||
62 | + case commonH5SDK.code.EXIT_SUCCESS: | ||
63 | + //游戏处理退出逻辑 | ||
64 | + break; | ||
65 | + } | ||
66 | + }, | ||
67 | + //参数找运营获取 | ||
68 | + var sdkInfo = { | ||
69 | + "gameSimpleName": "fytx_test",//游戏简称 | ||
70 | + "sdkSimpleName": "huoshu_wx",//sdk简称 | ||
71 | + "sdkVersionCode": "V1_0",//sdk服务端版本号 | ||
72 | + "sdkClientVersion": "1.0"//sdk客户端版本号 | ||
73 | + } | ||
74 | + commonH5SDK.init(sdkInfo,this.callback); | ||
75 | + | ||
76 | +2. **账号登录** | ||
77 | + | ||
78 | + var param = "test";//透传参数 | ||
79 | + //启用账号登录接口 | ||
80 | + commonH5SDK.login(param); | ||
81 | + | ||
82 | +3. **注销账号/切换账号(小游戏不用接)** | ||
83 | + | ||
84 | + //注销接口 | ||
85 | + if(commonH5SDK.hasLogout()){//判断是否存在注销接口 | ||
86 | + commonH5SDK.logout(); | ||
87 | + } | ||
88 | + //切换账号接口 | ||
89 | + if(commonH5SDK.hasSwitchAccount()){//判断是否存在切换账号接口 | ||
90 | + commonH5SDK.switchAccount(); | ||
91 | + } | ||
92 | + | ||
93 | + 例子: | ||
94 | + /** | ||
95 | + * commonH5SDK.hasLogout() | ||
96 | + * commonH5SDK.hasSwitchAccount() | ||
97 | + * 游戏可以根据上面两个接口判断是否提供切换账号接口 | ||
98 | + */ | ||
99 | + switchAccount: function () { | ||
100 | + if (commonH5SDK.hasLogout()) {//存在注销接口,注销后会回调到初始化接口的注销类型的回调中 | ||
101 | + commonH5SDK.logout(); | ||
102 | + }else if (commonH5SDK.hasSwitchAccount()) {//存在切换账号接口,切换账号成功后会回调到初始化接口中的切换账号类型回调中 | ||
103 | + console.log("end switch account"); | ||
104 | + commonH5SDK.switchAccount(); | ||
105 | + }else{//不存在切换账号接口,游戏自己处理 | ||
106 | + | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | +4. **提交数据信息** | ||
111 | + | ||
112 | + - 注:进入游戏类型为必接接口 | ||
113 | + 在游戏中对应点根据不同的type进行调用 | ||
114 | + /** | ||
115 | + * commonH5SDK.type中对应类型值 | ||
116 | + type: { | ||
117 | + arriveServerSelectPage: 1, //到达选服页面 | ||
118 | + createRole: 2, //创建角色时调用 | ||
119 | + enterGame: 3, //进入游戏时调用 | ||
120 | + upRoleLevel: 4, //角色升级日志 | ||
121 | + arriveEntrance: 5, //首屏日志 | ||
122 | + enterServer: 6, //选服完成,点击进入对应服时 | ||
123 | + arriveFirstScene: 7, //到达游戏内第一场景时调用 | ||
124 | + arriveLoadingFinish: 8, //资源加载完成 | ||
125 | + arriveLoadingZero: 9, //刚开始加载资源类型 | ||
126 | + arriveCreateRolePage: 10, //到达创建角色页面 | ||
127 | + newcomerFinish:11, //新手完成上报 | ||
128 | + checkpointStart:12,//关卡开始 | ||
129 | + checkpointEnd:13,//关卡结束 | ||
130 | + selectRole:14,//选角色 | ||
131 | + renameRole:15,//角色改名 | ||
132 | + newcomerStart:16//新手开始 | ||
133 | + } | ||
134 | + */ | ||
135 | + var submitType = commonH5SDK.type.enterGame;//进入游戏 | ||
136 | + //设置角色信息 | ||
137 | + var roleInfo = { | ||
138 | + "roleId": "角色ID", | ||
139 | + "roleName": "角色名称", | ||
140 | + "roleLevel": "角色等级", | ||
141 | + "roleSex": "角色性别 1:男 0:女", | ||
142 | + "serverId": "服务器ID", | ||
143 | + "serverName": "服务器名称", | ||
144 | + "roleCTime": "角色创建时间", | ||
145 | + "partyName": "工会名字", | ||
146 | + "roleType": "角色类型", | ||
147 | + "roleChangeTime": "角色更新时间", | ||
148 | + "vipLevel": "VIP等级", | ||
149 | + "diamond": "角色金币数量", | ||
150 | + "moneyType": "商品单位", | ||
151 | + "custom": "微信小游戏分享的query参数,与扩展接口的分享时data一致", | ||
152 | + "isNew":"新创建角色第一次登录进游戏为1,其他为0", | ||
153 | + "score":"战力", | ||
154 | + "isFinishNewComer":"是否已完成新手,0否1是", | ||
155 | + "roleLevelReborn":"转生等级,没有传0", | ||
156 | + "partyId":"工会id(请用数字,如无请传"0")", | ||
157 | + "checkPointId":"关卡id(请用数字,如无请传"0")", | ||
158 | + "checkPointName":"关卡名(没有的传 "无")", | ||
159 | + "checkPointResult":"关卡结果,1中途退出2胜利3失败4打平", | ||
160 | + "professionId":"职业id(请用数字,如无请传"0")", | ||
161 | + "professionName":"职业名称(没有的传 "无")" | ||
162 | + }; | ||
163 | + //以上信息中,游戏如没有传空值即可 | ||
164 | + //启用提交信息接口 | ||
165 | + commonH5SDK.submitData(submitType, roleInfo); | ||
166 | + | ||
167 | +5. **支付** | ||
168 | + | ||
169 | + //设置订单参数 | ||
170 | + var payInfo = { | ||
171 | + "serverId": "服务器ID", | ||
172 | + "serverName": "服务器名字", | ||
173 | + "playerId": "角色ID", | ||
174 | + "openId":"渠道用户ID", | ||
175 | + "playerName": "角色名字", | ||
176 | + "playerLevel": "角色等级", | ||
177 | + "postAmount": "金额", | ||
178 | + "productId": "商品ID", | ||
179 | + "productName": "商品名称", | ||
180 | + "productDesc": "商品描述", | ||
181 | + "custom": "自定义透传参数", | ||
182 | + "exchange": "游戏币与人民币(元)的兑换比例", | ||
183 | + "otherInfo": "额外信息", | ||
184 | + "timestamp": "时间戳", | ||
185 | + "payType":"1:好友代付,0:正常支付(自己付款)" | ||
186 | + }; | ||
187 | + //以上信息中,游戏如没有传空值即可 | ||
188 | + //启用支付接口 | ||
189 | + commonH5SDK.pay(payInfo); | ||
190 | + | ||
191 | +6. **退出游戏** | ||
192 | + | ||
193 | + if(commonH5SDK.hasShowExitDialog()){//渠道含有退出框,游戏在回调中处理退出逻辑 | ||
194 | + commonH5SDK.showExitDialog(); | ||
195 | + }else{ | ||
196 | + //游戏自己处理退出逻辑后调用exitGame()接口 | ||
197 | + commonH5SDK.exitGame(); | ||
198 | + } | ||
199 | + | ||
200 | +7. **获取公共层参数接口** | ||
201 | + | ||
202 | + 说明:本接口通过键获取对应的参数值,需要在初始化成功后才能调用 | ||
203 | + /** | ||
204 | + 获取公共层参数 | ||
205 | + @param {string} key | ||
206 | + */ | ||
207 | + getParamValueByKey:function (key) | ||
208 | + | ||
209 | + 例子: | ||
210 | + commonH5SDK.getParamValueByKey("custom");//获取公共后台的自定义参数 | ||
211 | + commonH5SDK.getParamValueByKey("channelParameter1");//渠道标识1 | ||
212 | + commonH5SDK.getParamValueByKey("channelParameter2");//渠道标识2 | ||
213 | + commonH5SDK.getParamValueByKey("channelId");//渠道号 | ||
214 | + | ||
215 | +8. **扩展接口(游戏可根据渠道要求看是否接入)** | ||
216 | + | ||
217 | + /** | ||
218 | + 扩展接口 | ||
219 | + @param {*} type 扩展类型 | ||
220 | + /** | ||
221 | + * data参数传递 | ||
222 | + * type为msgSecCheck时传检验内容(eg:"内容") | ||
223 | + * type:realVerify/realNameVerify时传递身份证信息(eg:{id:"身份证号",name:"姓名"}) | ||
224 | + * type:share时传递的是平台api收到的query参数(内容格式必须是 eg:'key1=value1&key2=value2') | ||
225 | + * type:mulShare时data例子: | ||
226 | + * { | ||
227 | + * type:0,//分享类型 0:普通分享 1:朋友圈分享 | ||
228 | + * data:"key1=value1&key2=value2"//平台api收到的getLaunchOptionsSync.query参数(内容格式必须是 eg:'key1=value1&key2=value2') | ||
229 | + * } | ||
230 | + * type:showAd时数据例子: | ||
231 | + { | ||
232 | + type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告 | ||
233 | + style:{//type等于2时需要传style其它类型可不传 | ||
234 | + left:0,//banner左上角横坐标位置 | ||
235 | + top:0,//banner左上角纵坐标位置 | ||
236 | + width:0,//宽度 | ||
237 | + height:0//高度 | ||
238 | + } | ||
239 | + } | ||
240 | + * type:bindPhone时数据 | ||
241 | + { | ||
242 | + type:1,//0:为获取验证码 1:为绑定操作 | ||
243 | + phone:"18xxxxx",//手机号 | ||
244 | + smsCode:"058961"//验证码 | ||
245 | + } | ||
246 | + * type:getUserInfo时传按钮样式(eg:{ | ||
247 | + type: 'text', | ||
248 | + text: '授权', | ||
249 | + style: { | ||
250 | + left: 10, | ||
251 | + top: 76, | ||
252 | + width: 200, | ||
253 | + height: 40, | ||
254 | + lineHeight: 40, | ||
255 | + backgroundColor: '#ff0000', | ||
256 | + color: '#ffffff', | ||
257 | + textAlign: 'center', | ||
258 | + fontSize: 16, | ||
259 | + borderRadius: 4 | ||
260 | + } | ||
261 | + }) | ||
262 | + * 其他暂传空 | ||
263 | + */ | ||
264 | + @param {*} data 传递数据 | ||
265 | + @param {*} callback 回调方法 | ||
266 | + */ | ||
267 | + expansionInterface: function (type, data, callback); | ||
268 | + | ||
269 | + 字段说明: | ||
270 | + /** | ||
271 | + * 传公共sdk扩展类型 | ||
272 | + * { | ||
273 | + gameSetting: 100, //功能设置 | ||
274 | + downloadMicroClent: 101, //下载微端 | ||
275 | + share: 102, //分享 data:"key1=value1&key2=value2"//平台api收到的getLaunchOptionsSync.query参数(内容格式必须是 eg:'key1=value1&key2=value2') | ||
276 | + focus: 103, //关注 | ||
277 | + save2Desktop: 104, //保存到桌面 | ||
278 | + realVerify: 105, //实名认证(已弃用) | ||
279 | + back2Game: 106, //返回游戏 | ||
280 | + bindPhone: 107, //绑定手机有奖接口 | ||
281 | + { | ||
282 | + type:1,//0:为获取验证码 1:为绑定操作 | ||
283 | + phone:"18xxxxx",//手机号 | ||
284 | + smsCode:"058961"//验证码 | ||
285 | + } | ||
286 | + msgSecCheck: 108, //违规内容判断接口 data为验证的数据内容 | ||
287 | + checkBalance: 109, //查询余额 | ||
288 | + showAd: 110, //广告类型 | ||
289 | + score: 111,//评分 | ||
290 | + kefu: 112,//客服接口 | ||
291 | + queryProductsInfo: 113,//根据sku(商品ID)查询商品信息 | ||
292 | + userCenter: 114,//用户中心 | ||
293 | + eventTrack: 115, //事件上报 | ||
294 | + realNameVerify: 116, //新实名认证 | ||
295 | + mulShare:117, //分享功能(适应不同类型的分享功能) | ||
296 | + 118,//蓝钻查询 | ||
297 | + 119,//蓝钻购买接口 | ||
298 | + 120,//查询永久订阅状态 | ||
299 | + 121,//调用永久订阅接口 | ||
300 | + 122,//获取玩家首次进入游戏的场景值 | ||
301 | + 123//消息订阅接口 | ||
302 | + } | ||
303 | + */ | ||
304 | + var expansion_type = commonH5SDK.expansion_type.gameSetting;//功能设置 | ||
305 | + /** | ||
306 | + * { | ||
307 | + | ||
308 | + code:0,//0:成功 其他为失败 | ||
309 | + message:"success",//返回结果描述 | ||
310 | + data:{//功能设置返回,其他接口暂时不返回data数据 | ||
311 | + has_micro_client: 0,//是否有微端 0:没有,1:有,2已经在微端中 | ||
312 | + is_share: 0,//是否有分享接口 0:没有,1:有 | ||
313 | + is_focus: 0,//是否有关注 0:没,1:有,2:已经关注 | ||
314 | + is_apple_pay: 0,//是否开启苹果支付 0:不开启 1:开启 | ||
315 | + is_open_pay: 1,//1开启充值入口,其他为关闭充值入口 默认开启 | ||
316 | + is_desktop: 0,//是否有保存桌面 0:没有 1:有 | ||
317 | + is_switch_account: 0,//是否有切换账号 0:没有 1有 | ||
318 | + is_realverify: 0,//是否有实名认证 0:没有 1:有 2:已认证 | ||
319 | + is_real_name_verify:-1,//是否有实名认证接口 -1:不存在实名功能(cp和渠道协商) 0:没有界面接口渠道内部有实名功能,1:有界面接口 2:已认证 | ||
320 | + birthday:"",//用户实名生日20200101(进行左移两位加密操作) is_real_name_verify为2时才有数据 | ||
321 | + is_super_kefu: 0,//是否有超级客服 0:没 1:有 | ||
322 | + is_backtogame: 0,//是否有返回按钮 0:没有,1:有 | ||
323 | + is_lock: 0,//是否竖屏 0:研发默认样式 1:强制竖屏 | ||
324 | + is_focus_gift: 0,//关注有礼 0:关闭 1:开启 | ||
325 | + is_bindphone: 0,//绑定手机 0:关闭 1:开启 2:已绑定手机 | ||
326 | + is_msgseccheck: 0, //违规内容判断接口 0:没有,1:有 | ||
327 | + is_checkbalance: 0,//是否有查询 0:没有,1:有 | ||
328 | + is_showad: 0,//是否有广告接口 0:没有,1:有 | ||
329 | + is_usercenter: 0,//是否有用户中心接口 0:没有 1:有 | ||
330 | + is_kefu: 0,//是否有客服 0:没有,1:有(调用对应的客服类型接口(kefu)) | ||
331 | + is_score: 0,//是否有评分接口 0:没有,1:有(调用对应的评分类型接口(score)) | ||
332 | + is_query_products_info: 0,//是否有查询商品信息接口 0,没有 1:有(调用对应的查询商品信息接口(queryProductsInfo)) | ||
333 | + is_event_track: 0,// 0:没有 1:有 是否有事件上报接口 | ||
334 | + is_blue_vip_function:0,//0:没有蓝钻功能 1:有蓝钻功能 (此状态配合蓝钻查询和蓝钻购买) | ||
335 | + is_subscribe_whats_new:0,//0:没有游戏更新订阅接口 1:有游戏更新订阅 | ||
336 | + msg_subscribe_code:0,//0:没有消息订阅接口,1:表示有消息订阅接口 2:表示已经订阅 | ||
337 | + is_get_scene_interface:0//是否有获取首次进入游戏场景值接口,0:没有 1:有 | ||
338 | + } | ||
339 | + data:{//余额类型返回数据 code为失败时此字段不返回 | ||
340 | + balance:0//余额 | ||
341 | + } | ||
342 | + data:{//广告类型返回数据 code为失败时此字段不返回 | ||
343 | + isFinishTask:1//等于1时为广告任务完成,其他为任务未完成 | ||
344 | + } | ||
345 | + } | ||
346 | + * @param {*} result | ||
347 | + */ | ||
348 | + var expansionCallBack = function(result){ | ||
349 | + } | ||
350 | + commonH5SDK.expansionInterface(expansion_type,data,expansionCallBack); | ||
351 | + | ||
352 | + | ||
353 | +8.1. **扩展接口(商品信息查询(目前用于海外渠道显示商场))** | ||
354 | + | ||
355 | + /** | ||
356 | + 扩展接口 | ||
357 | + @param {*} type commonH5SDK.expansion_type.queryProductsInfo | ||
358 | + @param {*} data "productId1,productId2" //传入要查询的商品ID字符串,多个之前用逗号隔开 | ||
359 | + @param {*} callback 回调方法 | ||
360 | + */ | ||
361 | + expansionInterface: function (type, data, callback); | ||
362 | + | ||
363 | + 示例: | ||
364 | + | ||
365 | + /** | ||
366 | + * { | ||
367 | + code:0,//0:成功 其他为失败 | ||
368 | + message:"success",//返回描述 | ||
369 | + data:{//查询商品信息返回数据(queryProductsInfo) | ||
370 | + "android.test.purchased0": {//key为商品ID | ||
371 | + "displayPrice": "₩1167.28",//显示价格 | ||
372 | + "price": "₩1,167", //实际价格(去除小数点) 充值传递 | ||
373 | + "priceAmountMicros": 1167284249, //数字价格 | ||
374 | + "priceCurrencyCode": "KRW", //货币代码 | ||
375 | + "sku": "android.test.purchased0",//商品ID | ||
376 | + "title": "名称示例" | ||
377 | + }, | ||
378 | + "android.test.purchased1": { | ||
379 | + "displayPrice": "₩1167.28", | ||
380 | + "price": "₩1,167", | ||
381 | + "priceAmountMicros": 1167284249, | ||
382 | + "priceCurrencyCode": "KRW", | ||
383 | + "sku": "android.test.purchased1", | ||
384 | + "title": "名称示例" | ||
385 | + } | ||
386 | + } | ||
387 | + } | ||
388 | + * @param {*} result | ||
389 | + */ | ||
390 | + var expansionCallBack = function(result){ | ||
391 | + } | ||
392 | + commonH5SDK.expansionInterface(commonH5SDK.expansion_type.queryProductsInfo,"test1,test2,test3",expansionCallBack); | ||
393 | + | ||
394 | + | ||
395 | +8.3. **扩展接口(实名认证)** | ||
396 | + | ||
397 | + /** | ||
398 | + 扩展接口(根据gameSetting中获取字段is_real_name_verify为有接口时调用) | ||
399 | + @param {*} type commonH5SDK.expansion_type.realNameVerify | ||
400 | + @param {*} data 当需要游戏自定义页面时传递{id:"身份证号",name:"姓名"},其他传"" | ||
401 | + @param {*} callback 回调方法 | ||
402 | + { | ||
403 | + code:0,//0成功,其他失败 | ||
404 | + message:"",//空值不做处理 | ||
405 | + data:"20190101"//(游戏将获取到的密文右移两位 eg:19900101 >> 2) | ||
406 | + } | ||
407 | + */ | ||
408 | + expansionInterface: function (type, data, callback); | ||
409 | + | ||
410 | + 示例: | ||
411 | + var expansionCallBack = function(result){ | ||
412 | + } | ||
413 | + commonH5SDK.expansionInterface(commonH5SDK.expansion_type.realNameVerify,{id:"身份证号",name:"姓名"},expansionCallBack); | ||
414 | + | ||
415 | +8.4. **扩展接口(蓝钻查询)** | ||
416 | + | ||
417 | + /** | ||
418 | + 扩展接口 (根据gameSetting中获取字段is_blue_vip_function为有接口时调用) | ||
419 | + @param {*} type 游戏直接传入int值118 | ||
420 | + @param {*} data 传"" | ||
421 | + @param {*} callback 回调方法 | ||
422 | + { | ||
423 | + code:0,//0成功,其他失败 | ||
424 | + message:"success",//空值不做处理 | ||
425 | + data:{ | ||
426 | + "is_blue_vip": 0, //是否蓝钻, 1表示是,0表示不是 | ||
427 | + "server_time": 1605250960,//服务器时间,用于比较蓝钻开通时间和到期时间,unix时间戳,单位为秒 | ||
428 | + "is_blue_year_vip": 0,//是否年费蓝钻;1表示是,0表示不是 | ||
429 | + "seq": 0, | ||
430 | + "expand_vip_reg_time": 0,//超级蓝钻开通时间,unix时间戳,单位为秒 | ||
431 | + "year_vip_reg_time": 0,//年费蓝钻开通时间,unix时间戳,单位为秒 | ||
432 | + "super_vip_reg_time": 0,//豪华蓝钻开通时间,unix时间戳,单位为秒 | ||
433 | + "vip_reg_time": 0,//蓝钻开通时间,unix时间戳,单位为秒 | ||
434 | + "ret": 0, | ||
435 | + "uin": 0, | ||
436 | + "pf": "qqgame", | ||
437 | + "is_super_blue_vip": 0,//是否豪华蓝钻;1表示是,0表示不是 | ||
438 | + "is_have_growth": 0,//蓝钻是否具备成长值,1表示是,0表示不是 | ||
439 | + "msg": "", | ||
440 | + "is_expand_blue_vip": 0,//是否超级蓝钻;1表示是,0表示不是 | ||
441 | + "blue_vip_level": 0,//蓝钻等级 | ||
442 | + "is_mobile_blue_vip": 0,//是否手机蓝钻;1表示是,0表示不是 | ||
443 | + "vip_valid_time": 0,//蓝钻到期时间,unix时间戳,单位为秒 | ||
444 | + "super_vip_valid_time": 0,//豪华蓝钻到期时间,unix时间戳,单位为秒 | ||
445 | + "expand_vip_valid_time": 0,//超级蓝钻到期时间,unix时间戳,单位为秒 | ||
446 | + "year_vip_valid_time": 0 //年费蓝钻到期时间,unix时间戳,单位为秒 | ||
447 | + } | ||
448 | + } | ||
449 | + */ | ||
450 | + expansionInterface: function (type, data, callback); | ||
451 | + | ||
452 | + 示例: | ||
453 | + var expansionCallBack = function(result){ | ||
454 | + } | ||
455 | + commonH5SDK.expansionInterface(118,"",expansionCallBack); | ||
456 | + | ||
457 | +8.5. **扩展接口(蓝钻购买)** | ||
458 | + | ||
459 | + /** | ||
460 | + 扩展接口 (根据gameSetting中获取字段is_blue_vip_function为有接口时调用) | ||
461 | + @param {*} type 游戏直接传入int值119 | ||
462 | + @param {*} data 传"" | ||
463 | + @param {*} callback 此接口不会有结果回调 | ||
464 | + */ | ||
465 | + expansionInterface: function (type, data, callback); | ||
466 | + | ||
467 | + 示例: | ||
468 | + commonH5SDK.expansionInterface(119,"",""); | ||
469 | + | ||
470 | +8.6. **扩展接口(游戏更新提醒订阅查询)** | ||
471 | + | ||
472 | + /** | ||
473 | + 扩展接口 (根据gameSetting中获取字段is_subscribe_whats_new为有接口时调用) | ||
474 | + @param {*} type 游戏直接传入int值120 | ||
475 | + @param {*} data 传"" | ||
476 | + @param {*} callback | ||
477 | + { | ||
478 | + code:0,//0:表示用于已订阅,其他未订阅 | ||
479 | + message:"success" //返回消息 | ||
480 | + } | ||
481 | + */ | ||
482 | + expansionInterface: function (type, data, callback); | ||
483 | + | ||
484 | + 示例: | ||
485 | + var expansionCallBack = function(result){ | ||
486 | + } | ||
487 | + commonH5SDK.expansionInterface(120,"",expansionCallBack); | ||
488 | + | ||
489 | +8.7. **扩展接口(游戏更新提醒订阅)** | ||
490 | + | ||
491 | + /** | ||
492 | + 扩展接口 (根据gameSetting中获取字段is_subscribe_whats_new为有接口时调用) | ||
493 | + @param {*} type 游戏直接传入int值121 | ||
494 | + @param {*} data 传"" | ||
495 | + @param {*} callback | ||
496 | + { | ||
497 | + code:0,//0:表示订阅成功,其他未订阅 | ||
498 | + message:"success" //返回消息 | ||
499 | + } | ||
500 | + */ | ||
501 | + expansionInterface: function (type, data, callback); | ||
502 | + | ||
503 | + 示例: | ||
504 | + var expansionCallBack = function(result){ | ||
505 | + } | ||
506 | + commonH5SDK.expansionInterface(121,"",expansionCallBack); | ||
507 | + | ||
508 | +8.8. **扩展接口(分享接口)** | ||
509 | + | ||
510 | + /** | ||
511 | + 扩展接口 (根据gameSetting中获取字段is_share为有接口时调用) | ||
512 | + @param {*} type 游戏直接传入int值117 | ||
513 | + @param {*} data | ||
514 | + { | ||
515 | + type:0,//分享类型 0:普通分享 1:朋友圈分享 | ||
516 | + data:"key1=value1&key2=value2" | ||
517 | + } | ||
518 | + @param {*} callback(`分享不一定会返回`) | ||
519 | + { | ||
520 | + code:0,//0:分享成功 其他未分享失败 | ||
521 | + message:"success" //返回消息 | ||
522 | + } | ||
523 | + */ | ||
524 | + expansionInterface: function (type, data, callback); | ||
525 | + | ||
526 | + 示例: | ||
527 | + var expansionCallBack = function(result){ | ||
528 | + } | ||
529 | + commonH5SDK.expansionInterface(117,"",expansionCallBack); | ||
530 | + | ||
531 | +8.9. **扩展接口(绑定手机)** | ||
532 | + | ||
533 | + /** | ||
534 | + 扩展接口 (根据gameSetting中获取字段is_bindphone为有接口时调用) | ||
535 | + @param {*} type 游戏直接传入int值107 | ||
536 | + @param {*} data | ||
537 | + { | ||
538 | + type:1,//0:为获取验证码 1:为绑定操作 | ||
539 | + phone:"18xxxxx",//手机号 | ||
540 | + smsCode:"058961"//验证码 获取验证码时传"" | ||
541 | + } | ||
542 | + @param {*} callback | ||
543 | + { | ||
544 | + code:0,//0:成功 其他失败 | ||
545 | + message:"success" //返回消息 | ||
546 | + } | ||
547 | + */ | ||
548 | + expansionInterface: function (type, data, callback); | ||
549 | + | ||
550 | + 示例: | ||
551 | + var expansionCallBack = function(result){ | ||
552 | + } | ||
553 | + var data = { | ||
554 | + type:1,//0:为获取验证码 1:为绑定操作 | ||
555 | + phone:"18xxxxx",//手机号 | ||
556 | + smsCode:"058961"//验证码 获取验证码时传"" | ||
557 | + } | ||
558 | + commonH5SDK.expansionInterface(107,data,expansionCallBack); | ||
559 | + | ||
560 | +8.10. **扩展接口(广告接口)** | ||
561 | + | ||
562 | + /** | ||
563 | + 扩展接口 (根据gameSetting中获取字段is_showad为有接口时调用) | ||
564 | + @param {*} type 游戏直接传入int值110 | ||
565 | + @param {*} data | ||
566 | + { | ||
567 | + type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告 | ||
568 | + style:{//type等于2时需要传style其它类型可不传 | ||
569 | + left:0,//banner左上角横坐标位置 | ||
570 | + top:0,//banner左上角纵坐标位置 | ||
571 | + width:0,//宽度 | ||
572 | + height:0//高度 | ||
573 | + } | ||
574 | + } | ||
575 | + @param {*} callback | ||
576 | + { | ||
577 | + code:0,//0:成功 其他失败 | ||
578 | + message:"success" //返回消息 | ||
579 | + } | ||
580 | + */ | ||
581 | + expansionInterface: function (type, data, callback); | ||
582 | + | ||
583 | + 示例: | ||
584 | + var expansionCallBack = function(result){ | ||
585 | + } | ||
586 | + var data = { | ||
587 | + type:1,//广告操作类型 1:显示视频广告 2:显示banner广告 -2:关闭banner广告 3:显示插屏广告 | ||
588 | + style:{//type等于2时需要传style其它类型可不传 | ||
589 | + left:0,//banner左上角横坐标位置 | ||
590 | + top:0,//banner左上角纵坐标位置 | ||
591 | + width:0,//宽度 | ||
592 | + height:0//高度 | ||
593 | + } | ||
594 | + } | ||
595 | + commonH5SDK.expansionInterface(110,data,expansionCallBack); | ||
596 | + | ||
597 | +8.11. **扩展接口(获取玩家首次进入游戏场景值接口)** | ||
598 | + | ||
599 | + /** | ||
600 | + 扩展接口 (根据gameSetting中获取字段is_get_scene_interface为1时有此接口调用) | ||
601 | + @param {*} type 游戏直接传入int值122 | ||
602 | + @param {*} data 传"" | ||
603 | + @param {*} callback | ||
604 | + { | ||
605 | + code:0, | ||
606 | + message:"", | ||
607 | + data:{ | ||
608 | + first_scene:"玩家首次进入的场景值", | ||
609 | + current_scene:"玩家当次进入的场景值" | ||
610 | + } | ||
611 | + } | ||
612 | + */ | ||
613 | + expansionInterface: function (type, data, callback); | ||
614 | + | ||
615 | + 示例: | ||
616 | + var expansionCallBack = function(result){ | ||
617 | + //result.code 0:时订阅成功,其他未失败 | ||
618 | + } | ||
619 | + commonH5SDK.expansionInterface(122,"",expansionCallBack); | ||
620 | + | ||
621 | +8.12. **扩展接口(消息订阅接口)** | ||
622 | + | ||
623 | + /** | ||
624 | + 扩展接口 (根据gameSetting中获取字段msg_subscribe_code为1时有此接口调用) | ||
625 | + @param {*} type 游戏直接传入int值123 | ||
626 | + @param {*} data 传"" | ||
627 | + @param {*} callback | ||
628 | + { | ||
629 | + code:0,//0:成功 其他失败 | ||
630 | + message:"success" //返回消息 | ||
631 | + } | ||
632 | + */ | ||
633 | + expansionInterface: function (type, data, callback); | ||
634 | + | ||
635 | + 示例: | ||
636 | + var expansionCallBack = function(result){ | ||
637 | + //result.code 0:时订阅成功,其他未失败 | ||
638 | + } | ||
639 | + commonH5SDK.expansionInterface(123,"",expansionCallBack); | ||
640 | + | ||
641 | +8.13. **扩展接口(添加桌面快捷键)** | ||
642 | + | ||
643 | + /** | ||
644 | + 扩展接口 (根据gameSetting中获取字段is_desktop为1时有此接口调用) | ||
645 | + @param {*} type 游戏直接传入int值104 | ||
646 | + @param {*} data 传"" | ||
647 | + @param {*} callback | ||
648 | + { | ||
649 | + code:0,//0:成功 其他失败 | ||
650 | + message:"success" //返回消息 | ||
651 | + } | ||
652 | + */ | ||
653 | + expansionInterface: function (type, data, callback); | ||
654 | + | ||
655 | + 示例: | ||
656 | + var expansionCallBack = function(result){ | ||
657 | + //result.code 0:添加成功,添加失败 | ||
658 | + } | ||
659 | + commonH5SDK.expansionInterface(104,"",expansionCallBack); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
wegame/公共SDK服务端接入文档.md
0 → 100644
1 | +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 | ... | \ No newline at end of file |
-
Please register or login to post a comment