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
14782c26
Commit
14782c26
authored
May 07, 2021
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lin add productType
parent
29588d1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
82 deletions
+132
-82
center-app/app/base/api/impl/action/opProduct.js
+87
-78
center-app/app/base/service/impl/dbproduct/producttypeSve.js
+45
-4
No files found.
center-app/app/base/api/impl/action/opProduct.js
View file @
14782c26
...
@@ -2,87 +2,96 @@ var APIBase = require("../../api.base");
...
@@ -2,87 +2,96 @@ var APIBase = require("../../api.base");
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
OpProductAPI
extends
APIBase
{
class
OpProductAPI
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
productSve
=
system
.
getObject
(
"service.dbproduct.productSve"
);
this
.
productSve
=
system
.
getObject
(
"service.dbproduct.productSve"
);
this
.
producttypeSve
=
system
.
getObject
(
"service.dbproduct.producttypeSve"
);
this
.
producttypeSve
=
system
.
getObject
(
"service.dbproduct.producttypeSve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
}
/**
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
* 接口跳转-POST请求
return
result
;
* action_process 执行的流程
}
* action_type 执行的类型
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
* action_body 执行的参数
var
opResult
=
null
;
*/
switch
(
action_type
)
{
async
springBoard
(
pobj
,
qobj
,
req
)
{
case
"getProductList"
:
//通过产品类别编码获取产品列表
if
(
!
pobj
.
actionType
)
{
opResult
=
await
this
.
productSve
.
getProductList
(
pobj
.
actionBody
,
pobj
.
appInfo
);
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
break
;
}
case
"getProductDetail"
:
//获取产品详情
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
opResult
=
await
this
.
productSve
.
getProductDetail
(
pobj
.
actionBody
,
pobj
.
appInfo
);
return
result
;
break
;
}
case
"getProductInterface"
:
//获取产品接口信息
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
opResult
=
await
this
.
productSve
.
getProductInterface
(
pobj
,
pobj
.
actionBody
);
var
opResult
=
null
;
break
;
switch
(
action_type
)
{
case
"getAppInterface"
:
//获取应用接口信息
case
"getProductList"
:
//通过产品类别编码获取产品列表
opResult
=
await
this
.
productSve
.
getAppInterface
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
productSve
.
getProductList
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getaliicProduce"
:
//阿里工商获取产品信息
case
"getProductDetail"
:
//获取产品详情
opResult
=
await
this
.
productSve
.
getaliicProduce
(
pobj
.
actionBody
);
opResult
=
await
this
.
productSve
.
getProductDetail
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getaliicpProduce"
:
//阿里icp获取产品信息
case
"getProductInterface"
:
//获取产品接口信息
opResult
=
await
this
.
productSve
.
getaliicpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getProductInterface
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
case
"getIcpProduce"
:
//获取ICP产品信息
case
"getAppInterface"
:
//获取应用接口信息
opResult
=
await
this
.
productSve
.
getIcpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getAppInterface
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
case
"getProductTypeInfo"
:
//阿里工商获取需求類型
case
"getaliicProduce"
:
//阿里工商获取产品信息
opResult
=
await
this
.
producttypeSve
.
getProductTypeInfo
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getaliicProduce
(
pobj
.
actionBody
);
break
;
break
;
case
"getProductPrice"
:
//询价
case
"getaliicpProduce"
:
//阿里icp获取产品信息
opResult
=
await
this
.
productSve
.
getProductPrice
(
pobj
.
actionBody
);
opResult
=
await
this
.
productSve
.
getaliicpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getMinPrice"
:
//最低价
case
"getIcpProduce"
:
//获取ICP产品信息
opResult
=
await
this
.
productSve
.
getMinPrice
(
pobj
);
opResult
=
await
this
.
productSve
.
getIcpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getProductRecommend"
:
case
"getProductTypeInfo"
:
//阿里工商获取需求類型
opResult
=
await
this
.
productSve
.
getProductRecommend
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
producttypeSve
.
getProductTypeInfo
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"updateProductPrice"
:
case
"getProductPrice"
:
//询价
opResult
=
await
this
.
productSve
.
updateProductPrice
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getProductPrice
(
pobj
.
actionBody
);
break
;
break
;
//2020-12-17 baidu reg start -----------------
case
"getMinPrice"
:
//最低价
case
"getRegProducePrice"
:
//获取reg产品price
opResult
=
await
this
.
productSve
.
getMinPrice
(
pobj
);
opResult
=
await
this
.
productSve
.
getRegProducePrice
(
pobj
.
actionBody
);
break
;
break
;
case
"getProductRecommend"
:
opResult
=
await
this
.
productSve
.
getProductRecommend
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
case
"updateProductPrice"
:
opResult
=
await
this
.
productSve
.
updateProductPrice
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
//2020-12-17 baidu reg start -----------------
case
"getRegProducePrice"
:
//获取reg产品price
opResult
=
await
this
.
productSve
.
getRegProducePrice
(
pobj
.
actionBody
);
break
;
//2020-12-17 baidu reg end -----------------
//2020-12-17 baidu reg end -----------------
case
"getAllProducts"
:
case
"getAllProducts"
:
opResult
=
await
this
.
productSve
.
getAllProducts
();
opResult
=
await
this
.
productSve
.
getAllProducts
();
break
;
break
;
case
"getProductByWhere"
:
case
"getProductByWhere"
:
opResult
=
await
this
.
productSve
.
getProductByWhere
(
pobj
.
actionBody
);
opResult
=
await
this
.
productSve
.
getProductByWhere
(
pobj
.
actionBody
);
break
;
break
;
case
"getymicpProduce"
:
//易名icp获取产品信息
case
"getymicpProduce"
:
//易名icp获取产品信息
opResult
=
await
this
.
productSve
.
getymicpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
opResult
=
await
this
.
productSve
.
getymicpProduce
(
pobj
.
actionBody
,
pobj
.
appInfo
);
break
;
break
;
case
"getAllPathName"
:
case
"getAllPathName"
:
opResult
=
await
this
.
productSve
.
getAllPathName
();
opResult
=
await
this
.
productSve
.
getAllPathName
();
break
;
break
;
default
:
case
"getAllProductType"
:
// 获取全部产品大类
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
await
this
.
producttypeSve
.
getAllProductType
(
pobj
.
actionBody
);
break
;
break
;
}
case
"submitProductType"
:
// 创建产品大类
return
opResult
;
opResult
=
await
this
.
producttypeSve
.
submitProductType
(
pobj
.
actionBody
);
break
;
case
"editProductType"
:
// 修改产品大类
opResult
=
await
this
.
producttypeSve
.
editProductType
(
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
}
return
opResult
;
}
}
}
...
...
center-app/app/base/service/impl/dbproduct/producttypeSve.js
View file @
14782c26
...
@@ -7,16 +7,57 @@ class ProductTypeService extends ServiceBase {
...
@@ -7,16 +7,57 @@ class ProductTypeService extends ServiceBase {
super
(
"dbproduct"
,
ServiceBase
.
getDaoName
(
ProductTypeService
));
super
(
"dbproduct"
,
ServiceBase
.
getDaoName
(
ProductTypeService
));
}
}
async
getProductTypeInfo
(
actionBody
,
appInfo
)
{
async
getProductTypeInfo
(
actionBody
,
appInfo
)
{
if
(
!
actionBody
.
type
)
{
if
(
!
actionBody
.
type
)
{
return
system
.
getResult
(
null
,
"channelCode item is data empty !"
);
return
system
.
getResult
(
null
,
"channelCode item is data empty !"
);
}
}
if
(
!
appInfo
)
{
if
(
!
appInfo
)
{
return
system
.
getResult
(
null
,
"appInfo item is data empty !"
);
return
system
.
getResult
(
null
,
"appInfo item is data empty !"
);
}
}
var
producttypeinfo
=
await
this
.
findOne
({
"channel_type_code"
:
actionBody
.
type
,
"uapp_id"
:
appInfo
.
uapp_id
});
var
producttypeinfo
=
await
this
.
findOne
({
"channel_type_code"
:
actionBody
.
type
,
"uapp_id"
:
appInfo
.
uapp_id
});
return
system
.
getResultSuccess
(
producttypeinfo
);
return
system
.
getResultSuccess
(
producttypeinfo
);
}
}
/**
* 获取全部产品大类
* @returns {Promise<void>}
*/
async
getAllProductType
(
actionBody
)
{
var
tmpWhere
=
{
pageInfo
:
{}
};
if
(
actionBody
)
{
if
(
actionBody
.
pageSize
)
{
tmpWhere
.
limit
=
actionBody
.
pageSize
;
}
if
(
actionBody
.
current
)
{
let
current
=
actionBody
.
current
;
tmpWhere
.
offset
=
(
current
-
1
)
*
actionBody
.
pageSize
;
}
}
let
result
=
await
this
.
dao
.
model
.
findAndCountAll
(
tmpWhere
)
return
system
.
getResultSuccess
(
result
);
}
/**
* 创建产品大类
* @returns {Promise<void>}
*/
async
submitProductType
(
actionBody
)
{
let
result
=
await
this
.
dao
.
model
.
create
(
actionBody
)
return
system
.
getResultSuccess
(
result
);
}
/**
* 修改产品大类
* @returns {Promise<void>}
*/
async
editProductType
(
actionBody
)
{
if
(
actionBody
)
{
let
result
=
await
this
.
dao
.
update
(
actionBody
)
return
system
.
getResultSuccess
(
result
);
}
return
;
}
}
}
module
.
exports
=
ProductTypeService
;
module
.
exports
=
ProductTypeService
;
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