Commit 5435e5b6 by 宋毅

Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel

parents 0f723b9e 90a62a28
......@@ -77,5 +77,14 @@ class OpNeed extends APIBase {
}
return opResult;
}
async opSubmitNeed(pobj, qobj, req) {
pobj.actionBody = {
type: pobj.type,
mobile: pobj.mobile,
userName: pobj.userName
}
return await this.utilsOpNeedSve.opSubmitNeed(pobj, pobj.actionBody);
}
}
module.exports = OpNeed;
\ No newline at end of file
......@@ -68,5 +68,13 @@ class ProductAPI extends WEBBase {
return opResult;
}
async getProductList(pobj, action_type, req) {
pobj.actionBody = {
pathCode: pobj.pathCode
}
return await this.utilsProductSve.getProductList(pobj, pobj);
}
}
module.exports = ProductAPI;
\ No newline at end of file
......@@ -29,6 +29,9 @@ class ProductAPI extends WEBBase {
case "getParamsFor360":
opResult = await this.utils360Sve.getParamsFor360(pobj, pobj.actionBody);
break;
case "pushTmOrderStatus":
opResult = await this.utils360Sve.pushTmOrderStatus(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -81,10 +81,7 @@ class IcbcService extends AppServiceBase {
}
//获取token
let url = settings.icNameUrl() + 'openPlatform/platform/getToken';
let params = {
"accessKey": "111",
"accessSecret": "222"
}
let params = settings.openPlatformAK();
req.headers.token='sss'
let ret = await this.opReqResult(url, params, req);
if (ret.status != 1) {
......@@ -133,10 +130,7 @@ class IcbcService extends AppServiceBase {
async getLicenseList(obj,req){
let companyName = obj.companyName;
let url = settings.icNameUrl() + 'openPlatform/platform/getToken';
let params = {
"accessKey": "111",
"accessSecret": "222"
}
let params = settings.openPlatformAK();
req.headers.token='sss'
let ret = await this.opReqResult(url, params, req);
if (ret.status != 1) {
......
......@@ -143,6 +143,52 @@ class utils360Sve extends AppServiceBase {
return system.getResultSuccess(result.data);
}
async pushTmOrderStatus(pobj){
let token = await this.utilsAuthSve.get360Token();
let url = settings.pushUrl360() + 'api/v1/eshop/GsbOrderUpdate?token=' + token.access_token;
let order_id = pobj.orderNo;
let sub_status = pobj.sub_status;
let status = pobj.status;
let pushObj = {
order_id,
status,
sub_status: sub_status
}
let result = await this.restPostUrl(pushObj, url);
if (result.code == 200) {
this.pushlogSve.createDb({
op: "360-pushTMOrderStatus",
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
} else {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + result.msg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushTMOrderStatus",
});
}
console.log(result, '-------------push360-----------------')
return result;
} catch (e) {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
});
}
}
module.exports = utils360Sve;
......@@ -32,7 +32,7 @@ class UtilsOpNeedService extends AppServiceBase {
if (opResult.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id= opResult.data.service_product_id;
pobj.actionBody.service_product_id = opResult.data.service_product_id;
pobj.actionBody.productId = opResult.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = opResult.data.type_code;
......@@ -45,9 +45,7 @@ class UtilsOpNeedService extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/opNeed/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg" || pobj.actionBody.channel_type_code == "esp.companyreg_cloud") {
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
}
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
}
return result;
}
......@@ -94,7 +92,7 @@ class UtilsOpNeedService extends AppServiceBase {
return result;
}
async getNeedList(pobj, actionBody){
async getNeedList(pobj, actionBody) {
// pobj.
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
......@@ -242,47 +240,47 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByUappId(pobj){
async getStatisticsByUappId(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
let data = result.data;
let temp=0;
let temp = 0;
let arr = [];
let reArr = [];
for(let i=0;i<data.length;i++){
if((temp != data[i].uapp_id && temp !=0)){
for (let i = 0; i < data.length; i++) {
if ((temp != data[i].uapp_id && temp != 0)) {
let obj = {
uapp_id:temp,
data:arr
uapp_id: temp,
data: arr
}
reArr.push(obj);
arr =[];
arr = [];
}
let dArr = {
time:data[i].time,
count:data[i].count
time: data[i].time,
count: data[i].count
}
arr.push(dArr);
temp = data[i].uapp_id;
if (i == data.length-1){
if (i == data.length - 1) {
let obj = {
uapp_id:temp,
data:arr
uapp_id: temp,
data: arr
}
reArr.push(obj);
}
}
reArr.sort((a,b) =>{
reArr.sort((a, b) => {
return a.uapp_id - b.uapp_id;
})
let temp2 = 0;
let arr2=[];
let arr2 = [];
let final = [];
for(let i =0;i<reArr.length;i++){
if((temp2 != reArr[i].uapp_id && temp2 !=0)){
for (let i = 0; i < reArr.length; i++) {
if ((temp2 != reArr[i].uapp_id && temp2 != 0)) {
let o = {
uapp_id: temp2,
data: arr2
......@@ -293,10 +291,10 @@ class UtilsOpNeedService extends AppServiceBase {
console.log(reArr[i].data)
arr2 = arr2.concat(reArr[i].data);
temp2 = reArr[i].uapp_id;
if (i == reArr.length-1){
if (i == reArr.length - 1) {
let obj = {
uapp_id:temp2,
data:arr2
uapp_id: temp2,
data: arr2
}
final.push(obj);
}
......@@ -309,7 +307,7 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getNeedFunnelStatistics(pobj){
async getNeedFunnelStatistics(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
return result;
......@@ -320,35 +318,35 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByProduct(pobj){
async getStatisticsByProduct(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
let data = result.data;
let temp="";
let temp = "";
let arr = [];
let reArr = [];
for(let i=0;i<data.length;i++){
if((temp != data[i].typeCode && temp !="")){
for (let i = 0; i < data.length; i++) {
if ((temp != data[i].typeCode && temp != "")) {
let obj = {
type_code:temp,
data:arr
type_code: temp,
data: arr
}
reArr.push(obj);
arr =[];
arr = [];
}
let dArr = {
uapp_id:data[i].uapp_id,
count:data[i].count
uapp_id: data[i].uapp_id,
count: data[i].count
}
arr.push(dArr);
temp = data[i].typeCode;
if (i == data.length-1){
if (i == data.length - 1) {
let obj = {
type_code:temp,
data:arr
type_code: temp,
data: arr
}
reArr.push(obj);
}
......@@ -361,35 +359,35 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByChannel(pobj){
async getStatisticsByChannel(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
let data = result.data;
let temp="";
let temp = "";
let arr = [];
let reArr = [];
for(let i=0;i<data.length;i++){
if((temp != data[i].uapp_id && temp !="")){
for (let i = 0; i < data.length; i++) {
if ((temp != data[i].uapp_id && temp != "")) {
let obj = {
uapp_id:temp,
data:arr
uapp_id: temp,
data: arr
}
reArr.push(obj);
arr =[];
arr = [];
}
let dArr = {
typeCode:data[i].typeCode,
count:data[i].count
typeCode: data[i].typeCode,
count: data[i].count
}
arr.push(dArr);
temp = data[i].uapp_id;
if (i == data.length-1){
if (i == data.length - 1) {
let obj = {
uapp_id:temp,
data:arr
uapp_id: temp,
data: arr
}
reArr.push(obj);
}
......@@ -402,10 +400,10 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getNeedProductType(pobj){
async getNeedProductType(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
return result;
......@@ -416,10 +414,10 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getNeedComparison(pobj){
async getNeedComparison(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
return result;
......@@ -430,35 +428,35 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByArea(pobj){
async getStatisticsByArea(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
if (result.status != 0) {
return system.getResultFail(-1);
}
let data = result.data;
let temp="";
let temp = "";
let arr = [];
let reArr = [];
for(let i=0;i<data.length;i++){
if((temp != data[i].province && temp !="")){
for (let i = 0; i < data.length; i++) {
if ((temp != data[i].province && temp != "")) {
let obj = {
province:temp,
data:arr
province: temp,
data: arr
}
reArr.push(obj);
arr =[];
arr = [];
}
let dArr = {
type_code:data[i].typeCode,
count:data[i].count
type_code: data[i].typeCode,
count: data[i].count
}
arr.push(dArr);
temp = data[i].province;
if (i == data.length-1){
if (i == data.length - 1) {
let obj = {
province:temp,
data:arr
province: temp,
data: arr
}
reArr.push(obj);
}
......@@ -471,7 +469,7 @@ class UtilsOpNeedService extends AppServiceBase {
* @param pobj
* @returns {Promise<void>}
*/
async getNeedComparisonList(pobj){
async getNeedComparisonList(pobj) {
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
return result;
......@@ -488,7 +486,7 @@ class UtilsOpNeedService extends AppServiceBase {
return jsonarr;
}
//2020 0826 lin 测试使用
async test(pobj, actionBody){
async test(pobj, actionBody) {
pobj.actionType = "receiveIcpStatusNotify";
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
......
......@@ -6,7 +6,7 @@ const utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
const signSve = system.getObject("service.common.signSve");
const xml2js = require('xml2js');
const jwt = require('jsonwebtoken');
const {PDICT} = require("../../config/businessConfig");
const { PDICT } = require("../../config/businessConfig");
const settings = require("../../config/settings");
module.exports = function (app) {
......@@ -416,7 +416,7 @@ module.exports = function (app) {
res.end(JSON.stringify(result));
return;
}
console.log(req.originalUrl,"sy-------------------------------00001");
console.log(req.originalUrl, "sy-------------------------------00001---yy");
if (PDICT.apiAliSendKeyPathList.indexOf(req.originalUrl) >= 0) {
//验证数据key
var appkey = req.headers["appkey"] || "";
......@@ -437,6 +437,7 @@ module.exports = function (app) {
}
if (PDICT.apiSecretPathList.indexOf(req.originalUrl) >= 0) {
//验证数据签名
console.log("apiSecretPathList", req.headers)
var appkey = req.headers["appkey"] || "";
if (!appkey) {
result.msg = "req headers appkey can not be empty";
......
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