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
18875d74
Commit
18875d74
authored
Jul 10, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-app' of gitlab.gongsibao.com:jiangyong/zhichan into center-app
parents
35495355
0fff6371
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
center-app/app/base/api/impl/action/opProduct.js
+3
-0
center-app/app/base/service/impl/dbproduct/productSve.js
+31
-7
No files found.
center-app/app/base/api/impl/action/opProduct.js
View file @
18875d74
...
@@ -47,6 +47,9 @@ class OpProductAPI extends APIBase {
...
@@ -47,6 +47,9 @@ class OpProductAPI extends APIBase {
case
"getProductPrice"
:
//询价
case
"getProductPrice"
:
//询价
opResult
=
await
this
.
productSve
.
getProductPrice
(
pobj
.
actionBody
);
opResult
=
await
this
.
productSve
.
getProductPrice
(
pobj
.
actionBody
);
break
;
break
;
case
"getMinPrice"
:
//最低价
opResult
=
await
this
.
productSve
.
getMinPrice
(
pobj
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-app/app/base/service/impl/dbproduct/productSve.js
View file @
18875d74
...
@@ -35,6 +35,7 @@ class ProductService extends ServiceBase {
...
@@ -35,6 +35,7 @@ class ProductService extends ServiceBase {
attributes
:
[
"id"
,
"pay_code"
,
"price"
,
"supply_price"
,
"service_charge"
,
"public_expense"
,
"is_default"
,
"is_show"
,
"price_type"
,
"price_type_name"
,
attributes
:
[
"id"
,
"pay_code"
,
"price"
,
"supply_price"
,
"service_charge"
,
"public_expense"
,
"is_default"
,
"is_show"
,
"price_type"
,
"price_type_name"
,
"sort"
,
"price_desc"
,
"min_qty"
,
"max_qty"
,
"service_code"
"sort"
,
"price_desc"
,
"min_qty"
,
"max_qty"
,
"service_code"
],
],
order
:
[
[
"price"
,
'ASC'
]
],
raw
:
true
raw
:
true
});
});
if
(
!
pList
||
pList
.
length
==
0
)
{
if
(
!
pList
||
pList
.
length
==
0
)
{
...
@@ -110,7 +111,7 @@ class ProductService extends ServiceBase {
...
@@ -110,7 +111,7 @@ class ProductService extends ServiceBase {
channel_item_code
=
channelItemCode
;
channel_item_code
=
channelItemCode
;
break
;
break
;
case
'zzxk'
:
case
'zzxk'
:
if
(
actionBody
.
province
!=
''
){
if
(
actionBody
.
province
){
producesql
+=
` AND pc.price_desc LIKE '%
${
actionBody
.
province
}
%'`
;
producesql
+=
` AND pc.price_desc LIKE '%
${
actionBody
.
province
}
%'`
;
}
else
{
}
else
{
return
system
.
getResultFail
(
null
,
'actionBody.province can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.province can not be empty!'
)
...
@@ -118,13 +119,13 @@ class ProductService extends ServiceBase {
...
@@ -118,13 +119,13 @@ class ProductService extends ServiceBase {
if
(
actionBody
.
time
!=
''
){
if
(
actionBody
.
time
!=
''
){
const
index
=
actionBody
.
time
.
indexOf
(
'个'
);
const
index
=
actionBody
.
time
.
indexOf
(
'个'
);
const
time
=
actionBody
.
time
.
substring
(
0
,
index
);
const
time
=
actionBody
.
time
.
substring
(
0
,
index
);
producesql
+=
` AND pc.additions_desc
LIKE '%
${
time
}
%
'`
;
producesql
+=
` AND pc.additions_desc
= '
${
time
}
'`
;
}
else
{
}
else
{
return
system
.
getResultFail
(
null
,
'actionBody.time can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.time can not be empty!'
)
}
}
break
;
break
;
case
'bqfu'
:
case
'bqfu'
:
if
(
actionBody
.
serviceType
!=
''
){
if
(
actionBody
.
serviceType
){
producesql
+=
` AND pc.price_desc LIKE '%
${
actionBody
.
serviceType
}
%'`
;
producesql
+=
` AND pc.price_desc LIKE '%
${
actionBody
.
serviceType
}
%'`
;
}
else
{
}
else
{
return
system
.
getResultFail
(
null
,
'actionBody.serviceType can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.serviceType can not be empty!'
)
...
@@ -132,14 +133,14 @@ class ProductService extends ServiceBase {
...
@@ -132,14 +133,14 @@ class ProductService extends ServiceBase {
if
(
actionBody
.
time
!=
''
){
if
(
actionBody
.
time
!=
''
){
const
index
=
actionBody
.
time
.
indexOf
(
'个'
);
const
index
=
actionBody
.
time
.
indexOf
(
'个'
);
const
time
=
actionBody
.
time
.
substring
(
0
,
index
)
const
time
=
actionBody
.
time
.
substring
(
0
,
index
)
producesql
+=
` AND pc.additions_desc
LIKE '%
${
time
}
%
'`
;
producesql
+=
` AND pc.additions_desc
= '
${
time
}
'`
;
}
else
{
}
else
{
return
system
.
getResultFail
(
null
,
'actionBody.time can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.time can not be empty!'
)
}
}
break
;
break
;
case
'gsfu'
:
case
'gsfu'
:
if
(
code2
!=
'ysgszc'
){
if
(
code2
!=
'ysgszc'
){
if
(
actionBody
.
city
!=
''
&&
actionBody
.
serviceType
!=
''
){
if
(
actionBody
.
city
&&
actionBody
.
serviceType
){
let
str
=
actionBody
.
city
+
actionBody
.
serviceType
;
let
str
=
actionBody
.
city
+
actionBody
.
serviceType
;
producesql
+=
` AND pc.price_desc LIKE '%
${
str
}
%'`
;
producesql
+=
` AND pc.price_desc LIKE '%
${
str
}
%'`
;
}
else
{
}
else
{
...
@@ -155,13 +156,19 @@ class ProductService extends ServiceBase {
...
@@ -155,13 +156,19 @@ class ProductService extends ServiceBase {
return
system
.
getResultFail
(
null
,
'actionBody.companyType and actionBody.companyType can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.companyType and actionBody.companyType can not be empty!'
)
}
}
break
;
break
;
case
'cs
db
'
:
case
'cs
fw
'
:
if
(
actionBody
.
city
!=
''
){
if
(
actionBody
.
city
){
let
str
=
actionBody
.
city
;
let
str
=
actionBody
.
city
;
if
(
code2
==
'gsdz'
||
code2
==
'sksq'
){
str
+=
actionBody
.
serviceType
;
}
producesql
+=
` AND pc.price_desc LIKE '%
${
str
}
%'`
;
producesql
+=
` AND pc.price_desc LIKE '%
${
str
}
%'`
;
}
else
{
}
else
{
return
system
.
getResultFail
(
null
,
'actionBody.serviceType can not be empty!'
)
return
system
.
getResultFail
(
null
,
'actionBody.serviceType can not be empty!'
)
}
}
if
(
code2
==
'sksq'
){
producesql
+=
` AND pc.additions_desc = '
${
actionBody
.
companyType
}
'`
}
break
;
break
;
default
:
default
:
producesql
+=
` AND pt.channel_item_code = '
${
code2
}
'`
;
producesql
+=
` AND pt.channel_item_code = '
${
code2
}
'`
;
...
@@ -175,5 +182,22 @@ class ProductService extends ServiceBase {
...
@@ -175,5 +182,22 @@ class ProductService extends ServiceBase {
}
}
return
system
.
getResultSuccess
(
actionBody
);
return
system
.
getResultSuccess
(
actionBody
);
}
}
/**
* 获取最低价
* @returns {Promise<void>}
*/
async
getMinPrice
(
pobj
){
let
data
=
{};
if
(
!
pobj
.
actionBody
.
product_id
){
return
system
.
getResultFail
(
-
1
,
'product_id is empty'
);
}
let
sql
=
`select min(price) price from p_product_price where product_id =
${
pobj
.
actionBody
.
product_id
}
`
;
let
result
=
await
this
.
customQuery
(
sql
);
if
(
result
){
data
=
result
[
0
];
}
return
system
.
getResultSuccess
(
data
);
}
}
}
module
.
exports
=
ProductService
;
module
.
exports
=
ProductService
;
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