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,14 +24,17 @@ export abstract class ABNetManager { ...@@ -24,14 +24,17 @@ 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(!addgtime){
let gTime: string = '?_=' + GTime.getTimestamp();
if (realUrl.indexOf('?') != -1) { if (realUrl.indexOf('?') != -1) {
gTime = '&_=' + GTime.getTimestamp(); gTime = '&_=' + GTime.getTimestamp();
} }
realUrl += gTime; realUrl += gTime;
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点) //url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if (net.addUrl) { if (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");
//修改 //修改
if(url.indexOf("https:")==-1){
url = "https://"+window.location.host+url; url = "https://"+window.location.host+url;
url = url.indexOf('http:') > -1 || url.indexOf('https:') > -1 ? url : window.location.protocol + 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; this.code = res.data.result.content;
}else{
return;
}
}, 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",
url: "https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do",
dataType: "json",
data: {
activityCode, activityCode,
sceneCode, sceneCode,
token token
},
async: true,
success: (result) => {
callback(true, result)
},
error: (message) => {
callback(false, message)
} }
}); console.log("新请求233567456");
NetManager.ins.getShareContent(callback,activityCode,sceneCode,token);
// window['$'].ajax({
// type: "post",
// url: "https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do",
// dataType: "json",
// data: {
// activityCode,
// 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