Commit 0db1cac2 by 宋毅

增加备注

parents 84418eab 32765cbf
......@@ -15,7 +15,7 @@ class opLog extends WEBBase {
}
/**
* 获取推送失败日志列表
* 获取channel推送失败日志列表
* @param pobj
* @param qobj
* @param req
......@@ -27,7 +27,7 @@ class opLog extends WEBBase {
}
/**
* 重新推送
* channel重新推送
* @param pobj
* @param qobj
* @param req
......@@ -37,5 +37,29 @@ class opLog extends WEBBase {
let result = await this.pushlogSve.rePush(pobj.actionBody);
return result;
}
/**
* 获取gateway推送失败日志列表
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async getGatewayPushFailLogList(pobj,qobj,req){
let list = await this.pushlogSve.getGatewayPushFailLogList(pobj.actionBody);
return list;
}
/**
* gateway重新推送
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async reGatewayPush(pobj,qobj,req){
let result = await this.pushlogSve.reGatewayPush(pobj.actionBody);
return result;
}
}
module.exports = opLog;
\ No newline at end of file
......@@ -46,13 +46,6 @@ class OpNeed extends APIBase {
case "test"://2020 0826 lin 测试使用
opResult = await this.utilsOpNeedSve.test(pobj, pobj.actionBody);
break;
// case "getItemByChannelNeedNo"://方案反馈
// opResult = await this.utilsOpNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
// break;
// case "receiveFeedback"://关闭方案
// opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
// break;
//企服通统计页面接口----start
case "getStatisticsByUappId":
opResult = await this.utilsOpNeedSve.getStatisticsByUappId(pobj);
......
......@@ -36,10 +36,10 @@ class ProductAPI extends WEBBase {
opResult = await this.utilsProductSve.getProductDetail(pobj, pobj.actionBody);
break;
case "getProductPrice":
opResult = await this.utilsProductSve.getProductPrice(pobj,pobj.actionBody)
opResult = await this.utilsProductSve.getProductPrice(pobj, pobj.actionBody)
break;
case "getProductRecommend":
opResult = await this.utilsProductSve.getProductRecommend(pobj,pobj.actionBody);
opResult = await this.utilsProductSve.getProductRecommend(pobj, pobj.actionBody);
break;
// case "updateProductPrice":
// opResult = await this.utilsProductSve.updateProductPrice(pobj,pobj.actionBody);
......@@ -48,11 +48,20 @@ class ProductAPI extends WEBBase {
opResult = await this.utils360Sve.getGoodsLowestPrice(pobj.actionBody);
break;
case "getRegProducePrice":
opResult = await this.utilsProductSve.getRegProducePrice(pobj,pobj.actionBody)
opResult = await this.utilsProductSve.getRegProducePrice(pobj, pobj.actionBody)
break;
case "getAllProducts":
opResult = await this.utilsProductSve.getAllProducts(pobj);
break;
case "getAllProductType":// 获取产品大类
opResult = await this.utilsProductSve.getAllProductType(pobj);
break;
case "submitProductType":// 创建产品大类
opResult = await this.utilsProductSve.submitProductType(pobj);
break;
case "editProductType":// 修改产品大类
opResult = await this.utilsProductSve.editProductType(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
}
......
......@@ -118,6 +118,12 @@ class AccessAuthAPI extends WEBBase {
case "getAllService"://获取所有渠道(信息更全一些)
opResult = await this.utilsAuthSve.getAllService(pobj);
break;
case "submitService"://创建渠道(app)
opResult = await this.utilsAuthSve.submitService(pobj);
break;
case "editService"://修改渠道(app)
opResult = await this.utilsAuthSve.editService(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -17,13 +17,13 @@ class Consultation extends APIBase {
return regCfg.getResultFail("intentionBizId不能为空");
}
if (!pobj.phone) {
return regCfg.getResultFail("mobile不能为空");
return regCfg.getResultFail("phone不能为空");
}
if (!pobj.consultType) {
return regCfg.getResultFail("consultType不能为空");
}
pobj.type = pobj.consultType;
pobj.mobile = pobj.phone;
// pobj.mobile = pobj.phone;//百度公司注册提交需求根据geteway中regCenterOrderSve文件reqcenterchannel2方法判断隐藏mobile字段
pobj.action_type = "submitRegNeed";
if (pobj.area) {
pobj.area = regCfg.baiduArea[pobj.area]
......
......@@ -5,7 +5,6 @@ class AccessAuthAPI extends APIBase {
constructor() {
super();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
}
/**
* 接口跳转-POST请求
......
......@@ -372,26 +372,6 @@ class BaseCenterOrderService extends AppServiceBase {
return pushRes;
}
//服务商icp方案关闭 2020-10-26 laolan
async abolishIcpProgramme(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
//推送数据至阿里
var pushObj = {
BizId: ab.BizId, Note: ab.Note
};
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
return system.getResultSuccess();
}
return res;
}
//队列推送材料
async serviceProviderSubmit2Material(pobj) {
console.log("serviceProviderSubmit2Material+++++pobj+++",pobj)
......@@ -876,22 +856,7 @@ class BaseCenterOrderService extends AppServiceBase {
}
return res;
}
//交付单关闭
async closeOrderDelivery(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
//推送数据至阿里
var pushObj = {
BizId: needsolution.channelSolutionNo, Note: ab.note
};
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
return system.getResultSuccess();
}
return res;
}
//易名退款,关闭订单 2021-3-23
async eNameCloseOrder(pobj){
......
......@@ -6,6 +6,7 @@ class PushlogService extends ServiceBase {
super("common", ServiceBase.getDaoName(PushlogService));
this.logCtl = system.getObject("service.common.oplogSve");
this.pushfaillogDao = system.getObject("db.common.pushfaillogDao");
this.gatewaypushlogDao = system.getObject("db.common.gatewaypushlogDao");
}
async createDb(qobj) {
try {
......@@ -51,6 +52,7 @@ class PushlogService extends ServiceBase {
return result;
}
//获取channel推送失败记录
async getPushFailLogList(actionBody) {
var sql = "SELECT id,appid,`content`,failType,pushNumber,opTitle,resultInfo,created_at FROM `center_channel_pushfaillog` WHERE pushNumber=10 ";
let whereParams = {};
......@@ -69,7 +71,7 @@ class PushlogService extends ServiceBase {
}
/**
* 重新推送
* channel重新推送
* @param actionBody
* @returns {Promise<void>}
*/
......@@ -89,6 +91,45 @@ class PushlogService extends ServiceBase {
return system.getResult(result);
}
//获取Gateway推送失败记录
async getGatewayPushFailLogList(actionBody) {
var sql = "SELECT id,requestUrl,requestjson,pushUrl,pushActionType,pushtimes,pushStatus,created_at,error FROM `gateway_pushlog` WHERE pushtimes=4 and pushStatus='wts'";
let whereParams = {};
if(actionBody.likeParams){
sql += " and requestjson like :likeParams";
whereParams.likeParams = "%"+ actionBody.likeParams +"%";
}
if(actionBody.likeError){
sql += " and error like :likeError";
whereParams.likeError = "%"+ actionBody.likeError +"%";
}
sql += " order by created_at desc"
var list = await this.gatewaypushlogDao.customQuery(sql,whereParams);
var result = system.getResultSuccess(list);
return result;
}
/**
* Gateway重新推送
* @param actionBody
* @returns {Promise<void>}
*/
async reGatewayPush(actionBody){
let content = actionBody.content;
let sql = 'update `gateway_pushlog` set pushtimes = :pushtimes';
let params = {
pushtimes: actionBody.pushNumber || 3
}
if(Object.keys(content).length>0){
sql += ',requestjson=:content';
params.content = JSON.stringify(actionBody.content);
}
sql += ' where id = :id';
params.id = actionBody.id;
let result = await this.customUpdate(sql,params);
return system.getResult(result);
}
async addPublicServiceLog(pobj, req) {
var sql = "INSERT INTO `igirl_api`.`center_channel_public_servicelog` (`appkey`,`pushUrl`,`pushContent`,`resultInfo`,`pushNumber`,`clientIp`,created_at)" +
......
......@@ -139,69 +139,6 @@ class QcCenterOrderService extends AppServiceBase {
return res;
}
//交付材料提交
async serviceProviderSubmitMaterial(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
var material = ab.material;
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
if (pobj.appInfo.uapp_id == 18) {
self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
}
return system.getResultSuccess();
}
return res;
}
//通知交付状态变更
async serviceProviderNotification(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
pobj.actionType = "getOrderByOrderNo";
let orderUrl = settings.centerOrderUrl() + "action/order/springBoard";
let orderResult = await this.restPostUrl(pobj, orderUrl);
if (orderResult.status != 0) {
return system.getResultFail(-1, '查询订单失败')
}
let uapp_id = orderResult.data.uapp_id;
pobj.appInfo = { uapp_id: uapp_id };
pobj.actionType = "getAppInterface";
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
if (productItemInterfaceResult.status != 0) {
system.getResultFail(-1, '获取接口参数失败')
}
pobj.interface_info = productItemInterfaceResult.data;
pobj.pushObj = res.data;
this.utilsPushSve.pushBusInfo(pobj, 'pushStatus', 1);
return system.getResultSuccess();
}
return res;
}
//交付单关闭
async closeOrderDelivery(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
......
......@@ -178,19 +178,6 @@ class RegCenterOrderService extends AppServiceBase {
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/**
* 获取方案详情
* @param {*} pobj
* @param {*} actionBody bizId 渠道方案号
*/
async getSolutionByChannelOrderNo(pobj, actionBody) {
if (!actionBody.orderNo) {
return system.getResult(null, "actionBody.orderNo can not be empty,100390");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/**
* 获取需求详情
......
......@@ -183,12 +183,12 @@ class TmqueryService {
orgname:queryobj.orgname,
appkey:"5b29981785bd4272966b15ad8e8b9dd3"
}
let url = settings.icNameUrl() + 'api/icName/CheckName'
let url = settings.icNameUrl() + 'openPlatform/ic/match'
let result = await this.opReqResult(url, data, req);
if (result.Status!=200){
if (result.code!=200){
return system.getResult(-1,result.message);
}
return system.getResult(result.data);
return system.getResult(result);
}
async opReqResult(reqUrl, queryobj, req) {
......
......@@ -313,5 +313,24 @@ class UtilsAuthService extends AppServiceBase {
return result
}
/**
* 创建渠道
* @returns {Promise<void>}
*/
async submitService(pobj) {
let url = this.centerAppUrl + 'auth/accessAuth/submitService';
let result = await this.restPostUrl(pobj, url);
return result
}
/**
* 修改渠道
* @returns {Promise<void>}
*/
async editService(pobj) {
let url = this.centerAppUrl + 'auth/accessAuth/editService';
let result = await this.restPostUrl(pobj, url);
return result
}
}
module.exports = UtilsAuthService;
......@@ -5,7 +5,7 @@ const fs = require("fs");
const {json} = require("sequelize");
const {getResult, getResultSuccess} = require("../../../system");
//需求操作类----操作类型-公用的
//需求操作类----操作类型-公用的--未用到
class UtilsNeedCommService extends AppServiceBase {
constructor() {
super();
......@@ -15,7 +15,6 @@ class UtilsNeedCommService extends AppServiceBase {
this.ossClient = system.getObject("util.ossClient");
this.restClient = system.getObject("util.restClient");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
this.opPushQueueUrl = settings.opPushQueueUrl();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
}
......
......@@ -428,79 +428,6 @@ class UtilsNeedService extends AppServiceBase {
return result;
}
/**
* icp关闭需求
* @param {*} pobj
* @param {*} actionBody
*/
async needCloseIcp(pobj, actionBody) {
if (!actionBody.channelNeedNo) {
return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395");
}
if (!actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100395");
}
var self = this;
pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/utilsNeedSve.js/needCloseIcp",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(result),
optitle: "abolishIcpProgrammeByNeed推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.channelNeedNo,
status: "closeNeed"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/utilsNeedSve.js/needCloseIcp",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: actionBody.channelNeedNo, Note: actionBody.note }, apiVersion: "2019-05-08" });
// console.log(a);//TODO:laolan添加日志记录
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result
}
//查询需求详情
async getItemByNeedNo(pobj, actionBody) {
if (!actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100395");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
return result;
}
//状态更新
async icpNotify(pobj) {
var actionBody = pobj.actionBody;
......@@ -1746,23 +1673,3 @@ class UtilsNeedService extends AppServiceBase {
}
module.exports = UtilsNeedService;
\ No newline at end of file
// var a=new UtilsNeedService();
// a.queryExpertApplyCommunicationLogs({actionBody:{intentionBizId:"20200805103324000001",userFeedBack:true}});
// // var a=new UtilsNeedService();
// a.writeCommunicationLog({actionBody:{intentionBizId:"20200804200124000001",note:"测试反馈"}});
// var a=new UtilsNeedService();
// a.needCloseIcp({actionBody:{channelNeedNo:20200804200124000001,note:"ceshifankui"}},{channelNeedNo:20200803095203000001,note:"ceshifankui"});
// var a = new UtilsNeedService();
// a.queryTradeIntentionUserList({ actionBody: { intentionBizId: "20200803095203000001", userFeedBack: true } });
// var a = new UtilsNeedService();
// a.test();
// var a = new UtilsNeedService();
// a.ediNotify(null, {
// operationType:'USER_UPLOAD_PRODUCE',
// extInfo:"{\"businessLicense\":[\"https://companyreg-wangwen.oss-cn-shanghai.aliyuncs.com/business_license/1219541161213057/1603184928383/xk8suu62qo.jpg?Expires=1603193934&OSSAccessKeyId=hObpgEXoca42qH3V&Signature=BtHNsjWCN0Eqp2OQWwim8J62eWA%3D&response-content-disposition=fileName%3D%E8%90%A5%E4%B8%9A%E6%89%A7%E7%85%A7%3B\"],\"idCardList\":[\"https://companyreg-wangwen.oss-cn-shanghai.aliyuncs.com/card/1219541161213057/1603184933494/0m5epfgzhg79.jpg?Expires=1603193934&OSSAccessKeyId=hObpgEXoca42qH3V&Signature=5w%2FhkZuJ%2BxR5J9nC4QzkhqcrKy4%3D&response-content-disposition=fileName%3D%E7%9B%B8%E5%85%B3%E4%BA%BA%E5%91%98%E8%BA%AB%E4%BB%BD%E8%AF%81%3B\"]}"
// })
......@@ -65,20 +65,6 @@ class UtilsOpNeedService extends AppServiceBase {
}
/**
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody needNo 需求号
*/
async getItemByNeedNo(pobj, actionBody) {
if (!actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100385");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/**
* 关闭需求
* @param {*} pobj
* @param {*} actionBody
......@@ -217,44 +203,6 @@ class UtilsOpNeedService extends AppServiceBase {
return result;
}
async needDetailByChannelNo(pobj) {
if (!pobj.actionBody.bizId) {
return system.getResult(null, "actionBody.bizId can not be empty,100491");
}
var solutionobj = {
actionType: "getIcpProgrammeDetail",
actionBody: { BizId: pobj.actionBody.bizId },
appInfo: pobj.appInfo,
actionProcess: pobj.actionProcess
}
var url = this.centerOrderUrl + "action/icpapi/springBoard";
var solutionrtn = await this.execClient.execPost(solutionobj, url);
if (!solutionrtn || !solutionrtn.stdout) {
return system.getResultFail(-5011, "方案查询失败");
}
var solutiondata = JSON.parse(solutionrtn.stdout);
if (solutiondata.status != 0) {
return system.getResultFail(-5011, "方案查询失败");
}
if (solutiondata.data && solutiondata.data[0].channelNeedNo) {
pobj.actionBody.needNo = solutiondata.data[0].channelNeedNo;
pobj.actionBody.needId = solutiondata.data[0].channelNeedNo;
pobj.actionBody.channelSolutionNo = solutiondata.data[0].channelSolutionNo;
}
var sobj = {
actionType: "getItemByChannelNeedNo",
actionBody: pobj.actionBody,
appInfo: pobj.appInfo,
actionProcess: pobj.actionProcess
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(sobj, reqUrl);
if (itemResult.status == 0) {
itemResult.data.channelSolutionNo = pobj.actionBody.channelSolutionNo;
}
return itemResult;
}
async writeCommunicationLog(pobj) {
if (!pobj.actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100491");
......@@ -550,14 +498,4 @@ class UtilsOpNeedService extends AppServiceBase {
module.exports = UtilsOpNeedService;
// var a=new UtilsNeedService();
// a.queryExpertApplyCommunicationLogs({actionBody:{intentionBizId:"20200803095203000001",userFeedBack:true}});
// // var a=new UtilsNeedService();
// a.writeCommunicationLog({actionBody:{intentionBizId:"20200804200124000001",note:"测试反馈"}});
// var a=new UtilsNeedService();
// a.needCloseIcp({actionBody:{channelNeedNo:20200804200124000001,note:"ceshifankui"}},{channelNeedNo:20200803095203000001,note:"ceshifankui"});
......@@ -19,7 +19,7 @@ class UtilsProductService extends AppServiceBase {
if (!actionBody.pathCode) {
return system.getResult(null, "actionBody.pathCode can not be empty,100330");
}
if(actionBody.name){
if (actionBody.name) {
pobj.actionBody.productName = actionBody.name;
}
pobj.actionBody.pathCode = "/" + actionBody.pathCode + "/";
......@@ -41,15 +41,15 @@ class UtilsProductService extends AppServiceBase {
pobj.actionBody.pathCode = "/" + actionBody.pathCode + "/";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
let list = await this.restPostUrl(pobj, url);
if(!list.data){
return system.getResult(null,'product data is empty')
if (!list.data) {
return system.getResult(null, 'product data is empty')
}
for(let item of list.data){
for (let item of list.data) {
pobj.actionType = 'getMinPrice';
pobj.actionBody = {
product_id:item.product_id
product_id: item.product_id
}
let re = await this.restPostUrl(pobj,url);
let re = await this.restPostUrl(pobj, url);
item.price = re.data ? re.data.price : 0;
}
return list;
......@@ -75,7 +75,7 @@ class UtilsProductService extends AppServiceBase {
* @param actionBody
* @returns {Promise<{msg: *, data, bizmsg: *|string, status: number}>}
*/
async getProductPrice(pobj,actionBody){
async getProductPrice(pobj, actionBody) {
pobj.actionType = 'getProductPrice'
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj, url);
......@@ -87,7 +87,7 @@ class UtilsProductService extends AppServiceBase {
* @param actionBody
* @returns {Promise<{msg: *, data, bizmsg: *|string, status: number}>}
*/
async getRegProducePrice(pobj,actionBody){
async getRegProducePrice(pobj, actionBody) {
pobj.actionType = 'getRegProducePrice'
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj, url);
......@@ -98,35 +98,35 @@ class UtilsProductService extends AppServiceBase {
* @param actionBody
* @returns {Promise<void>}
*/
async getProductRecommend(pobj,actionBody){
async getProductRecommend(pobj, actionBody) {
const type = actionBody.type;
if(!type){
return system.getResult(-1,'type can be not empty')
if (!type) {
return system.getResult(-1, 'type can be not empty')
}
switch (type) {
case 1:
if(!actionBody.companyName){
return system.getResultFail(-1,'companyName can be not empty')
if (!actionBody.companyName) {
return system.getResultFail(-1, 'companyName can be not empty')
}
break;
case 2:
if(!actionBody.companyName){
return system.getResultFail(-1,'companyName can be not empty')
if (!actionBody.companyName) {
return system.getResultFail(-1, 'companyName can be not empty')
}
if(!actionBody.productCode){
return system.getResultFail(-1,'productCode can be not empty')
if (!actionBody.productCode) {
return system.getResultFail(-1, 'productCode can be not empty')
}
break;
case 3:
if(!actionBody.productCode){
return system.getResultFail(-1,'productCode can be not empty')
if (!actionBody.productCode) {
return system.getResultFail(-1, 'productCode can be not empty')
}
break;
default:
return system.getResultFail(-1,'type 参数错误');
return system.getResultFail(-1, 'type 参数错误');
}
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj,url);
return await this.restPostUrl(pobj, url);
}
/**
......@@ -135,22 +135,55 @@ class UtilsProductService extends AppServiceBase {
* @param actionBody
* @returns {Promise<void>}
*/
async updateProductPrice(pobj,actionBody){
if(!actionBody.data || actionBody.data.length == 0){
return system.getResultFail(-1,'data is empty!');
async updateProductPrice(pobj, actionBody) {
if (!actionBody.data || actionBody.data.length == 0) {
return system.getResultFail(-1, 'data is empty!');
}
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj,url);
return await this.restPostUrl(pobj, url);
}
/**
* 获取全部产品
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getAllProducts(pobj){
async getAllProducts(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'getAllProducts'
let result = await this.restPostUrl(pobj,url);
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 获取全部产品大类
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getAllProductType(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'getAllProductType'
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 创建产品大类
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async submitProductType(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'submitProductType'
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 修改产品大类
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async editProductType(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'editProductType'
let result = await this.restPostUrl(pobj, url);
return result;
}
......@@ -159,32 +192,32 @@ class UtilsProductService extends AppServiceBase {
* @param pobj
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getAllPathName(pobj){
async getAllPathName(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'getAllPathName';
let result = await this.restPostUrl(pobj,url);
if(result.status !=0){
return system.getResultFail(-1,'获取数据失败,请稍后再试!');
let result = await this.restPostUrl(pobj, url);
if (result.status != 0) {
return system.getResultFail(-1, '获取数据失败,请稍后再试!');
}
let data = result.data;
let map = new Map();
for(let i =0;i<data.length;i++){
for (let i = 0; i < data.length; i++) {
let item = data[i];
let strs = item.path_name.split('/');
let classOne = strs[1];
let classTwo = strs[2];
if(map.has(classOne)){
if (map.has(classOne)) {
let val = map.get(classOne);
val.push(classTwo)
map.set(classOne,val);
}else{
map.set(classOne, val);
} else {
let arr = [];
arr.push(classTwo)
map.set(classOne,arr);
map.set(classOne, arr);
}
}
let resultData = [];
map.forEach((v,k) =>{
map.forEach((v, k) => {
let obj = {};
obj['key'] = k;
obj['data'] = v;
......
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