Commit 855474a9 authored by zhangjinzhou's avatar zhangjinzhou

代码暂存

parent e7177f55
...@@ -19,4 +19,5 @@ export interface INetData { ...@@ -19,4 +19,5 @@ export interface INetData {
addUrl?: string; addUrl?: string;
//是否显示错误提示 //是否显示错误提示
hideMsg?: boolean; hideMsg?: boolean;
addgtime?:boolean
} }
\ No newline at end of file
...@@ -24,15 +24,18 @@ export abstract class ABNetManager { ...@@ -24,15 +24,18 @@ export abstract class ABNetManager {
* @param net * @param net
*/ */
public send(net: INetData): void { public send(net: INetData): void {
let gTime: string = '?_=' + GTime.getTimestamp(); let addgtime = net.addgtime;
let realUrl: string = net.uri; let realUrl: string = net.uri;
if (realUrl.indexOf('?') != -1) { if(!addgtime){
gTime = '&_=' + GTime.getTimestamp(); let gTime: string = '?_=' + GTime.getTimestamp();
if (realUrl.indexOf('?') != -1) {
gTime = '&_=' + GTime.getTimestamp();
}
realUrl += gTime;
} }
realUrl += gTime;
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点) //url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if (net.addUrl) { if (net.addUrl) {
realUrl += net.addUrl; realUrl += net.addUrl;
...@@ -133,8 +136,11 @@ export abstract class ABNetManager { ...@@ -133,8 +136,11 @@ export abstract class ABNetManager {
// } else { // } else {
// console.log("不加密请求post"); // console.log("不加密请求post");
//修改 //修改
url = "https://"+window.location.host+url; if(url.indexOf("https:")==-1){
url = url.indexOf('http:') > -1 || url.indexOf('https:') > -1 ? url : window.location.protocol + url; url = "https://"+window.location.host+url;
url = url.indexOf('http:') > -1 || url.indexOf('https:') > -1 ? url : window.location.protocol + url;
}
// } // }
// console.log("新post------发送请求",url,_refer,photoInfo,postData); // console.log("新post------发送请求",url,_refer,photoInfo,postData);
var upload = new Promise(function (resolve, reject) { var upload = new Promise(function (resolve, reject) {
......
...@@ -87,6 +87,6 @@ export enum NetName { ...@@ -87,6 +87,6 @@ export enum NetName {
EXCHANGE_COIN, EXCHANGE_COIN,
GET_CLOUD_NUM, GET_CLOUD_NUM,
GET_CONFIG, GET_CONFIG,
GAME_GETSHARECODE,//获取口令
} }
\ No newline at end of file
...@@ -2587,4 +2587,22 @@ export class NetManager extends ABNetManager { ...@@ -2587,4 +2587,22 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public getShareContent(callback,activityCode,sceneCode,token){
const net: INetData = {
name: "generateCode",
uri: "https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do?activityCode="+activityCode+"&sceneCode="+sceneCode+"&token="+token,
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
// activityCode:activityCode,
// sceneCode:sceneCode,
// token:token
},
addgtime:true,
callback: callback
};
this.send(net);
}
} }
\ No newline at end of file
...@@ -3,6 +3,8 @@ import ComponentBase from "../../libs/new_wx/components/ComponentBase"; ...@@ -3,6 +3,8 @@ import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import layers from "../../libs/new_wx/views/layers"; import layers from "../../libs/new_wx/views/layers";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { INetData } from "../../libs/tc/interface/INetData";
import { NetName } from "../../libs/tw/enum/NetName";
export enum CodeChannels { export enum CodeChannels {
/** /**
...@@ -110,10 +112,12 @@ class ShareCodePanel extends ComponentBase { ...@@ -110,10 +112,12 @@ class ShareCodePanel extends ComponentBase {
//获取code先 //获取code先
generateCode((s, res) => { generateCode((s, res) => {
if (!s || !res.data || !res.data.result || !res.data.result.content) { if(res&&res.data&&res.data.result&&res.data.result.content){
return this.code = res.data.result.content;
}else{
return;
} }
this.code = res.data.result.content;
}, this.data.channel, this.data.shareCode) }, this.data.channel, this.data.shareCode)
} }
...@@ -216,7 +220,9 @@ class ShareCodePanel extends ComponentBase { ...@@ -216,7 +220,9 @@ class ShareCodePanel extends ComponentBase {
if (!this.code) { if (!this.code) {
this.enableMouseEvent(false) this.enableMouseEvent(false)
generateCode((s, res) => { generateCode((s, res) => {
if (!s || !res.data || !res.data.result || !res.data.result.content) { if(res&&res.data&&res.data.result&&res.data.result.content){
// this.code = res.data.result.content;
}else{
this.enableMouseEvent(true) this.enableMouseEvent(true)
showToast("口令生成失败,请重试") showToast("口令生成失败,请重试")
return return
...@@ -308,23 +314,31 @@ function generateCode(callback: Function, channel: CodeChannels, shareCode: stri ...@@ -308,23 +314,31 @@ function generateCode(callback: Function, channel: CodeChannels, shareCode: stri
// var activityCode = "ACT0000002664"; // var activityCode = "ACT0000002664";
var sceneCode = channel; var sceneCode = channel;
var token = shareCode || "0"; var token = shareCode || "0";
window['$'].ajax({ const param:any = {
type: "post", activityCode,
url: "https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do", sceneCode,
dataType: "json", token
data: { }
activityCode, console.log("新请求233567456");
sceneCode, NetManager.ins.getShareContent(callback,activityCode,sceneCode,token);
token
}, // window['$'].ajax({
async: true, // type: "post",
success: (result) => { // url: "https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do",
callback(true, result) // dataType: "json",
}, // data: {
error: (message) => { // activityCode,
callback(false, message) // sceneCode,
} // token
}); // },
// async: true,
// success: (result) => {
// callback(true, result)
// },
// error: (message) => {
// callback(false, message)
// }
// });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment