Commit c751d8d6 by 宋毅

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

parents fc7db29b a04ad50e
......@@ -52,7 +52,10 @@ class OpNeed extends APIBase {
// break;
// case "receiveFeedback"://关闭方案
// opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
// break;
// break;
case "getStatisticsByUappId":
opResult = await this.utilsOpNeedSve.getStatisticsByUappId(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -50,6 +50,9 @@ class ProductAPI extends WEBBase {
case "getRegProducePrice":
opResult = await this.utilsProductSve.getRegProducePrice(pobj,pobj.actionBody)
break;
case "getAllProducts":
opResult = await this.utilsProductSve.getAllProducts(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
}
......
......@@ -112,6 +112,9 @@ class AccessAuthAPI extends WEBBase {
case "logout"://用户退出--已经废弃,前端自己进行移除userpin信息
opResult = await this.utilsAuthSve.userLogout(pobj, pobj.actionBody);
break;
case "getAllChannels":
opResult = await this.utilsAuthSve.getAllChannels(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -293,5 +293,15 @@ class UtilsAuthService extends AppServiceBase {
return result;
}
/**
* 获取所有渠道
* @returns {Promise<void>}
*/
async getAllChannels(pobj){
let url= this.centerAppUrl + 'auth/accessAuth/getAllChannels';
let result = await this.restPostUrl(pobj,url);
return result
}
}
module.exports = UtilsAuthService;
......@@ -286,6 +286,73 @@ class UtilsOpNeedService extends AppServiceBase {
return system.getResultSuccess(res);
}
/**
* 各渠道需求统计
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByUappId(pobj){
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
return system.getResultFail(-1);
}
let data = result.data;
let temp=0;
let arr = [];
let reArr = [];
for(let i=0;i<data.length;i++){
if((temp != data[i].uapp_id && temp !=0)){
let obj = {
uapp_id:temp,
data:arr
}
reArr.push(obj);
arr =[];
}
let dArr = {
time:data[i].time,
count:data[i].count
}
arr.push(dArr);
temp = data[i].uapp_id;
if (i == data.length-1){
let obj = {
uapp_id:temp,
data:arr
}
reArr.push(obj);
}
}
reArr.sort((a,b) =>{
return a.uapp_id - b.uapp_id;
})
let temp2 = 0;
let arr2=[];
let final = [];
for(let i =0;i<reArr.length;i++){
if((temp2 != reArr[i].uapp_id && temp2 !=0)){
let o = {
uapp_id: temp2,
data: arr2
};
final.push(o);
arr2 = [];
}
console.log(reArr[i].data)
arr2 = arr2.concat(reArr[i].data);
temp2 = reArr[i].uapp_id;
if (i == reArr.length-1){
let obj = {
uapp_id:temp2,
data:arr2
}
final.push(obj);
}
}
return system.getResultSuccess(final);
}
urlSplit(url) {
var arr = url.split("?")[1]; //根据?跟个url
......
......@@ -142,6 +142,17 @@ class UtilsProductService extends AppServiceBase {
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj,url);
}
/**
* 获取全部产品
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getAllProducts(pobj){
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'getAllProducts'
let result = await this.restPostUrl(pobj,url);
return result;
}
}
module.exports = UtilsProductService;
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