Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
251ca961
Commit
251ca961
authored
Nov 26, 2019
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prodect
parent
a92a43d6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
0 deletions
+95
-0
igirl-channel/app/base/api/impl/action/tmOrder.js
+10
-0
igirl-channel/app/base/service/impl/dbapp/appproductSve.js
+85
-0
No files found.
igirl-channel/app/base/api/impl/action/tmOrder.js
View file @
251ca961
...
...
@@ -14,6 +14,7 @@ class TmOrderAPI extends APIBase {
this
.
pushFqbossDataUrl
=
settings
.
pushFqbossDataUrl
();
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
this
.
toolSve
=
system
.
getObject
(
"service.trademark.toolSve"
);
this
.
appProductSve
=
system
.
getObject
(
"service.dbapp.appproductSve"
);
}
/**
* 接口跳转-POST请求
...
...
@@ -174,6 +175,15 @@ class TmOrderAPI extends APIBase {
case
"pushFqBusiness"
:
//推送商机到峰擎
opResult
=
await
this
.
orderSve
.
pushFqBusiness
(
action_body
,
pobj
,
req
);
break
;
case
"getProductDetail"
:
//根据渠道产品码获取产品详情
opResult
=
await
this
.
appProductSve
.
findByChannelItemCode
(
action_body
);
break
;
case
"getProductListByTypeOneCode"
:
//获取产品列表(根据产品一类编码获取)
opResult
=
await
this
.
appProductSve
.
findByProductOneTypeCode
(
action_body
);
break
;
case
"getProductListByTypeCode"
:
//获取产品列表(根据父类产品编码获取)
opResult
=
await
this
.
appProductSve
.
findByProductTypeCode
(
action_body
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
igirl-channel/app/base/service/impl/dbapp/appproductSve.js
View file @
251ca961
...
...
@@ -6,5 +6,90 @@ class AppProductService extends ServiceBase {
constructor
()
{
super
(
"dbapp"
,
ServiceBase
.
getDaoName
(
AppProductService
));
}
//根据渠道产品码获取产品详情
async
findByChannelItemCode
(
obj
){
var
user
=
obj
.
user
;
var
app
=
obj
.
app
;
if
(
!
user
){
return
system
.
getResultFail
(
-
101
,
"未知用户"
);
}
if
(
!
app
){
return
system
.
getResultFail
(
-
102
,
"未知渠道"
);
}
var
channelItemCode
=
obj
.
channelItemCode
;
if
(
!
channelItemCode
){
return
system
.
getResultFail
(
-
103
,
"渠道产品编码不能为空"
);
}
var
product
=
await
this
.
dao
.
model
.
findOne
({
where
:{
channelItemCode
:
channelItemCode
,
app_id
:
app
.
id
,
status
:
1
},
attributes
:[
"id"
,
"app_id"
,
"itemCode"
,
"itemName"
,
"picUrl"
,
"channelItemCode"
,
"channelItemName"
,
"serviceItemCode"
,
"proPrice"
,
"serviceCharge"
,
"publicExpense"
,
"rateConfig"
,
"discountsRateConfig"
],
raw
:
true
});
if
(
!
product
){
return
system
.
getResultFail
(
-
104
,
"未知产品"
);
}
return
system
.
getResultSuccess
(
product
);
}
//获取产品列表(根据父类产品编码获取)
async
findByProductTypeCode
(
obj
){
var
user
=
obj
.
user
;
var
app
=
obj
.
app
;
if
(
!
user
){
return
system
.
getResultFail
(
-
101
,
"未知用户"
);
}
if
(
!
app
){
return
system
.
getResultFail
(
-
102
,
"未知渠道"
);
}
var
itemCode
=
obj
.
itemCode
;
if
(
!
itemCode
){
return
system
.
getResultFail
(
-
103
,
"渠道产品编码不能为空"
);
}
var
pProduct
=
await
this
.
dao
.
model
.
findOne
({
where
:{
itemCode
:
itemCode
,
app_id
:
app
.
id
,
status
:
1
},
attributes
:[
"id"
,
"app_id"
,
"itemCode"
,
"itemName"
],
raw
:
true
});
if
(
!
pProduct
||
!
pProduct
.
id
){
return
system
.
getResultFail
(
-
104
,
"未知产品"
);
}
var
pList
=
await
this
.
dao
.
model
.
findAll
({
where
:{
productType_id
:
pProduct
.
id
,
app_id
:
app
.
id
,
status
:
1
},
attributes
:[
"id"
,
"app_id"
,
"itemCode"
,
"itemName"
,
"picUrl"
,
"channelItemCode"
,
"channelItemName"
,
"serviceItemCode"
,
"proPrice"
,
"serviceCharge"
,
"publicExpense"
,
"rateConfig"
,
"discountsRateConfig"
],
raw
:
true
});
return
system
.
getResultSuccess
(
pList
);
}
//获取产品列表(根据产品一类编码获取)
async
findByProductOneTypeCode
(
obj
){
var
user
=
obj
.
user
;
var
app
=
obj
.
app
;
if
(
!
user
){
return
system
.
getResultFail
(
-
101
,
"未知用户"
);
}
if
(
!
app
){
return
system
.
getResultFail
(
-
102
,
"未知渠道"
);
}
var
itemCode
=
obj
.
itemCode
;
if
(
!
itemCode
){
return
system
.
getResultFail
(
-
103
,
"渠道产品编码不能为空"
);
}
var
pProduct
=
await
this
.
dao
.
model
.
findOne
({
where
:{
itemCode
:
itemCode
,
app_id
:
app
.
id
,
status
:
1
},
attributes
:[
"id"
,
"app_id"
,
"itemCode"
,
"itemName"
],
raw
:
true
});
if
(
!
pProduct
||
!
pProduct
.
id
){
return
system
.
getResultFail
(
-
104
,
"未知产品"
);
}
var
pList
=
await
this
.
dao
.
model
.
findAll
({
where
:{
productOneType_id
:
pProduct
.
id
,
productType_id
:{
[
this
.
db
.
Op
.
ne
]:
0
},
app_id
:
app
.
id
,
status
:
1
},
attributes
:[
"id"
,
"app_id"
,
"itemCode"
,
"itemName"
,
"picUrl"
,
"channelItemCode"
,
"channelItemName"
,
"serviceItemCode"
,
"proPrice"
,
"serviceCharge"
,
"publicExpense"
,
"rateConfig"
,
"discountsRateConfig"
],
raw
:
true
});
return
system
.
getResultSuccess
(
pList
);
}
}
module
.
exports
=
AppProductService
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment