Commit 6220b6f0 by sxy

feat: add 商机类型

parent 540b1334
...@@ -19,6 +19,9 @@ class UtilsFgbusinesschancService extends AppServiceBase { ...@@ -19,6 +19,9 @@ class UtilsFgbusinesschancService extends AppServiceBase {
if (!actionBody.businessData) { if (!actionBody.businessData) {
return system.getResult(null, "actionBody.businessData can not be empty,100290"); return system.getResult(null, "actionBody.businessData can not be empty,100290");
} }
if (!actionBody.businessType) {
return system.getResult(null, "actionBody.businessType can not be empty,100290");
}
if (!Array.isArray(actionBody.businessData)) { if (!Array.isArray(actionBody.businessData)) {
return system.getResult(null, "actionBody.businessData should be Array,100290"); return system.getResult(null, "actionBody.businessData should be Array,100290");
} }
...@@ -31,7 +34,10 @@ class UtilsFgbusinesschancService extends AppServiceBase { ...@@ -31,7 +34,10 @@ class UtilsFgbusinesschancService extends AppServiceBase {
var tmpPobj = { var tmpPobj = {
appInfo: pobj.appInfo, appInfo: pobj.appInfo,
actionType: "create", actionType: "create",
actionBody: item actionBody: {
...item,
businessType: actionBody.businessType
}
} }
var tmpResult = await self.restPostUrl(tmpPobj, reqUrl); var tmpResult = await self.restPostUrl(tmpPobj, reqUrl);
if (tmpResult.status == 0) { if (tmpResult.status == 0) {
...@@ -93,16 +99,23 @@ class UtilsFgbusinesschancService extends AppServiceBase { ...@@ -93,16 +99,23 @@ class UtilsFgbusinesschancService extends AppServiceBase {
if (!actionBody.businessId) { if (!actionBody.businessId) {
return system.getResult(null, "actionBody.businessId can not be empty,100290"); return system.getResult(null, "actionBody.businessId can not be empty,100290");
} }
if (!actionBody.businessType) {
return system.getResult(null, "actionBody.businessType can not be empty,100290");
}
if (!["复购算法", "关联推荐", "智能监测"].includes(actionBody.businessType)) {
return system.getResult(null, "actionBody.businessType don't compliance,100290");
}
var url = settings.entProfileUrl() + "api/businessProduct"; var url = settings.entProfileUrl() + "api/businessProduct";
var reqParam = { var reqParam = {
bussines_id: actionBody.businessId bussines_id: actionBody.businessId,
businessType: actionBody.businessType
} }
var result = await this.restPostWithHValueUrl(reqParam, url); var result = await this.restPostWithHValueUrl(reqParam, url);
let code = result.code || result.status let code = result.code || result.status
if (code !== 200 && code !== 0) { if (code !== 200 && code !== 0) {
return system.getResult(null, result.message || result.msg || "req is error"); return system.getResult(null, result.message || result.msg || "req is error");
} }
return system.getResultSuccess(result.data); return system.getResultCustomSuccess(actionBody.businessType === "智能监测" ? { data: result.data, survey_reason: result.survey_reason } : { data: result.data });
} }
async getOldOrder(pobj, actionBody) { async getOldOrder(pobj, actionBody) {
......
...@@ -172,6 +172,20 @@ class System { ...@@ -172,6 +172,20 @@ class System {
data: data || null, data: data || null,
}; };
} }
/**
* 请求返回成功 自定义
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultCustomSuccess(data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
...data
};
}
/** /**
* 请求返回失败 * 请求返回失败
* @param {*} status 操作失败状态,默认为-1 * @param {*} status 操作失败状态,默认为-1
......
...@@ -296,7 +296,8 @@ ...@@ -296,7 +296,8 @@
{ {
"actionType":"getRecommendProducts", "actionType":"getRecommendProducts",
actionBody:{ actionBody:{
businessId:"商机Id" businessId:"商机Id",
businessType:"复购算法" // 复购算法、关联推荐、智能监测
} }
} }
``` ```
...@@ -307,6 +308,9 @@ ...@@ -307,6 +308,9 @@
{ {
"status": 0,// 0为成功,否则失败 "status": 0,// 0为成功,否则失败
"msg": "success", "msg": "success",
"survey_reason":[
{'change_item': '住所', 'change_time': '2020-03-24', 'change_text': '【北京市海淀区巨山路78号院209室】变更为【北京市海淀区信息路28号1幢10层1003-12室】'}
] // 备注 : 只有类型 智能监测 该字段才出现
"data":[{ "data":[{
"accountId":"客户ID", "accountId":"客户ID",
"recommendId": "00000001",//推荐唯一码 "recommendId": "00000001",//推荐唯一码
......
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