Showing
51 changed files
with
689 additions
and
0 deletions
README.md
0 → 100644
1 | +# 游娱SDK接入文档说明 # | ||
2 | + | ||
3 | +## 1.添加资源文件到你的项目中 ## | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | +``` | ||
9 | +将assets中的sdk目录和sdk.zip的文件名称改成与styleName对应 | ||
10 | +eg:styleName设置为sdk_3时讲sdk目录和sdk.zip就修改为sdk_3和sdk_3.zip | ||
11 | +``` | ||
12 | + | ||
13 | +- 将wxapi文件夹添加到你的项目包名下,如xxx.xxx.xxx.wxapi | ||
14 | + | ||
15 | +## 2.在AndroidManifest.xml中添加权限和声明 ## | ||
16 | + | ||
17 | + | ||
18 | +```xml | ||
19 | + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
20 | + <uses-permission android:name="android.permission.INTERNET" /> | ||
21 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
22 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
23 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
24 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
25 | + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | ||
26 | + <uses-permission android:name="android.permission.READ_LOGS" /> | ||
27 | + <uses-permission android:name="android.permission.GET_TASKS" /> | ||
28 | + <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | ||
29 | + <!-- 银联 --> | ||
30 | + <uses-permission | ||
31 | + android:name="android.permission.INTERNET"/> | ||
32 | + <uses-permission | ||
33 | + android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
34 | + <uses-permission | ||
35 | + android:name="android.permission.CHANGE_NETWORK_STATE"/> | ||
36 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | ||
37 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
38 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | ||
39 | + <uses-permission android:name="android.permission.RECORD_AUDIO"/> | ||
40 | + <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> | ||
41 | + <uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD" /> | ||
42 | + <uses-permission android:name="android.permission.NFC" /> | ||
43 | + <uses-feature android:name="android.hardware.nfc.hce"/> | ||
44 | + <!-- 银联 --> | ||
45 | +``` | ||
46 | + | ||
47 | +```xml | ||
48 | + <activity | ||
49 | + android:name=".wxapi.WXEntryActivity" | ||
50 | + android:exported="true" | ||
51 | + android:launchMode="singleTop"/> | ||
52 | + <activity | ||
53 | + android:name=".wxapi.WXPayEntryActivity" | ||
54 | + android:exported="true" | ||
55 | + android:launchMode="singleTop"/> | ||
56 | + <activity | ||
57 | + android:name="com.youai.sdk.YouaiSDK" | ||
58 | + android:label="youai_sdk" | ||
59 | + android:launchMode="singleTask" | ||
60 | + android:theme="@android:style/Theme.Dialog" > | ||
61 | + </activity> | ||
62 | + | ||
63 | + <service | ||
64 | + android:name="com.youai.sdk.FloatViewService" | ||
65 | + android:enabled="true" | ||
66 | + android:exported="true" > | ||
67 | + <intent-filter> | ||
68 | + <action android:name="com.youai.sdk.FloatViewService" /> | ||
69 | + </intent-filter> | ||
70 | + </service> | ||
71 | + | ||
72 | + <receiver android:name="com.youai.sdk.Receiver" > | ||
73 | + <intent-filter> | ||
74 | + <action android:name="android.intent.action.BOOT_COMPLETED" > | ||
75 | + </action> | ||
76 | + | ||
77 | + <category android:name="android.intent.category.LAUNCHER" /> | ||
78 | + </intent-filter> | ||
79 | + </receiver> | ||
80 | + | ||
81 | + <!-- alipay sdk begin --> | ||
82 | + <activity | ||
83 | + android:name="com.alipay.sdk.app.H5PayActivity" | ||
84 | + android:configChanges="orientation|keyboardHidden|navigation" | ||
85 | + android:exported="false" | ||
86 | + android:screenOrientation="behind" > | ||
87 | + </activity> | ||
88 | + <activity | ||
89 | + android:name="com.alipay.sdk.auth.AuthActivity" | ||
90 | + android:configChanges="orientation|keyboardHidden|navigation" | ||
91 | + android:exported="false" | ||
92 | + android:screenOrientation="behind" > | ||
93 | + </activity> | ||
94 | + <!-- alipay sdk end --> | ||
95 | + | ||
96 | + <uses-library android:name="org.simalliance.openmobileapi" android:required="false"/> | ||
97 | + <activity | ||
98 | + android:name="com.unionpay.uppay.PayActivity" | ||
99 | + android:configChanges="orientation|keyboardHidden|keyboard" | ||
100 | + android:screenOrientation="portrait"> | ||
101 | + </activity> | ||
102 | + <activity | ||
103 | + android:name="com.unionpay.UPPayWapActivity" | ||
104 | + android:configChanges="orientation|keyboardHidden|fontScale" | ||
105 | + android:screenOrientation="portrait" | ||
106 | + android:windowSoftInputMode="adjustResize" > | ||
107 | + </activity> | ||
108 | +``` | ||
109 | + | ||
110 | +## 3.代码接入 ## | ||
111 | + | ||
112 | +### 3.1SDK初始化方法 ### | ||
113 | + | ||
114 | +```java | ||
115 | +YouaiSDK.init(APP_ID, APP_CLIENT_KEY, WX_ID, context, "sdk_3"); | ||
116 | +``` | ||
117 | +- APP_ID("平台分配的APP_ID") | ||
118 | +- APP_CLIENT_KEY(平台分配的APP_CLIENT_KEY) | ||
119 | +- WX_ID(微信分配APPID `原生微信支付微需填,不用留空,新版易宝微信支付也不需要提供这个参数`) | ||
120 | +- context(上下文) | ||
121 | +- paramStyleName("sdk_3"(选填,新版默认用sdk_3)) | ||
122 | + | ||
123 | + | ||
124 | +### 3.2实例回调Listener ### | ||
125 | +```java | ||
126 | +YouaiSDKEventsListener finishLoginListener = newYouaiSDKEventsListener() { | ||
127 | + @Override | ||
128 | + public voidonEventDispatch(int i, Intent data) { | ||
129 | + if(i==YouaiSDK.LOGIN_ACTION_CODE){ | ||
130 | + System.out.println("........login ok.........."); | ||
131 | + String token = data.getStringExtra("token"); | ||
132 | + String timestamp = data.getStringExtra("timestamp"); | ||
133 | + String open_id = data.getStringExtra("open_id"); | ||
134 | + } | ||
135 | + } | ||
136 | +}; | ||
137 | +``` | ||
138 | + | ||
139 | +### 3.3调用登录接口 ### | ||
140 | +```java | ||
141 | +YouaiSDK.login(requestCode, callBack, context); | ||
142 | +``` | ||
143 | +示例 | ||
144 | +```java | ||
145 | +YouaiSDK.login(1111 ,finishLoginListener,this); | ||
146 | +``` | ||
147 | + | ||
148 | +### 3.4调用支付接口 ### | ||
149 | +```java | ||
150 | +YouaiSDK.pay(requestCode, serverId, serverName, roleName, amount, callBackInfo, callBack, context); | ||
151 | +``` | ||
152 | +示例 | ||
153 | +```java | ||
154 | +YouaiSDK.pay( | ||
155 | +1111, //requestCode 固定填1111 | ||
156 | +"1",//serverId | ||
157 | +"1服",//serverName | ||
158 | +"roleName", //playerId | ||
159 | +1, //amount 不固定金额填 0 | ||
160 | +"123456456789474",//自定义参数 | ||
161 | +finishLoginListener, //回调参数 | ||
162 | +this);//context | ||
163 | +``` | ||
164 | + | ||
165 | +### 3.5打开用户中心接口 (最新版sdk_3不需要调用这个接口)### | ||
166 | +```java | ||
167 | +YouaiSDK.center(requestCode, callBack, context); | ||
168 | +``` | ||
169 | +示例 | ||
170 | +```java | ||
171 | +YouaiSDK.center(1111, finishLoginListener, this); | ||
172 | +``` |
assets/.DS_Store
0 → 100644
No preview for this file type
assets/data.bin
0 → 100644
No preview for this file type
assets/sdk.zip
0 → 100644
No preview for this file type
assets/sdk/.DS_Store
0 → 100644
No preview for this file type
assets/sdk/agreement.html
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/center.html
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/config.js
0 → 100644
1 | +//游戏皮肤对应manifest文件的生成配置文件, 包括基本的第三方库、业务逻辑js、样式 | ||
2 | + | ||
3 | +var base_js = [ | ||
4 | + 'js/fastclick.min.1.0.js', | ||
5 | + 'js/zepto.min.js', | ||
6 | + 'js/doT.min.js', | ||
7 | + 'js/iscroll.min.1.0.js' | ||
8 | +] | ||
9 | + | ||
10 | +var concat_with_mtime = [ | ||
11 | + 'skin/new_sdk.min.css', | ||
12 | + 'skin/responsive.min.css', | ||
13 | + 'js/core.min.js', | ||
14 | + 'js/loader.min.js', | ||
15 | + 'js/center.min.js', | ||
16 | + 'js/pay.min.js', | ||
17 | + 'js/login.min.js' | ||
18 | +] | ||
19 | + | ||
20 | +var htmls = [ | ||
21 | + 'login.html', | ||
22 | + 'center.html', | ||
23 | + 'pay.html', | ||
24 | + 'share.html' | ||
25 | +] | ||
26 | + | ||
27 | +var images = 'skin/img'; | ||
28 | + | ||
29 | +var target = [ | ||
30 | + 'bllm', | ||
31 | + 'bwts', | ||
32 | + 'bwzq', | ||
33 | + 'fytx', | ||
34 | + 'hxjh', | ||
35 | + 'rxxt', | ||
36 | + 'sgg', | ||
37 | + 'smlw', | ||
38 | + 'twzw', | ||
39 | + 'whj' | ||
40 | +] | ||
41 | +exports.htmls = htmls; | ||
42 | +exports.target = target; | ||
43 | +exports.concat_with_mtime = concat_with_mtime; | ||
44 | +exports.base_js = base_js; | ||
45 | +exports.images = images; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/font/iconfont.eot
0 → 100644
No preview for this file type
assets/sdk/font/iconfont.svg
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/font/iconfont.ttf
0 → 100644
No preview for this file type
assets/sdk/font/iconfont.woff
0 → 100644
No preview for this file type
assets/sdk/images/login_icon.png
0 → 100644

7.05 KB
assets/sdk/images/new-sdk-logo.png
0 → 100644

10.4 KB
assets/sdk/js/center.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/core.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/doT.min.js
0 → 100644
1 | +(function(){function o(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},t=/&(?!#?\w+;)|<|>|"|'|\//g;return function(n){return n?n.toString().replace(t,function(t){return e[t]||t}):n}}function p(b,a,f){return(typeof a==="string"?a:a.toString()).replace(b.define||h,function(g,e,c,i){if(e.indexOf("def.")===0)e=e.substring(4);if(!(e in f))if(c===":")f[e]=i;else eval("def['"+e+"']="+i);return""}).replace(b.use||h,function(g,e){var c=eval(e);return c?p(b,c,f):c})}function l(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var j={version:"0.2.0",templateSettings:{evaluate:/\{\{([\s\S]+?)\}\}/g,interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:true,append:true,selfcontained:false},template:undefined,compile:undefined},m=function(){return this||(0,eval)("this")}();if(typeof module!=="undefined"&&module.exports)module.exports=j;else if(typeof define==="function"&&define.amd)define(function(){return j});else m.doT=j;m.encodeHTML=o();var q={append:{start:"'+(",end:")+'",startencode:"'+encodeHTML("},split:{start:"';out+=(",end:");out+='",startencode:"';out+=encodeHTML("}},h=/$^/;j.template=function(e,t,n){t=t||j.templateSettings;var r=t.append?q.append:q.split,a,i=0,u;if(t.use||t.define){var c=m.def;m.def=n||{};e=p(t,e,m.def);m.def=c}e=("var out='"+(t.strip?e.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):e).replace(/'|\\/g,"\\$&").replace(t.interpolate||h,function(e,t){return r.start+l(t)+r.end}).replace(t.encode||h,function(e,t){a=true;return r.startencode+l(t)+r.end}).replace(t.conditional||h,function(e,t,n){return t?n?"';}else if("+l(n)+"){out+='":"';}else{out+='":n?"';if("+l(n)+"){out+='":"';}out+='"}).replace(t.iterate||h,function(e,t,n,r){if(!t)return"';} } out+='";i+=1;u=r||"i"+i;t=l(t);return"';var arr"+i+"="+t+";if(arr"+i+"){var "+n+","+u+"=-1,l"+i+"=arr"+i+".length-1;while("+u+"<l"+i+"){"+n+"=arr"+i+"["+u+"+=1];out+='"}).replace(t.evaluate||h,function(e,t){return"';"+l(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|}|^|{)out\+='';/g,"$1").replace(/\+''/g,"").replace(/(\s|;|}|^|{)out\+=''\+/g,"$1out+=");if(a&&t.selfcontained)e="var encodeHTML=("+o.toString()+"());"+e;try{return new Function(t.varname,e)}catch(t){typeof console!=="undefined"&&console.log("Could not create a template function: "+e);throw t}};j.compile=function(e,t){return j.template(e,null,t)}})(); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/js/fastclick.min.1.0.js
0 → 100644
1 | +function FastClick(t){"use strict";var e,i=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=t;if(!t||!t.nodeType){throw new TypeError("Layer must be a document node")}this.onClick=function(){return FastClick.prototype.onClick.apply(i,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(i,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(i,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(i,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(i,arguments)};if(FastClick.notNeeded(t)){return}if(this.deviceIsAndroid){t.addEventListener("mouseover",this.onMouse,true);t.addEventListener("mousedown",this.onMouse,true);t.addEventListener("mouseup",this.onMouse,true)}t.addEventListener("click",this.onClick,true);t.addEventListener("touchstart",this.onTouchStart,false);t.addEventListener("touchend",this.onTouchEnd,false);t.addEventListener("touchcancel",this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){t.removeEventListener=function(e,i,n){var r=Node.prototype.removeEventListener;if(e==="click"){r.call(t,e,i.hijacked||i,n)}else{r.call(t,e,i,n)}};t.addEventListener=function(e,i,n){var r=Node.prototype.addEventListener;if(e==="click"){r.call(t,e,i.hijacked||(i.hijacked=function(t){if(!t.propagationStopped){i(t)}}),n)}else{r.call(t,e,i,n)}}}if(typeof t.onclick==="function"){e=t.onclick;t.addEventListener("click",function(t){e(t)},false);t.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf("Android")>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);FastClick.prototype.needsClick=function(t){"use strict";switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled){return true}break;case"input":if(this.deviceIsIOS&&t.type==="file"||t.disabled){return true}break;case"label":case"video":return true}return/\bneedsclick\b/.test(t.className)};FastClick.prototype.needsFocus=function(t){"use strict";switch(t.nodeName.toLowerCase()){case"textarea":case"select":return true;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return false}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}};FastClick.prototype.sendClick=function(t,e){"use strict";var i,n;if(document.activeElement&&document.activeElement!==t){document.activeElement.blur()}n=e.changedTouches[0];i=document.createEvent("MouseEvents");i.initMouseEvent("click",true,true,window,1,n.screenX,n.screenY,n.clientX,n.clientY,false,false,false,false,0,null);i.forwardedTouchEvent=true;t.dispatchEvent(i)};FastClick.prototype.focus=function(t){"use strict";var e;if(this.deviceIsIOS&&t.setSelectionRange){e=t.value.length;t.setSelectionRange(e,e)}else{t.focus()}};FastClick.prototype.updateScrollParent=function(t){"use strict";var e,i;e=t.fastClickScrollParent;if(!e||!e.contains(t)){i=t;do{if(i.scrollHeight>i.offsetHeight){e=i;t.fastClickScrollParent=i;break}i=i.parentElement}while(i)}if(e){e.fastClickLastScrollTop=e.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(t){"use strict";if(t.nodeType===Node.TEXT_NODE){return t.parentNode}return t};FastClick.prototype.onTouchStart=function(t){"use strict";var e,i,n;if(t.targetTouches.length>1){return true}e=this.getTargetElementFromEventTarget(t.target);i=t.targetTouches[0];if(this.deviceIsIOS){n=window.getSelection();if(n.rangeCount&&!n.isCollapsed){return true}if(!this.deviceIsIOS4){if(i.identifier===this.lastTouchIdentifier){t.preventDefault();return false}this.lastTouchIdentifier=i.identifier;this.updateScrollParent(e)}}this.trackingClick=true;this.trackingClickStart=t.timeStamp;this.targetElement=e;this.touchStartX=i.pageX;this.touchStartY=i.pageY;if(t.timeStamp-this.lastClickTime<200){t.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(t){"use strict";var e=t.changedTouches[0],i=this.touchBoundary;if(Math.abs(e.pageX-this.touchStartX)>i||Math.abs(e.pageY-this.touchStartY)>i){return true}return false};FastClick.prototype.findControl=function(t){"use strict";if(t.control!==undefined){return t.control}if(t.htmlFor){return document.getElementById(t.htmlFor)}return t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")};FastClick.prototype.onTouchEnd=function(t){"use strict";var e,i,n,r,s,o=this.targetElement;if(this.touchHasMoved(t)){this.trackingClick=false;this.targetElement=null}if(!this.trackingClick){return true}if(t.timeStamp-this.lastClickTime<200){this.cancelNextClick=true;return true}this.lastClickTime=t.timeStamp;i=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){s=t.changedTouches[0];o=document.elementFromPoint(s.pageX-window.pageXOffset,s.pageY-window.pageYOffset)||o;o.fastClickScrollParent=this.targetElement.fastClickScrollParent}n=o.tagName.toLowerCase();if(n==="label"){e=this.findControl(o);if(e){this.focus(o);if(this.deviceIsAndroid){return false}o=e}}else if(this.needsFocus(o)){if(t.timeStamp-i>100||this.deviceIsIOS&&window.top!==window&&n==="input"){this.targetElement=null;return false}this.focus(o);if(!this.deviceIsIOS4||n!=="select"){this.targetElement=null;t.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){r=o.fastClickScrollParent;if(r&&r.fastClickLastScrollTop!==r.scrollTop){return true}}if(!this.needsClick(o)){t.preventDefault();this.sendClick(o,t)}return false};FastClick.prototype.onTouchCancel=function(){"use strict";this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(t){"use strict";if(!this.targetElement){return true}if(t.forwardedTouchEvent){return true}if(!t.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(t.stopImmediatePropagation){t.stopImmediatePropagation()}else{t.propagationStopped=true}t.stopPropagation();t.preventDefault();return false}return true};FastClick.prototype.onClick=function(t){"use strict";var e;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(t.target.type==="submit"&&t.detail===0){return true}e=this.onMouse(t);if(!e){this.targetElement=null}return e};FastClick.prototype.destroy=function(){"use strict";var t=this.layer;if(this.deviceIsAndroid){t.removeEventListener("mouseover",this.onMouse,true);t.removeEventListener("mousedown",this.onMouse,true);t.removeEventListener("mouseup",this.onMouse,true)}t.removeEventListener("click",this.onClick,true);t.removeEventListener("touchstart",this.onTouchStart,false);t.removeEventListener("touchend",this.onTouchEnd,false);t.removeEventListener("touchcancel",this.onTouchCancel,false)};FastClick.notNeeded=function(t){"use strict";var e;if(typeof window.ontouchstart==="undefined"){return true}if(/Chrome\/[0-9]+/.test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){e=document.querySelector("meta[name=viewport]");if(e&&e.content.indexOf("user-scalable=no")!==-1){return true}}else{return true}}if(t.style.msTouchAction==="none"){return true}return false};FastClick.attach=function(t){"use strict";return new FastClick(t)};if(typeof define!=="undefined"&&define.amd){define(function(){"use strict";return FastClick})}else if(typeof module!=="undefined"&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/js/iscroll.min.1.0.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/loader.min.js
0 → 100644
1 | +(function(){var e=function(){if(window.isGetData==1){Core.init()}else{window.isGetData=1}};var a=function(a){var t=location.hash.slice(1);var r=t.match(/app_id=(\w*)&?/);var o=t.match(/mod=(\w*)&?/);var s="";var i="?"+$("#skin").attr("data-v");if(r&&r.length==2){s=r[1]}if(o&&o.length==2){Core.start_page=o[1];console.log(Core.start_page)}location.hash="";if(s==""){t=localStorage.getItem("params_"+a);s=localStorage.getItem("app_id")}else{localStorage.setItem("params_"+a,t);localStorage.setItem("app_id",s)}Core.params=t;if(!s){Core.showTips("无法获取app_id!",false,3e3);e();$("#loading").hide();return}Core.Data.app_id=s;var l=false;var n=false;var f=localStorage.getItem("skin_"+s);if(f){$("#skin").attr("href",Core.server+"/static/sdk_3/skin/"+f+"/skin.css"+i);l=true}if($("#login").length!=0){var c=localStorage.getItem("auto");var g=parseInt(localStorage.getItem("auto_time"));var d=(new Date).getTime();if(c=="true"&&d-g<6e5){n=false}else if(c==null){n=false}else{n=true}}if(!n)e();if(Core.isFile){a=Core.server+a}$.ajax({type:"GET",url:a+"?"+t,dataType:"json",success:function(t){if(t.code==0){Core.Data=t.msg;if(Core.Data.face){Core.Data.face=Core.server+t.msg.face}var r=localStorage.getItem("last_server");if(Core.Data.new_server){if(r&&r==Core.Data.new_server){}else{var o="sdk://changeServer?addr="+Core.Data.new_server;localStorage.setItem("last_server",Core.Data.new_server);location.href=o}}if(!l&&t.skin){$("#skin").attr("href",Core.server+"/static/sdk_3/skin/"+t.skin+"/skin.css"+i);localStorage.setItem("skin_"+s,t.skin)}localStorage.setItem("data_"+a,JSON.stringify(t.msg));if(typeof window.initFunc=="function"){window.initFunc()}$("#loading").hide();if(n){e()}else{var f=Core.start_page?Core.start_page:"home";Core.updateMod(f)}}else{$("#loading").hide();$('<h2 class="error_title">出错了,正在努力抢修中...</h2>').appendTo($(".mask"));Core.showTips(t.msg,false,6e3);Core.loadFinished()}},error:function(t,r){var o=localStorage.getItem("data_"+a);if(o&&o!=""){var s=JSON.parse(o);if(typeof s=="object"){Core.Data=s;if(n){e()}else{Core.updateMod("home")}}}Core.showTips("网络出错,请检查网络状态。",false);$("#loading").hide()}})};window.getData=a})(); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/js/login.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/pay.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/select2.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/js/zepto.min.js
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/login.html
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/makefile.js
0 → 100644
1 | +/** | ||
2 | + * 动态生成各游戏皮肤下对应的manifest文件。分别将带上修改时间戳的第三方库、业务逻辑js、 | ||
3 | + * sdk基本样式、指定皮肤样式、皮肤资源文件的路径添加到manifes文件中 | ||
4 | + * 并将修改时间更新到html文档的资源引用中 | ||
5 | + * 配置文件:config.js | ||
6 | + * 生成文件:skin/xxxx/sdk.manifest | ||
7 | + * 运行方法:node makefile.js | ||
8 | + **/ | ||
9 | +var fs = require('fs'), | ||
10 | + PATH = require('path'), | ||
11 | + config = require('./config.js'); | ||
12 | + | ||
13 | +var target = config.target; | ||
14 | +var concat_with_mtime = config.concat_with_mtime; | ||
15 | +var base_js = config.base_js; | ||
16 | +var base_img = config.images; | ||
17 | +var htmls = config.htmls; | ||
18 | +//读取三个html文件的内容,以便后面更新引用信息 | ||
19 | + | ||
20 | +var html_content = []; | ||
21 | +for (i = 0, l = htmls.length; i < l; i++) { | ||
22 | + html_content.push(fs.readFileSync(htmls[i], 'utf-8')); | ||
23 | +} | ||
24 | + | ||
25 | +function formatTime(mtime) { | ||
26 | + var date = ''; | ||
27 | + date += mtime.getFullYear(); | ||
28 | + var month = mtime.getMonth() + 1; | ||
29 | + month < 10 ? date += '0' + month : date += month; | ||
30 | + var day = mtime.getDate(); | ||
31 | + day < 10 ? date += '0' + day : date += day; | ||
32 | + var hour = mtime.getHours(); | ||
33 | + hour < 10 ? date += '0' + hour : date += hour; | ||
34 | + var minute = mtime.getMinutes(); | ||
35 | + minute < 10 ? date += '0' + minute : date += minute; | ||
36 | + return date; | ||
37 | +} | ||
38 | +var content = []; | ||
39 | +var path, mtime, jsPath, reg; | ||
40 | +content.push('CACHE MANIFEST'); | ||
41 | +content.push(''); | ||
42 | + | ||
43 | +var now = new Date(); | ||
44 | +content.push('#version=' + formatTime(now)); | ||
45 | + | ||
46 | +for(var i=0, l= htmls.length; i<l; i++){ | ||
47 | + path = htmls[i]; | ||
48 | + if(PATH.existsSync(path)){ | ||
49 | + // mtime = formatTime(fs.statSync(path).mtime); | ||
50 | + content.push('/static/sdk/' + path);// + '?' + mtime); | ||
51 | + } | ||
52 | +} | ||
53 | +for (i = 0, l = base_js.length; i < l; i++) { | ||
54 | + path = base_js[i]; | ||
55 | + if (PATH.existsSync(path)) { | ||
56 | + mtime = formatTime(fs.statSync(path).mtime); | ||
57 | + content.push('/static/sdk/' + path + '?' + mtime); | ||
58 | + //更新login.html, center.html, pay.html的引用信息的版本号 | ||
59 | + for (var j = 0, k = html_content.length; j < k; j++) { | ||
60 | + reg = new RegExp(path.replace('/', '\\/') + '\\?\\d+') | ||
61 | + html_content[j] = html_content[j].replace(reg, path + '?' + mtime); | ||
62 | + } | ||
63 | + } else { | ||
64 | + console.error('指定文件不存在:' + base_js[i]); | ||
65 | + } | ||
66 | +} | ||
67 | + | ||
68 | +for (i = 0, l = concat_with_mtime.length; i < l; i++) { | ||
69 | + path = concat_with_mtime[i]; | ||
70 | + if (PATH.existsSync(path)) { | ||
71 | + mtime = formatTime(fs.statSync(path).mtime); | ||
72 | + content.push('/static/sdk/' + path + '?' + mtime); | ||
73 | + //更新login.html, center.html, pay.html的引用信息的版本号 | ||
74 | + for (j = 0, k = html_content.length; j < k; j++) { | ||
75 | + reg = new RegExp(path.replace('/', '\\/') + '\\?\\d+') | ||
76 | + html_content[j] = html_content[j].replace(reg, path + '?' + mtime); | ||
77 | + } | ||
78 | + } else { | ||
79 | + console.error('指定文件不存在:' + path); | ||
80 | + } | ||
81 | +} | ||
82 | +// 添加sdk基本图片资源 | ||
83 | +/* | ||
84 | +var base_img_files = fs.readdirSync(base_img); | ||
85 | +for(i=0,l=base_img_files.length; i<l; i++){ | ||
86 | + if(base_img_files[i].indexOf('.') == 0) continue; | ||
87 | + path = base_img + '/' + base_img_files[i]; | ||
88 | + content.push('/static/sdk/' + path); | ||
89 | +} | ||
90 | +*/ | ||
91 | +//获取皮肤的最大mtime | ||
92 | +/* | ||
93 | +var skin_mtime = 0; | ||
94 | +for(i=0, l= target.length; i<l; i++){ | ||
95 | + path = 'skin/' + target[i] + '/skin.css'; | ||
96 | + mtime = parseInt(formatTime(fs.statSync(path).mtime)); | ||
97 | + if(mtime > skin_mtime) skin_mtime = mtime; | ||
98 | +} | ||
99 | +*/ | ||
100 | +//在基础文件上添加对应皮肤的样式和所需要的图片 | ||
101 | + | ||
102 | +var skin_content; | ||
103 | +for (i = 0, l = target.length; i < l; i++) { | ||
104 | + | ||
105 | + path = 'skin/' + target[i]; | ||
106 | + skin_content = content.concat(); | ||
107 | + /* | ||
108 | + skin_content.push('/static/sdk/' + path + '/skin.css' + '?' + skin_mtime); | ||
109 | + */ | ||
110 | + //更新login.html, center.html, pay.html的引用信息的版本号 | ||
111 | + for (j = 0, k = html_content.length; j < k; j++) { | ||
112 | + reg = new RegExp('data-v="\\d+"'); | ||
113 | + html_content[j] = html_content[j].replace(reg, 'data-v="' + skin_mtime + '"'); | ||
114 | + } | ||
115 | + //push the img fiels if exists | ||
116 | + /* | ||
117 | + var images = fs.readdirSync(path + '/img'); | ||
118 | + for (var j = 0, k = images.length; j < k; j++) { | ||
119 | + if(images[j].indexOf('.') == 0) continue; | ||
120 | + var img_path = path + '/img/' + images[j]; | ||
121 | + // mtime = formatTime(fs.statSync(img_path).mtime); | ||
122 | + skin_content.push('/static/sdk/' + path + '/img/' + images[j]) //+ '?' + mtime); | ||
123 | + } | ||
124 | + */ | ||
125 | + skin_content.push('NETWORK:'); | ||
126 | + skin_content.push('*'); | ||
127 | + skin_content = skin_content.join('\n'); | ||
128 | + fs.writeFileSync(path + '/sdk.manifest', skin_content); | ||
129 | +} | ||
130 | + | ||
131 | + | ||
132 | +content.push('NETWORK:'); | ||
133 | +content.push('*'); | ||
134 | +//生成基础的没有皮肤的缓存文件 | ||
135 | +fs.writeFileSync('skin/sdk.manifest', content.join('\n')); | ||
136 | +//将对html文件引用信息的修改写回文件中 | ||
137 | +for(i=0, l=htmls.length; i<l; i++){ | ||
138 | + fs.writeFileSync(htmls[i], html_content[i]); | ||
139 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/pay.html
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/share.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | +<meta name="viewport" content="width=device-width, user-scalable=no,target-densitydpi=device-dpi" /> | ||
5 | +<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
6 | +<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | ||
7 | +<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | ||
8 | +<meta name="format-detection" content="telephone=no"> | ||
9 | +<meta name="screen-orientation" content="portrait"> | ||
10 | +<meta name="full-screen" content="yes"> | ||
11 | +<meta http-equiv="x-ua-compatible" content="IE=edge" /> | ||
12 | +<link href="skin/new_sdk.min.css?v=20150318002" type="text/css" rel="stylesheet" /> | ||
13 | +<link id="skin" data-v="20150318001" type="text/css" rel="stylesheet" /> | ||
14 | +<link href="skin/responsive.min.css?v=20150318001" type="text/css" rel="stylesheet" /> | ||
15 | +<title> | ||
16 | +游娱手游平台登录 | ||
17 | +</title> | ||
18 | +</head> | ||
19 | +<body> | ||
20 | + | ||
21 | + | ||
22 | +<div class="mask"> | ||
23 | +<div class="container_load" id="loading"> | ||
24 | + <div class="content"> | ||
25 | + <div class="circle"></div> | ||
26 | + <div class="circle1"></div> | ||
27 | + </div> | ||
28 | +</div> | ||
29 | +<div class="alert alert-success hide" id="alert"> | ||
30 | + <button type="button" class="close" data-dismiss="alert">×</button> | ||
31 | + <span></span> | ||
32 | +</div> | ||
33 | +<section id="home" data-attr="dot" class="hide"></section> | ||
34 | +<section id="frame" data-attr="dot" class="hide" ></section> | ||
35 | +<script id="frame_template" type="text/x-jquery-tmpl" > | ||
36 | + <div class="header"> | ||
37 | + <span class="title">{{=Core.Data.frame_title}}</span> | ||
38 | + <a class="btn pull-left op-back" href="#main">返回</a> | ||
39 | + </div> | ||
40 | + <div class="container" style=""> | ||
41 | + <div class="container_load in_frame" id="loading_frame"> | ||
42 | + <div class="content"> | ||
43 | + <div class="circle"></div> | ||
44 | + <div class="circle1"></div> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + {{? Core.isIos}}<div class="ios_scroll">{{?}} | ||
48 | + <iframe frameborder=0 src="{{=Core.Data.frame_src}}" scrolling="yes" width="100%" height="100%"></iframe> | ||
49 | + {{? Core.isIos}}</div>{{?}} | ||
50 | + </div> | ||
51 | +</script> | ||
52 | +<script id="home_template" type="text/x-jquery-tmpl"> | ||
53 | + <div class="header"> | ||
54 | + <span class="title">分享游戏</span> | ||
55 | + <a class="btn pull-left op-back" href="sdk://exit?action=share">回到游戏</a> | ||
56 | + </div> | ||
57 | + <div class="container"> | ||
58 | + <div class="box_info_center"> | ||
59 | + <div class="share_box1"> | ||
60 | + <div class="share_game clearfix"> | ||
61 | + <img class="pull-left game_face" src="{{=Core.Data.icon || ''}}" height="75" width="75"> | ||
62 | + <textarea class="s_content">{{=Core.Data.content || '这款游戏还不错噢,一起来玩吧!'}}</textarea> | ||
63 | + </div> | ||
64 | + </div> | ||
65 | + <div class="share_box2"> | ||
66 | + <div class=""> | ||
67 | + <h3 class="text-info">分享到</h3> | ||
68 | + <ul class="other-login inline clearfix"> | ||
69 | + <li><a href="/sdk/share/game/qq/?app_id={{=Core.Data.app_id || ''}}" class="qq" title="QQ空间分享"></a></li> | ||
70 | + <li><a href="/sdk/share/game/sina/?app_id={{=Core.Data.app_id || ''}}" class="sina" title="新浪微博分享"></a></li> | ||
71 | + <li><a href="/sdk/share/game/tqq/?app_id={{=Core.Data.app_id || ''}}" class="tqq" title="腾讯微博分享"></a></li> | ||
72 | + </ul> | ||
73 | + <div class="invite_box"> | ||
74 | + <h3 class="text-info">奖励说明:</h3> | ||
75 | + <p> | ||
76 | + 1.成功邀请好友一起玩游戏,您可获得<span class="text-info">5{{=Core.Data.game_unit_name}}</span>的奖励。 | ||
77 | + </p> | ||
78 | + <p> | ||
79 | + 2.好友若充值(限前10笔),您可获得<span class="text-info">5%</span>充值奖励。 | ||
80 | + </p> | ||
81 | + <p> | ||
82 | + 3.好友首次充值,因被您邀请可额外获得<span class="text-info">10%</span>充值返利。 | ||
83 | + </p> | ||
84 | + </div> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + </div> | ||
88 | + </div> | ||
89 | +</script> | ||
90 | +</div> | ||
91 | + | ||
92 | +<script type="text/javascript" src="js/fastclick.min.1.0.js?201309041309"></script> | ||
93 | +<script type="text/javascript" src="js/zepto.min.js?201309041309"></script> | ||
94 | +<script type="text/javascript" src="js/doT.min.js?201309041309" ></script> | ||
95 | +<script type="text/javascript"> | ||
96 | +window.isGetData = 0; | ||
97 | +$(function() { | ||
98 | +FastClick.attach(document.body); | ||
99 | +}); | ||
100 | +</script> | ||
101 | +<script type="text/javascript" src="js/core.min.js?201403141112" ></script> | ||
102 | +<script type="text/javascript"> | ||
103 | + (function(){ | ||
104 | + // Home模块 | ||
105 | + var Home = function(modId) { | ||
106 | + Module.call(this, modId); | ||
107 | + } | ||
108 | + // 继承基础模块 | ||
109 | + Core.inherit(Home, Module); | ||
110 | + Home.prototype.bind = function(){ | ||
111 | + var that = this; | ||
112 | + that.$c.on('click', '.other-login a', function(e){ | ||
113 | + e.preventDefault(); | ||
114 | + //分享连接 | ||
115 | + var $tar = $(e.target); | ||
116 | + var content = that.$c.find('.s_content').val(); | ||
117 | + $tar.attr('params', 'content=' + content); | ||
118 | + Core.ajax_do($tar, function(data){ | ||
119 | + console.log(data); | ||
120 | + if(data.code == 0){ | ||
121 | + if(data.msg.next_url){ | ||
122 | + // 需要重新授权 | ||
123 | + var src = data.msg.next_url; | ||
124 | + if (Core.isFile) { | ||
125 | + src = Core.server + src; | ||
126 | + } | ||
127 | + Core.Data.frame_title = $tar.attr('title'); | ||
128 | + Core.Data.frame_src = src; | ||
129 | + Core.updateMod('frame'); | ||
130 | + } else { | ||
131 | + // | ||
132 | + Core.showTips(data.msg); | ||
133 | + } | ||
134 | + } | ||
135 | + }, that); | ||
136 | + }); | ||
137 | + } | ||
138 | + Core.registerMod('home', Home); | ||
139 | + var Frame = function(modId) { | ||
140 | + Module.call(this, modId); | ||
141 | + } | ||
142 | + Core.inherit(Frame, Module); | ||
143 | + Frame.prototype.show_after = function() { | ||
144 | + var that = this; | ||
145 | + var _des = Core.last_mod ? Core.last_mod : 'home'; | ||
146 | + this.$c.find('a.btn.pull-left').attr('href', '#' + _des); | ||
147 | + this.$c.find('iframe')[0].onload = function() { | ||
148 | + that.$c.find('#loading_frame').hide(); | ||
149 | + } | ||
150 | + } | ||
151 | + Core.registerMod('frame', Frame); | ||
152 | + })(); | ||
153 | +</script> | ||
154 | +<script type="text/javascript" src="js/loader.min.js?201401151617"></script> | ||
155 | +<script type="text/javascript"> | ||
156 | +(function(){ | ||
157 | + window.isGetData = 1; | ||
158 | + getData('/game/info/'); | ||
159 | +})(); | ||
160 | +</script> | ||
161 | + | ||
162 | +</body> | ||
163 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/skin/login.css
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/skin/pay.css
0 → 100644
This diff is collapsed. Click to expand it.
assets/sdk/skin/sdk.manifest
0 → 100644
1 | +CACHE MANIFEST | ||
2 | + | ||
3 | +#version=20151112001 | ||
4 | +/static/sdk_3/login.html?20151112001 | ||
5 | +/static/sdk_3/center.html?20151112001 | ||
6 | +/static/sdk_3/pay.html?20151112001 | ||
7 | +/static/sdk_3/share.html?20151112001 | ||
8 | +/static/sdk_3/js/fastclick.min.1.0.js?20151112001 | ||
9 | +/static/sdk_3/js/zepto.min.js?20151112001 | ||
10 | +/static/sdk_3/js/doT.min.js?20151112001 | ||
11 | +/static/sdk_3/js/iscroll.min.1.0.js?20151112001 | ||
12 | +/static/sdk_3/skin/login.css?20151112001 | ||
13 | +/static/sdk_3/skin/pay.css?20151112001 | ||
14 | + | ||
15 | +/static/sdk_3/js/core.min.js?20151112001 | ||
16 | +/static/sdk_3/js/loader.min.js?20151112001 | ||
17 | +/static/sdk_3/js/center.min.js?20151112001 | ||
18 | +/static/sdk_3/js/pay.min.js?20151112001 | ||
19 | +/static/sdk_3/js/login.min.js?20151112001 | ||
20 | +/static/sdk_3/images/login_icon.png?20151112001 | ||
21 | +/static/sdk_3/images/new-sdk-logo.png?20151112001 | ||
22 | +NETWORK: | ||
23 | +* | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/sdk/version.txt
0 → 100644
1 | +20170110 |
libs/.DS_Store
0 → 100644
No preview for this file type
libs/UPPayAssistEx.jar
0 → 100644
No preview for this file type
libs/UPPayPluginExPro.jar
0 → 100644
No preview for this file type
libs/alipaySdk-20151112.jar
0 → 100644
No preview for this file type
libs/android-support-v4.jar
0 → 100644
No preview for this file type
libs/arm64-v8a/libentryexpro.so
0 → 100644
No preview for this file type
libs/arm64-v8a/libuptsmaddon.so
0 → 100644
No preview for this file type
libs/armeabi-v7a/libentryexpro.so
0 → 100644
No preview for this file type
libs/armeabi-v7a/libuptsmaddon.so
0 → 100644
No preview for this file type
libs/armeabi/libentryexpro.so
0 → 100644
No preview for this file type
libs/armeabi/libuptsmaddon.so
0 → 100644
No preview for this file type
libs/libammsdk.jar
0 → 100644
No preview for this file type
libs/mips/libentryexpro.so
0 → 100644
No preview for this file type
libs/x86/libentryexpro.so
0 → 100644
No preview for this file type
libs/x86/libuptsmaddon.so
0 → 100644
No preview for this file type
libs/x86_64/libentryexpro.so
0 → 100644
No preview for this file type
libs/x86_64/libuptsmaddon.so
0 → 100644
No preview for this file type
wxapi/WXEntryActivity.java
0 → 100644
1 | +package com.tencent.youai.shushan.wxapi; | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | +import android.app.Activity; | ||
9 | +import android.content.Intent; | ||
10 | +import android.os.Bundle; | ||
11 | +import android.os.Handler; | ||
12 | +import android.os.Message; | ||
13 | +import android.util.Log; | ||
14 | + | ||
15 | +import com.tencent.mm.sdk.modelbase.BaseReq; | ||
16 | +import com.tencent.mm.sdk.modelbase.BaseResp; | ||
17 | +import com.tencent.mm.sdk.modelmsg.SendAuth.Resp; | ||
18 | +import com.tencent.mm.sdk.openapi.IWXAPI; | ||
19 | +import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; | ||
20 | +import com.tencent.mm.sdk.openapi.WXAPIFactory; | ||
21 | +import com.youai.sdk.YouaiSDK; | ||
22 | + | ||
23 | +public class WXEntryActivity extends Activity implements IWXAPIEventHandler{ | ||
24 | + | ||
25 | + private static final String TAG = "MicroMsg.SDKSample.WXEntryActivity"; | ||
26 | + | ||
27 | + private IWXAPI api; | ||
28 | + | ||
29 | + private Handler checkLoginHandler = new Handler(){ | ||
30 | + public void handleMessage(android.os.Message msg) { | ||
31 | + YouaiSDK.open_url((String) msg.obj); | ||
32 | + }; | ||
33 | + }; | ||
34 | + | ||
35 | + @Override | ||
36 | + public void onCreate(Bundle savedInstanceState) { | ||
37 | + super.onCreate(savedInstanceState); | ||
38 | + api = WXAPIFactory.createWXAPI(this, YouaiSDK.weixinAppId); | ||
39 | + api.handleIntent(getIntent(), this); | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + protected void onNewIntent(Intent intent) { | ||
44 | + super.onNewIntent(intent); | ||
45 | + setIntent(intent); | ||
46 | + api.handleIntent(intent, this); | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + @Override | ||
51 | + public void onReq(BaseReq arg0) { | ||
52 | + // TODO Auto-generated method stub | ||
53 | + | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public void onResp(BaseResp resp) { | ||
58 | + Log.d(TAG, "0成功,-1错误,-2用户取消 onLoginFinish, errCode = " + resp.errCode); | ||
59 | + if (YouaiSDK.lastCallBack != null) { | ||
60 | + if(resp.errCode == 0){ | ||
61 | + if(resp instanceof Resp) { | ||
62 | + Resp var7 = (Resp)resp; | ||
63 | + Log.d("YSDK_USER_WX", "code: " + var7.code); | ||
64 | + Message msg = Message.obtain(); | ||
65 | + msg.obj = var7.code; | ||
66 | + checkLoginHandler.sendMessageDelayed(msg , 3000); | ||
67 | + //YouaiSDK.open_url(var7.code); | ||
68 | + }else{ | ||
69 | + Intent i = new Intent(); | ||
70 | + i.putExtra("msg", "充值成功"); | ||
71 | + YouaiSDK.lastCallBack.onEventDispatch(YouaiSDK.PAY_ACTION_CODE, i); | ||
72 | + } | ||
73 | +// YouaiSDK.lastCallBack.onEventDispatch(YouaiSDK.PAY_ACTION_CODE, i); | ||
74 | + }else if(resp.errCode == -2){ | ||
75 | + Intent i = new Intent(); | ||
76 | + i.putExtra("msg", "用户取消"); | ||
77 | + YouaiSDK.lastCallBack.onEventDispatch(YouaiSDK.PAY_ACTION_CODE, i); | ||
78 | + } | ||
79 | + } | ||
80 | + finish(); | ||
81 | + } | ||
82 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
wxapi/WXPayEntryActivity.java
0 → 100644
1 | +package com.tencent.youai.shushan.wxapi; | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | +import android.app.Activity; | ||
9 | +import android.content.Intent; | ||
10 | +import android.os.Bundle; | ||
11 | +import android.util.Log; | ||
12 | + | ||
13 | +import com.tencent.mm.sdk.modelbase.BaseReq; | ||
14 | +import com.tencent.mm.sdk.modelbase.BaseResp; | ||
15 | +import com.tencent.mm.sdk.openapi.IWXAPI; | ||
16 | +import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; | ||
17 | +import com.tencent.mm.sdk.openapi.WXAPIFactory; | ||
18 | +import com.youai.sdk.YouaiSDK; | ||
19 | + | ||
20 | +public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler{ | ||
21 | + | ||
22 | + private static final String TAG = "MicroMsg.SDKSample.WXPayEntryActivity"; | ||
23 | + | ||
24 | + private IWXAPI api; | ||
25 | + | ||
26 | + @Override | ||
27 | + public void onCreate(Bundle savedInstanceState) { | ||
28 | + super.onCreate(savedInstanceState); | ||
29 | + api = WXAPIFactory.createWXAPI(this, YouaiSDK.weixinAppId); | ||
30 | + api.handleIntent(getIntent(), this); | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + protected void onNewIntent(Intent intent) { | ||
35 | + super.onNewIntent(intent); | ||
36 | + setIntent(intent); | ||
37 | + api.handleIntent(intent, this); | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public void onReq(BaseReq req) { | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public void onResp(BaseResp resp) { | ||
46 | + Log.d(TAG, "0成功,-1错误,-2用户取消 onPayFinish, errCode = " + resp.errCode); | ||
47 | + if (YouaiSDK.lastCallBack != null) { | ||
48 | + if(resp.errCode == 0){ | ||
49 | + Intent i = new Intent(); | ||
50 | + i.putExtra("msg", "充值成功"); | ||
51 | + YouaiSDK.lastCallBack.onEventDispatch(YouaiSDK.PAY_ACTION_CODE, i); | ||
52 | + }else if(resp.errCode == -2){ | ||
53 | + Intent i = new Intent(); | ||
54 | + i.putExtra("msg", "用户取消"); | ||
55 | + YouaiSDK.lastCallBack.onEventDispatch(YouaiSDK.PAY_ACTION_CODE, i); | ||
56 | + } | ||
57 | + } | ||
58 | + finish(); | ||
59 | + | ||
60 | + } | ||
61 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment