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
8b2ba20a
Commit
8b2ba20a
authored
Feb 10, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
70a39091
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
50 deletions
+57
-50
center-app/app/base/api/impl/action/opProduct.js
+4
-7
center-app/app/base/db/impl/dbproduct/productDao.js
+23
-0
center-app/app/base/db/models/dbproduct/producttype.js
+1
-0
center-app/app/base/service/impl/dbproduct/productSve.js
+25
-39
center-app/app/config/localsettings.js
+4
-4
No files found.
center-app/app/base/api/impl/action/opProduct.js
View file @
8b2ba20a
...
@@ -22,14 +22,11 @@ class OpProductAPI extends APIBase {
...
@@ -22,14 +22,11 @@ class OpProductAPI extends APIBase {
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_type
)
{
switch
(
action_type
)
{
case
"get
CAProductListByTypeCode
"
:
//通过产品类别编码获取产品列表
case
"get
ProductList
"
:
//通过产品类别编码获取产品列表
opResult
=
await
this
.
productSve
.
findByTypeCode
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getProductList
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getCAProductListByTypeOneCode"
:
//通过产品大类编码获取产品列表
case
"getProductDetail"
:
//获取产品详情
opResult
=
await
this
.
productSve
.
findByTypeOneCode
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getProductDetail
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
case
"getCAProductDetail"
:
//获取产品详情
opResult
=
await
this
.
productSve
.
getProductDetailByCode
(
pobj
.
actionBody
.
channelItemCode
,
pobj
.
appInfo
.
uapp_id
);
break
;
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
...
...
center-app/app/base/db/impl/dbproduct/productDao.js
View file @
8b2ba20a
...
@@ -4,5 +4,28 @@ class ProductDao extends Dao {
...
@@ -4,5 +4,28 @@ class ProductDao extends Dao {
constructor
()
{
constructor
()
{
super
(
Dao
.
getModelName
(
ProductDao
));
super
(
Dao
.
getModelName
(
ProductDao
));
}
}
async
getItemByChannelItemCode
(
channelItemCode
,
uapp_id
)
{
return
this
.
model
.
findOne
({
where
:
{
uapp_id
:
uapp_id
,
channel_item_code
:
channelItemCode
},
attributes
:
[
"id"
,
"uapp_id"
,
"path_code"
,
"path_name"
,
"item_code"
,
"item_name"
,
"channel_item_code"
,
"channel_item_name"
,
"pic_url"
,
"product_desc"
,
"desc_url"
,
"icon_url"
,
"productType_id"
],
raw
:
true
});
}
}
}
module
.
exports
=
ProductDao
;
module
.
exports
=
ProductDao
;
center-app/app/base/db/models/dbproduct/producttype.js
View file @
8b2ba20a
...
@@ -3,6 +3,7 @@ const settings = require("../../../../config/settings");
...
@@ -3,6 +3,7 @@ const settings = require("../../../../config/settings");
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"producttype"
,
{
return
db
.
define
(
"producttype"
,
{
uapp_id
:
DataTypes
.
INTEGER
,
//应用id
p_id
:
DataTypes
.
INTEGER
,
//父id
p_id
:
DataTypes
.
INTEGER
,
//父id
type_code
:
DataTypes
.
STRING
(
64
),
type_code
:
DataTypes
.
STRING
(
64
),
type_name
:
DataTypes
.
STRING
(
64
),
type_name
:
DataTypes
.
STRING
(
64
),
...
...
center-app/app/base/service/impl/dbproduct/productSve.js
View file @
8b2ba20a
...
@@ -8,49 +8,35 @@ class ProductService extends ServiceBase {
...
@@ -8,49 +8,35 @@ class ProductService extends ServiceBase {
this
.
productpriceDao
=
system
.
getObject
(
"db.dbproduct.productpriceDao"
);
this
.
productpriceDao
=
system
.
getObject
(
"db.dbproduct.productpriceDao"
);
}
}
/**
/**
*
获取产品详情
*
通过产品类别编码路径获取产品列表
* @param {*}
channelItemCode 渠道产品码
* @param {*}
actionBody pathCode 为类别编码路径,一级类下产品列表 sbfu,二级类下产品列表sbfu/sbzc
* @param {*}
uappid 渠道id
* @param {*}
appInfo 应用信息
*/
*/
async
getProductDetailByCode
(
channelItemCode
,
uappid
)
{
async
getProductList
(
actionBody
,
appInfo
)
{
var
sql
=
"select * from v_product where uapp_id="
+
uappid
+
" and channel_item_code='"
+
channelItemCode
+
"'"
;
var
sql
=
"select * from v_product where uapp_id="
+
appInfo
.
uapp_id
+
" and path_code like '"
+
actionBody
.
pathCode
+
"%'"
;
var
tmpResult
=
await
this
.
customQuery
(
sql
);
var
list
=
await
this
.
customQuery
(
sql
);
if
(
tmpResult
&&
tmpResult
.
length
>
0
)
{
return
system
.
getResultSuccess
(
list
);
for
(
var
i
=
0
;
i
<
tmpResult
.
length
;
i
++
)
{
var
pro
=
tmpResult
[
i
];
if
(
pro
.
id
)
{
var
ppList
=
await
this
.
productpriceDao
.
model
.
findAll
({
where
:
{
product_id
:
pro
.
id
},
attributes
:
[
"price"
,
"supply_price"
,
"service_charge"
,
"public_expense"
,
"is_default"
,
"price_type"
,
"price_type_name"
,
"sort"
,
"price_desc"
,
"min_qty"
,
"max_qty"
],
raw
:
true
});
pro
.
productPriceList
=
ppList
;
}
}
}
return
system
.
getResultSuccess
(
tmpResult
);
}
/**
* 通过产品类别编码获取产品列表
* @param {*} actionBody
*/
async
findByTypeCode
(
actionBody
,
appInfo
)
{
var
sql
=
"select * from v_product where uapp_id="
+
appInfo
.
uapp_id
+
" and type_code='"
+
actionBody
.
typeCode
+
"'"
;
var
tmpResult
=
await
this
.
customQuery
(
sql
);
return
system
.
getResultSuccess
(
tmpResult
);
}
}
/**
/**
* 通过产品大类编码获取产品列表
* 通过渠道产品编码获取产品详情
* @param {*} actionBody
* @param {*} actionBody channelItemCode 渠道产品编码
* @param {*} appInfo 应用信息
*/
*/
async
findByTypeOneCode
(
actionBody
,
appInfo
)
{
async
getProductDetail
(
actionBody
,
appInfo
)
{
var
sql
=
"select * from v_product where uapp_id="
+
appInfo
.
uapp_id
+
" and p_type_code='"
+
actionBody
.
typeOneCode
+
"'"
;
var
item
=
await
this
.
dao
.
getItemByChannelItemCode
(
actionBody
.
channelItemCode
,
appInfo
.
uapp_id
);
var
tmpResult
=
await
this
.
customQuery
(
sql
);
if
(
!
item
)
{
return
system
.
getResultSuccess
(
tmpResult
);
return
system
.
getResult
(
null
,
"item is data empty"
);
}
var
pList
=
await
this
.
productpriceDao
.
model
.
findAll
({
where
:
{
product_id
:
item
.
id
},
attributes
:
[
"id"
,
"price"
,
"supply_price"
,
"service_charge"
,
"public_expense"
,
"is_default"
,
"price_type"
,
"price_type_name"
,
"sort"
,
"price_desc"
,
"min_qty"
,
"max_qty"
],
raw
:
true
});
item
.
price_list
=
pList
;
return
system
.
getResultSuccess
(
item
);
}
}
}
}
module
.
exports
=
ProductService
;
module
.
exports
=
ProductService
;
center-app/app/config/localsettings.js
View file @
8b2ba20a
...
@@ -7,11 +7,11 @@ var settings={
...
@@ -7,11 +7,11 @@ var settings={
},
},
database
:{
database
:{
dbname
:
"center_app"
,
dbname
:
"center_app"
,
user
:
"
write
"
,
user
:
"
root
"
,
password
:
"
write
"
,
password
:
"
root
"
,
config
:
{
config
:
{
host
:
'
43.247.184
.35'
,
host
:
'
121.36.3
.35'
,
port
:
8899
,
port
:
3306
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
false
,
pool
:
{
pool
:
{
...
...
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