Commit 5c41e79f by 宋毅

tj

parent dead33de
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class IcAPI extends APIBase {
constructor() {
super();
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if (pobj.actionType == 'getPolicyNeedList' || pobj.actionType == 'submitPolicyNeedNotes') {
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "submitNeed"://提交需求
opResult = await this.needinfoSve.submitNeed(pobj);
break;
case "getItemByNeedNo"://获取需求详情
opResult = await this.needinfoSve.getItemByNeedNo(pobj);
break;
case "needClose"://需求关闭
opResult = await this.needinfoSve.needClose(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = IcAPI;
\ No newline at end of file
const system=require("../../../system"); const system = require("../../../system");
const Dao=require("../../dao.base"); const Dao = require("../../dao.base");
class NeedinfoDao extends Dao{ class NeedinfoDao extends Dao {
constructor(){ constructor() {
super(Dao.getModelName(NeedinfoDao)); super(Dao.getModelName(NeedinfoDao));
} }
extraWhere(obj,w){ async getItemByNeedNo(needNo) {
if(obj.codepath && obj.codepath!=""){ return await this.model.findOne({
if(obj.codepath.indexOf("calculateprice")>0){ where: {
w["user_id"]=obj.uid; needNo: needNo
} },
} attributes: [
return w; "id",
"uapp_id",
"needNo",
"channelNeedNo",
"channelUserId",
"followManUserId",
"followManMobile",
"city",
"province",
"publishContent",
"publishName",
"publishMobile",
"notes",
"followContent",
"disposeNotes",
"status",
"typeCode",
"typeName",
"channelTypeCode",
"channelTypeName",
"publisherOnlyCode",
"followManName",
"followManOnlyCode"],
raw: true
});
} }
} }
module.exports=NeedinfoDao; module.exports = NeedinfoDao;
...@@ -7,8 +7,12 @@ class NeedinfoService extends ServiceBase { ...@@ -7,8 +7,12 @@ class NeedinfoService extends ServiceBase {
super("dbneed", ServiceBase.getDaoName(NeedinfoService)); super("dbneed", ServiceBase.getDaoName(NeedinfoService));
this.execlient = system.getObject("util.execClient"); this.execlient = system.getObject("util.execClient");
} }
async getItemByNeedNo(pobj){ async getItemByNeedNo(pobj) {
var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo);
if (!item) {
return system.getResult(null, "需求数据为空,30210");
}
return system.getResultSuccess(item);
} }
async needinfo2fq(pobj) { async needinfo2fq(pobj) {
pobj.actionBody.needNo = await this.getBusUid("n"); pobj.actionBody.needNo = await this.getBusUid("n");
...@@ -41,7 +45,7 @@ class NeedinfoService extends ServiceBase { ...@@ -41,7 +45,7 @@ class NeedinfoService extends ServiceBase {
// area // area
// type // type
// ext // ext
async createicneedinfo(pobj, actionBody) { async submitNeed(pobj, actionBody) {
var needNo = await this.getBusUid("n"); var needNo = await this.getBusUid("n");
if (actionBody.intentionBizId) { if (actionBody.intentionBizId) {
return system.getResult(null, "intentionBizId不能为空"); return system.getResult(null, "intentionBizId不能为空");
...@@ -67,15 +71,15 @@ class NeedinfoService extends ServiceBase { ...@@ -67,15 +71,15 @@ class NeedinfoService extends ServiceBase {
return await this.dao.create(nobj); return await this.dao.create(nobj);
} }
async solutionClose(pobj) { async needClose(pobj) {
if (actionBody.intentionBizId) { if (actionBody.intentionBizId) {
return system.getResult(null, "intentionBizId不能为空"); return system.getResult(null, "intentionBizId不能为空");
} }
var needinfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId }); var needinfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId });
needinfo.status = "ygb"; needinfo.status = "ygb";
var self=this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
await self.update(needinfo,t); await self.update(needinfo, t);
var needsolutioninfo = await self.needsolutionDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId }, t) var needsolutioninfo = await self.needsolutionDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId }, t)
needsolutioninfo.status = "yzf"; needsolutioninfo.status = "yzf";
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
......
已经使用的编码汇总: 已经使用的编码汇总:
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
30180 30180
30190 30190
30200 30200
30210
======================================================== ========================================================
......
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