Commit 855474a9 authored by zhangjinzhou's avatar zhangjinzhou

代码暂存

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