|
@@ -97,7 +97,6 @@ CMD.test_fq_book_sid_tt = async function(book_id,sid_tt){
|
|
|
// return {"error_book_id":book_id,"error_sid_tt":sid_tt}
|
|
|
return null
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
CMD.test_fq_mf_book_sid_tt = async function(book_id,sid_tt){
|
|
@@ -389,6 +388,105 @@ CMD.get_zh_callback_template = async function(res) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ CMD.hy_iapPassBackTemplate = async function(res,accountId) {
|
|
|
+ let timestamp = helper.getCurrentUnixTimestamp()
|
|
|
+ let sign = helper.generateSign({
|
|
|
+ "pid":config.heiyan_config.pid,
|
|
|
+ "timestamp":timestamp,
|
|
|
+ "sign":"",
|
|
|
+ "accountId":accountId
|
|
|
+ },config.heiyan_config.key)
|
|
|
+ var url = config.heiyan_config.iapPassBackTemplate
|
|
|
+ var base_params = `/?sign=${sign}&pid=${config.heiyan_config.pid}×tamp=${timestamp}`
|
|
|
+ var other_params = `&accountId=${accountId}`
|
|
|
+ url = `${url}${base_params}${other_params}`
|
|
|
+ // console.log("url:",url)
|
|
|
+ let response = await axios.get(url)
|
|
|
+ let data = response.data
|
|
|
+ console.log("response:",response)
|
|
|
+ if(data.code==1){
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"成功!",data:data.data,code:10000}));
|
|
|
+ }else{
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"失败",data:null,code:10001}));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ CMD.hy_iaaPassBackTemplate = async function(res,accountId) {
|
|
|
+ let timestamp = helper.getCurrentUnixTimestamp()
|
|
|
+ let sign = helper.generateSign({
|
|
|
+ "pid":config.heiyan_config.pid,
|
|
|
+ "timestamp":timestamp,
|
|
|
+ "sign":"",
|
|
|
+ "accountId":accountId
|
|
|
+ },config.heiyan_config.key)
|
|
|
+ var url = config.heiyan_config.iaaPassBackTemplate
|
|
|
+ var base_params = `/?sign=${sign}&pid=${config.heiyan_config.pid}×tamp=${timestamp}`
|
|
|
+ var other_params = `&accountId=${accountId}`
|
|
|
+ url = `${url}${base_params}${other_params}`
|
|
|
+ // console.log("url:",url)
|
|
|
+ let response = await axios.get(url)
|
|
|
+ let data = response.data
|
|
|
+ console.log("response:",response)
|
|
|
+ if(data.code==1){
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"成功!",data:data.data,code:10000}));
|
|
|
+ }else{
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"失败",data:null,code:10001}));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+CMD.hy_topUpTemplate = async function(res,accountId) {
|
|
|
+ let timestamp = helper.getCurrentUnixTimestamp()
|
|
|
+ let sign = helper.generateSign({
|
|
|
+ "pid":config.heiyan_config.pid,
|
|
|
+ "timestamp":timestamp,
|
|
|
+ "sign":"",
|
|
|
+ "accountId":accountId
|
|
|
+ },config.heiyan_config.key)
|
|
|
+ var url = config.heiyan_config.topUpTemplate
|
|
|
+ var base_params = `/?sign=${sign}&pid=${config.heiyan_config.pid}×tamp=${timestamp}`
|
|
|
+ var other_params = `&accountId=${accountId}`
|
|
|
+ url = `${url}${base_params}${other_params}`
|
|
|
+ // console.log("url:",url)
|
|
|
+ let response = await axios.get(url)
|
|
|
+ let data = response.data
|
|
|
+ console.log("response:",response)
|
|
|
+ if(data.code==1){
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"成功!",data:data.data,code:10000}));
|
|
|
+ }else{
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"失败",data:null,code:10001}));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+ CMD.hy_accountMapping = async function(res) {
|
|
|
+ let timestamp = helper.getCurrentUnixTimestamp()
|
|
|
+ let sign = helper.generateSign({
|
|
|
+ "pid":config.heiyan_config.pid,
|
|
|
+ "timestamp":timestamp,
|
|
|
+ "sign":""
|
|
|
+ },config.heiyan_config.key)
|
|
|
+ var url = config.heiyan_config.accountMapping
|
|
|
+ var base_params = `/?sign=${sign}&pid=${config.heiyan_config.pid}×tamp=${timestamp}`
|
|
|
+ url = `${url}${base_params}`
|
|
|
+ // console.log("url:",url)
|
|
|
+ let response = await axios.get(url)
|
|
|
+ let data = response.data
|
|
|
+ console.log("response:",response)
|
|
|
+ if(data.code==1){
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"成功!",data:data.data,code:10000}));
|
|
|
+ }else{
|
|
|
+ res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
+ res.end(JSON.stringify({ message:"失败",data:null,code:10001}));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var server = http.createServer(function(req,res){
|
|
|
|
|
|
res.setHeader('Access-Control-Allow-Origin', '*'); // 允许所有域的请求,注意:在生产环境中应该限制为特定的域
|
|
@@ -500,10 +598,24 @@ var server = http.createServer(function(req,res){
|
|
|
CMD.get_zh_recharge_template(res,app_type)
|
|
|
}else if(jsonData['fun']=="get_zh_callback_template"&&jsonData['cmd']=="zh_link"){
|
|
|
CMD.get_zh_callback_template(res)
|
|
|
+ } else if(jsonData['fun']=="hy_accountMapping"&&jsonData['cmd']=="hy_link"){
|
|
|
+ CMD.hy_accountMapping(res)
|
|
|
+ } else if(jsonData['fun']=="hy_iaaPassBackTemplate"&&jsonData['cmd']=="hy_link"){
|
|
|
+ let accountId = jsonData['data']['accountId']
|
|
|
+ CMD.hy_iaaPassBackTemplate(res,accountId)
|
|
|
+ }else if(jsonData['fun']=="hy_iapPassBackTemplate"&&jsonData['cmd']=="hy_link"){
|
|
|
+ let accountId = jsonData['data']['accountId']
|
|
|
+ CMD.hy_iapPassBackTemplate(res,accountId)
|
|
|
+ }else if(jsonData['fun']=="hy_topUpTemplate"&&jsonData['cmd']=="hy_link"){
|
|
|
+ let accountId = jsonData['data']['accountId']
|
|
|
+ CMD.hy_topUpTemplate(res,accountId)
|
|
|
}else{
|
|
|
res.writeHead(200, {'Content-Type': 'application/json'});
|
|
|
res.end(JSON.stringify({ message: 'fun 错误',code:100}));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
} catch (error) {
|
|
|
// 处理解析错误
|