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
1abacafd
Commit
1abacafd
authored
Jul 03, 2020
by
wkliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
2aa7e3a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
engine-product/app/base/service/impl/product/productSve.js
+18
-2
engine-product/app/config/routes/api.js
+29
-0
No files found.
engine-product/app/base/service/impl/product/productSve.js
View file @
1abacafd
const
ServiceBase
=
require
(
"../../sve.base"
);
const
system
=
require
(
'../../../system'
)
const
system
=
require
(
'../../../system'
);
const
{
where
}
=
require
(
"sequelize/lib/sequelize"
);
class
ProductService
extends
ServiceBase
{
constructor
()
{
super
(
"product"
,
ServiceBase
.
getDaoName
(
ProductService
));
...
...
@@ -30,6 +31,13 @@ class ProductService extends ServiceBase {
})
result
[
i
].
setDataValue
(
"ids"
,
res
)
delete
result
[
i
].
dataValues
.
productitems
let
resItem
=
await
this
.
dao
.
model
.
findAll
({
where
:
{
id
:
{
[
this
.
db
.
Op
.
in
]:
res
}
},
attributes
:
[
'id'
,
'product_name'
,
'price'
]
})
result
[
i
].
setDataValue
(
'items'
,
resItem
)
}
return
result
}
...
...
@@ -50,7 +58,15 @@ class ProductService extends ServiceBase {
arr
.
push
(
i
.
product_id
)
}
let
result
=
await
this
.
dao
.
getByIds
(
arr
)
return
result
let
res
=
result
.
map
((
data
)
=>
{
return
data
.
id
})
let
ans
=
{}
ans
.
items
=
result
ans
.
ids
=
res
let
pro
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
id
}
})
ans
.
pro
=
pro
return
ans
}
async
checkSitem
(
ids
)
{
...
...
engine-product/app/config/routes/api.js
View file @
1abacafd
...
...
@@ -51,6 +51,35 @@ module.exports = function (app) {
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
let
keys
=
Object
.
keys
(
params
[
2
].
action_body
)
for
(
let
i
of
keys
)
{
// 小数处理分转元
let
regdig
=
/^
(
-
?\\
d+
)(\\
.
\\
d+
)?
$/
// 整数处理
let
regint
=
/^-
?\\
d+$/
// 空key处理
if
(
params
[
2
].
action_body
[
i
]
==
null
||
params
[
2
].
action_body
[
i
]
==
""
||
params
[
2
].
action_body
[
i
]
==
[])
{
delete
params
[
2
].
action_body
[
i
]
}
else
if
(
Array
.
isArray
(
params
[
2
].
action_body
[
i
]))
{
// list
for
(
let
j
=
0
;
j
<
params
[
2
].
action_body
[
i
];
++
j
)
{
if
(
regdig
.
test
(
params
[
2
].
action_body
[
i
][
j
]))
{
params
[
2
].
action_body
[
i
][
j
]
=
Number
(
params
[
2
].
action_body
[
i
][
j
])
params
[
2
].
action_body
[
i
][
j
]
=
system
.
y2f
(
params
[
2
].
action_body
[
i
][
j
])
}
else
if
(
regint
.
test
(
params
[
2
].
action_body
[
i
][
j
]))
{
params
[
2
].
action_body
[
i
][
j
]
=
Number
(
params
[
2
].
action_body
[
i
][
j
])
}
}
}
else
if
(
regdig
.
test
(
params
[
2
].
action_body
[
i
]))
{
// 小数
params
[
2
].
action_body
[
i
]
=
Number
(
params
[
2
].
action_body
[
i
])
params
[
2
].
action_body
[
i
]
=
system
.
y2f
(
params
[
2
].
action_body
[
i
])
}
else
if
(
regint
.
test
(
params
[
2
].
action_body
[
i
]))
{
// 整数
params
[
2
].
action_body
[
i
]
=
Number
(
params
[
2
].
action_body
[
i
])
}
}
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexec"
])
{
...
...
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