Commit 791659cc authored by mengcuiguang's avatar mengcuiguang

添加快手登录

parent 09c6e09e
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
versionName: 'v 1.0.0', versionName: 'v 1.0.0',
auth: false, // 三要素实名认证 auth: false, // 三要素实名认证
userInfo: null, userInfo: null,
pkgName: 'com.mints.minivideo' pkgName: 'com.mints.ksbrightvideo'
} }
}; };
</script> </script>
......
...@@ -156,7 +156,6 @@ ...@@ -156,7 +156,6 @@
let vipBean = this.vipList[this.selectedIndex]; let vipBean = this.vipList[this.selectedIndex];
// 快手支付 // 快手支付
// #ifdef MP-KUAISHOU
this.post({ this.post({
url: '/vip/getVipPayParams/kuaishou', url: '/vip/getVipPayParams/kuaishou',
data: { data: {
...@@ -170,43 +169,6 @@ ...@@ -170,43 +169,6 @@
that.ksPay(data, vipBean.largeType); that.ksPay(data, vipBean.largeType);
} }
}); });
// #endif
// 抖音支付
// #ifdef MP-TOUTIAO
this.post({
url: '/vip/getVipPayParams/douyin',
data: {
vedioId: that.point <= 0 ? null : that.vedioId,
pid: vipBean.pid
},
showLoading: true,
success: ({
data
}) => {
that.ttPay(data, vipBean.largeType);
}
});
// #endif
// 微信虚拟支付
// #ifdef MP-WEIXIN
this.post({
url: '/vip/getVipPayParams/xpay',
data: {
vedioId: that.point <= 0 ? null : that.vedioId,
pid: vipBean.pid
},
showLoading: true,
success: ({
data
}) => {
that.wxVirtuallyPay(data, vipBean.largeType);
}
});
// #endif
}, },
ksPay(ksData, largeType) { ksPay(ksData, largeType) {
let that = this; let that = this;
...@@ -222,68 +184,6 @@ ...@@ -222,68 +184,6 @@
}, },
}) })
}, },
ttPay(ttData, largeType) {
let that = this;
tt.pay({
orderInfo: {
order_id: ttData.params.order_id,
order_token: ttData.params.order_token,
},
service: 5,
success(res) {
if (res.code == 0) {
// 拉取服务器,是否支付成功
that.queryOrderStatus(largeType, ttData.tidStr)
}
},
fail(res) {
message.notify(res.errMsg);
},
});
},
wxPay(wxData, largeType) {
let wxParams = wxData.params;
let that = this;
// 发起微信支付
wx.requestPayment({
timeStamp: wxParams.timeStamp,
nonceStr: wxParams.nonceStr,
package: wxParams.packageStr,
signType: wxParams.signType,
paySign: wxParams.paySign,
success(res) {
that.queryOrderStatus(largeType, wxData.tid)
},
fail(res) {}
})
},
wxVirtuallyPay(wxData, largeType) {
// 虚拟支付
let wxParams = wxData.params;
let signDataParams = wxData.params.sigData;
let that = this;
const SDKVersion = wx.getSystemInfoSync().SDKVersion;
if (this.compareVersion(SDKVersion, '2.19.2') >= 0 || wx.canIUse('requestVirtualPayment')) {
wx.requestVirtualPayment({
signData: JSON.stringify(wxData.params.sigData),
paySig: wxParams.paySig,
signature: wxParams.signature,
mode: wxParams.mode,
success(res) {
// 拉取服务器,是否支付成功
that.queryOrderStatus(largeType, wxData.params.sigData.outTradeNo)
},
fail({
errMsg,
errCode
}) {
message.notify(errMsg);
},
})
} else {
message.notify('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。');
}
},
queryOrderStatus(largeType, tid) { queryOrderStatus(largeType, tid) {
let that = this; let that = this;
this.post({ this.post({
...@@ -298,33 +198,6 @@ ...@@ -298,33 +198,6 @@
that.paySuccess(largeType); that.paySuccess(largeType);
} }
}); });
},
compareVersion(_v1, _v2) {
if (typeof _v1 !== 'string' || typeof _v2 !== 'string') return 0
const v1 = _v1.split('.')
const v2 = _v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i], 10)
const num2 = parseInt(v2[i], 10)
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
} }
}, },
watch: { watch: {
......
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
"uniStatistics" : { "uniStatistics" : {
"enable" : false "enable" : false
}, },
"appid" : "ks702843017315155644" "appid" : "ks707909569734019079"
}, },
"mp-lark" : { "mp-lark" : {
"uniStatistics" : { "uniStatistics" : {
......
...@@ -142,8 +142,8 @@ export default { ...@@ -142,8 +142,8 @@ export default {
// #endif // #endif
Object.assign(header, { Object.assign(header, {
// token: uni.getStorageSync('token'), token: uni.getStorageSync('token'),
token: 'A4A51158A9011FE1B2B0D8E35D657258483D433C42E9B84882577C78642C25CF5F433703067DF5142735505C42F58997', // token: 'A4A51158A9011FE1B2B0D8E35D657258483D433C42E9B84882577C78642C25CF5F433703067DF5142735505C42F58997',
pkgName: app.globalData.pkgName, pkgName: app.globalData.pkgName,
proChannel:uniChannel proChannel:uniChannel
}) })
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
} }
}, },
"pages": [ "pages": [
// { {
// "path": "pages/loading", "path": "pages/loading",
// "style": { "style": {
// "navigationStyle": "default", "navigationStyle": "default",
// "navigationBarBackgroundColor": "#F2F1FF", "navigationBarBackgroundColor": "#F2F1FF",
// "navigationBarTextStyle": "#000000" "navigationBarTextStyle": "#000000"
// } }
// }, },
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
......
...@@ -40,28 +40,20 @@ ...@@ -40,28 +40,20 @@
}, },
onLoad(options) { onLoad(options) {
this.tips1 = options.tips1 this.tips1 = options.tips1
// #ifdef MP-TOUTIAO
this.appName = '巨爽短剧' this.appName = '巨爽短剧'
// #endif
// #ifdef MP-WEIXIN
this.appName = '河狸刷剧'
// #endif
}, },
onShow(options) { onShow(options) {
// #ifdef MP-TOUTIAO
this.ttLoging()
// #endif
// #ifdef MP-WEIXIN this.ksLoging()
this.wxlogin()
// #endif // setTimeout(() => {
// redirectTo('home');
// }, 1500);
}, },
methods: { methods: {
ttLoging() { ksLoging() {
var that = this; var that = this;
var obj = tt.getLaunchOptionsSync() var obj = ks.getLaunchOptionsSync()
var channel = 'mints' // 渠道 var channel = 'mints' // 渠道
var clueToken = '' // 归因参数 var clueToken = '' // 归因参数
...@@ -80,13 +72,14 @@ ...@@ -80,13 +72,14 @@
var remark1 = ''; // 预留 var remark1 = ''; // 预留
var remark2 = ''; // 预留 var remark2 = ''; // 预留
var remark3 = ''; // 预留 var remark3 = ''; // 预留
var thirdParam = '';
var mid1 = ""; var mid1 = "";
var mid2 = ""; var mid2 = "";
var mid3 = ""; var mid3 = "";
var mid4 = ""; var mid4 = "";
var mid5 = ""; var mid5 = "";
zs_os = wx.getSystemInfoSync().platform; zs_os = ks.getSystemInfoSync().platform;
// 判断渠道来源 // 判断渠道来源
if (obj.query.clue_token ?? '' != '') { if (obj.query.clue_token ?? '' != '') {
...@@ -112,6 +105,7 @@ ...@@ -112,6 +105,7 @@
mid3 = obj.query.mid3 ?? '' mid3 = obj.query.mid3 ?? ''
mid4 = obj.query.mid4 ?? '' mid4 = obj.query.mid4 ?? ''
mid5 = obj.query.mid5 ?? '' mid5 = obj.query.mid5 ?? ''
thirdParam = JSON.stringify(obj.query)
} else if (obj.query.ksChannel ?? '' != '') { } else if (obj.query.ksChannel ?? '' != '') {
// 快手渠道参数 // 快手渠道参数
channel = 'kuaishou' channel = 'kuaishou'
...@@ -130,134 +124,11 @@ ...@@ -130,134 +124,11 @@
remark3 = obj.query.remark3 ?? '' remark3 = obj.query.remark3 ?? ''
vedio_index = obj.query.vedio_index ?? '' vedio_index = obj.query.vedio_index ?? ''
free_index = obj.query.free_index ?? '' free_index = obj.query.free_index ?? ''
thirdParam = JSON.stringify(obj.query)
} else { } else {
// 自有渠道 // 自有渠道
channel = 'other'
}
// 打印渠道参数
if (this.tips1 == 'mints_vedio' || tips2 == 'mints_vedio') {
this.slotParam = JSON.stringify(obj.query);
this.$refs.select.open('center');
}
tt.login({
force: true,
success(res) {
console.log(`login 调用成功${res.code} ${res.anonymousCode}`);
that.post({
url: '/user/ttLogin',
data: {
channel: channel,
clueToken: clueToken,
code: res.code,
anonymousCode: res.anonymousCode,
adId: adId,
advertiserId: advertiserId,
reqId: reqId,
promotionId: promotionId,
projectId: projectId,
productType: product_type,
vedioId: vedio_id,
remark1: remark1,
remark2: remark2,
remark3: remark3,
os: zs_os,
vedioIndex: vedio_index,
freeIndex: free_index,
mid1: mid1,
mid2: mid2,
mid3: mid3,
mid4: mid4,
mid5: mid5,
zsChannel: zs_channel
},
showLoading: false,
success: ({
data
}) => {
uni.setStorage({
key: 'token',
data: data.token
});
app.globalData.userInfo = data;
setTimeout(() => {
redirectTo('home');
}, 1500);
}
});
},
fail(res) {
console.log(`login 调用失败`);
},
});
},
wxlogin() {
var that = this;
var obj = wx.getLaunchOptionsSync()
var channel = 'mints' // 渠道
var clueToken = '' // 归因参数
var adId = '' // 计划id
var advertiserId = '' // 账号id
var reqId = '' // 请求id
var promotionId = '' // aid
var projectId = '';
var tips2 = ''; // 投放测试标记
var product_type = ''; //自有产品
var zs_channel = ''; // 自有渠道
var vedio_id = ''; // 自有剧
var zs_os = ''; // 当前系统
var vedio_index = ''; // 自有剧
var free_index = ''; // 自有剧
var remark1 = ''; // 预留
var remark2 = ''; // 预留
var remark3 = ''; // 预留
var mid1 = "";
var mid2 = "";
var mid3 = "";
var mid4 = "";
var mid5 = "";
zs_os = wx.getSystemInfoSync().platform;
// 判断渠道来源
if (obj.query.clue_token ?? '' != '') {
// 头条渠道参数
channel = 'tt'
clueToken = obj.query.clue_token ?? ''
adId = obj.query.ad_id ?? ''
advertiserId = obj.query.advertiser_id ?? ''
reqId = obj.query.req_id ?? ''
promotionId = obj.query.promotion_id ?? ''
projectId = obj.query.project_id ?? ''
tips2 = obj.query.tips2 ?? ''
product_type = obj.query.product_type ?? ''
zs_channel = obj.query.zs_channel ?? ''
vedio_id = obj.query.vedio_id ?? ''
free_index = obj.query.free_index ?? ''
remark1 = obj.query.remark1 ?? ''
remark2 = obj.query.remark2 ?? ''
remark3 = obj.query.remark3 ?? ''
vedio_index = obj.query.vedio_index ?? ''
mid1 = obj.query.mid1 ?? ''
mid2 = obj.query.mid2 ?? ''
mid3 = obj.query.mid3 ?? ''
mid4 = obj.query.mid4 ?? ''
mid5 = obj.query.mid5 ?? ''
} else if (obj.query.ksChannel ?? '' != '') {
// 快手渠道参数
channel = 'kuaishou'
adId = obj.query.ksUnitId ?? '' //组id
advertiserId = obj.query.ksSiteAccountId ?? '' //账户id
clueToken = obj.query.callback ?? '' //快手归因参数
reqId = obj.query.ksCampaignId ?? '' //计划id
promotionId = obj.query.ksPageId ?? '' //落地页id
tips2 = obj.query.tips2 ?? '' tips2 = obj.query.tips2 ?? ''
projectId = obj.query.ksCreativeId ?? '' //创意id
product_type = obj.query.product_type ?? '' product_type = obj.query.product_type ?? ''
zs_channel = obj.query.zs_channel ?? '' zs_channel = obj.query.zs_channel ?? ''
vedio_id = obj.query.vedio_id ?? '' vedio_id = obj.query.vedio_id ?? ''
...@@ -266,9 +137,7 @@ ...@@ -266,9 +137,7 @@
remark3 = obj.query.remark3 ?? '' remark3 = obj.query.remark3 ?? ''
vedio_index = obj.query.vedio_index ?? '' vedio_index = obj.query.vedio_index ?? ''
free_index = obj.query.free_index ?? '' free_index = obj.query.free_index ?? ''
} else { thirdParam = JSON.stringify(obj.query)
// 自有渠道
} }
// 打印渠道参数 // 打印渠道参数
...@@ -277,16 +146,14 @@ ...@@ -277,16 +146,14 @@
this.$refs.select.open('center'); this.$refs.select.open('center');
} }
uni.login({ ks.login({
provider: 'weixin', success(res) {
success: function(loginRes) {
that.post({ that.post({
url: '/user/wechatlogin', url: '/user/ksLogin',
data: { data: {
channel: channel, channel: channel,
clueToken: clueToken, clueToken: clueToken,
code: loginRes.code, code: res.code,
adId: adId, adId: adId,
advertiserId: advertiserId, advertiserId: advertiserId,
reqId: reqId, reqId: reqId,
...@@ -305,6 +172,7 @@ ...@@ -305,6 +172,7 @@
mid3: mid3, mid3: mid3,
mid4: mid4, mid4: mid4,
mid5: mid5, mid5: mid5,
thirdParam: thirdParam,
zsChannel: zs_channel zsChannel: zs_channel
}, },
showLoading: false, showLoading: false,
...@@ -317,17 +185,20 @@ ...@@ -317,17 +185,20 @@
}); });
app.globalData.userInfo = data; app.globalData.userInfo = data;
setTimeout(() => { setTimeout(() => {
redirectTo('home'); uni.switchTab({
url: '/pages/index/index'
});
}, 1500); }, 1500);
} }
}); });
}, },
fail: function(err) { fail(res) {
// 登录授权失败 console.log(`login 调用失败`);
message.notify('登录授权失败 错误码:' + err.code); },
}
}); });
} }
} }
}; };
</script> </script>
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
// }); // });
// } // }
wx.makePhoneCall({ ks.makePhoneCall({
phoneNumber: '4000969950', phoneNumber: '4000969950',
success: function(res) { success: function(res) {
console.log('拨打电话成功!'); console.log('拨打电话成功!');
......
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