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
8e000522
Commit
8e000522
authored
Jun 23, 2020
by
wkliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
起名宝相关接口
parent
b4867ca2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
272 additions
and
1 deletions
+272
-1
center-order/app/base/api/impl/askfor/askfor.js
+44
-0
center-order/app/base/api/impl/askfor/collect.js
+40
-0
center-order/app/base/db/impl/askfor/askForDao.js
+26
-0
center-order/app/base/db/impl/askfor/collectDao.js
+40
-0
center-order/app/base/db/models/askfor/askfor.js
+21
-0
center-order/app/base/db/models/askfor/collect.js
+19
-0
center-order/app/base/service/impl/askfor/askForSve.js
+20
-0
center-order/app/base/service/impl/askfor/collectSve.js
+24
-0
center-order/表的更新
+38
-1
No files found.
center-order/app/base/api/impl/askfor/askfor.js
0 → 100644
View file @
8e000522
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
class
AskForAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
askForSve
=
system
.
getObject
(
"service.askfor.AskForSve"
);
}
async
tradeMark
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
userInfo
)
{
return
system
.
getResultFail
(
system
.
noLogin
,
"user no login!"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
let
result
switch
(
pobj
.
actionType
)
{
case
"getByUid"
:
result
=
await
this
.
askForSve
.
getByUid
(
pobj
.
userInfo
.
id
,
pobj
.
actionBody
.
page
)
return
system
.
getResult2
(
result
)
case
'create'
:
let
param
=
{}
param
.
user_id
=
pobj
.
userInfo
.
id
delete
pobj
.
actionBody
.
type
param
.
a_content
=
JSON
.
stringify
(
pobj
.
actionBody
.
content
)
param
.
a_type
=
1
param
.
a_id
=
new
Date
().
getTime
()
if
(
pobj
.
actionBody
.
user_name
)
{
param
.
user_name
=
pobj
.
actionBody
.
user_name
}
param
.
a_mobile
=
pobj
.
actionBody
.
mobile
||
pobj
.
userInfo
.
mobile
if
(
pobj
.
actionBody
.
addr
)
{
param
.
a_addr
=
pobj
.
actionBody
.
addr
}
result
=
await
this
.
askForSve
.
create
(
param
)
return
system
.
getResult2
(
result
)
case
'delete'
:
result
=
await
this
.
askForSve
.
delete
(
pobj
.
actionBody
.
id
)
return
system
.
getResult2
(
result
)
}
}
}
module
.
exports
=
AskForAPI
;
\ No newline at end of file
center-order/app/base/api/impl/askfor/collect.js
0 → 100644
View file @
8e000522
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
class
CollectAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
collectSve
=
system
.
getObject
(
"service.askfor.CollectSve"
);
}
async
tradeMark
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
userInfo
)
{
return
system
.
getResultFail
(
system
.
noLogin
,
"user no login!"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
let
result
switch
(
pobj
.
actionType
)
{
case
'getByUid'
:
result
=
await
this
.
collectSve
.
getByUid
(
pobj
.
userInfo
.
id
,
pobj
.
actionBody
.
page
)
return
system
.
getResult2
(
result
)
case
'getByUidAndCollections'
:
result
=
await
this
.
collectSve
.
getByUidAndCollections
(
pobj
.
userInfo
.
id
,
pobj
.
actionBody
.
collections
)
return
system
.
getResult2
(
result
)
case
'create'
:
let
param
=
{}
param
.
user_id
=
pobj
.
userInfo
.
id
delete
pobj
.
actionBody
.
type
param
.
c_content
=
JSON
.
stringify
(
pobj
.
actionBody
)
param
.
c_type
=
1
result
=
await
this
.
collectSve
.
create
(
param
)
return
system
.
getResult2
(
result
)
case
'delete'
:
result
=
await
this
.
collectSve
.
delete
(
pobj
.
actionBody
.
id
)
return
system
.
getResult2
(
result
)
}
}
}
module
.
exports
=
CollectAPI
;
\ No newline at end of file
center-order/app/base/db/impl/askfor/askForDao.js
0 → 100644
View file @
8e000522
const
Dao
=
require
(
"../../dao.base"
);
class
AskForDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
AskForDao
));
}
async
getByUid
(
uid
,
page
=
1
)
{
return
await
this
.
model
.
findAndCountAll
({
where
:
{
user_id
:
uid
,
a_type
:
1
},
limit
:
11
,
offset
:
(
page
-
1
)
*
11
})
}
async
create
(
param
)
{
return
await
this
.
model
.
create
(
param
)
}
async
delete
(
id
)
{
return
await
this
.
model
.
destroy
({
where
:{
id
:
id
}})
}
}
module
.
exports
=
AskForDao
;
\ No newline at end of file
center-order/app/base/db/impl/askfor/collectDao.js
0 → 100644
View file @
8e000522
const
Dao
=
require
(
"../../dao.base"
);
class
CollectDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
CollectDao
));
}
async
getByUid
(
uid
,
page
=
1
)
{
return
await
this
.
model
.
findAndCountAll
({
where
:
{
user_id
:
uid
,
c_type
:
1
},
limit
:
9
,
offset
:
(
page
-
1
)
*
9
})
}
async
getByUidAndCollections
(
uid
,
collections
)
{
let
selectSql
=
`SELECT * FROM c_collect WHERE user_id=
${
uid
}
and c_type=1 and (`
;
for
(
let
i
in
collections
)
{
if
(
i
==
0
)
{
selectSql
+=
`c_content like "%\\"name\\":\\"
${
collections
[
i
]}
\\"%"`
}
else
{
selectSql
+=
` or c_content like "%\\"name\\":\\"
${
collections
[
i
]}
\\"%"`
}
}
selectSql
+=
')'
let
list
=
await
this
.
customQuery
(
selectSql
);
return
list
}
async
create
(
param
)
{
return
await
this
.
model
.
create
(
param
)
}
async
delete
(
id
)
{
return
await
this
.
model
.
destroy
({
where
:{
id
:
id
}})
}
}
module
.
exports
=
CollectDao
;
\ No newline at end of file
center-order/app/base/db/models/askfor/askfor.js
0 → 100644
View file @
8e000522
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"askfor"
,
{
user_id
:
DataTypes
.
INTEGER
,
// userId
a_type
:
DataTypes
.
INTEGER
,
// 申请类型 枚举 1: 商标 剩余待定
a_content
:
DataTypes
.
STRING
,
// 内容 具体格式为 {xxx: url: desc: } 默认空对象
user_name
:
DataTypes
.
STRING
,
// 申请人姓名 可空
a_status
:
DataTypes
.
INTEGER
,
// 申请状态 1: 已发布 2: 待响应 3: 待确认方案 4: 已完成
a_id
:
DataTypes
.
STRING
,
// 需求id 随机
a_mobile
:
DataTypes
.
STRING
,
// 申请人手机号
a_addr
:
DataTypes
.
STRING
// 服务区域 可空
},
{
paranoid
:
true
,
underscored
:
true
,
timestamps
:
true
,
tableName
:
'a_askfor'
,
version
:
true
,
freezeTableName
:
true
}
)
}
\ No newline at end of file
center-order/app/base/db/models/askfor/collect.js
0 → 100644
View file @
8e000522
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"collect"
,
{
user_id
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
'userid'
},
// userId
c_type
:
DataTypes
.
INTEGER
,
// 收藏类型 枚举 1: 商标 剩余待定
c_content
:
DataTypes
.
STRING
,
// 内容 具体格式为 {name: url: desc: }
},
{
paranoid
:
true
,
underscored
:
true
,
timestamps
:
true
,
tableName
:
'c_collect'
,
version
:
true
,
freezeTableName
:
true
}
)
}
\ No newline at end of file
center-order/app/base/service/impl/askfor/askForSve.js
0 → 100644
View file @
8e000522
const
ServiceBase
=
require
(
"../../sve.base"
);
class
AskForService
extends
ServiceBase
{
constructor
()
{
super
(
"askfor"
,
ServiceBase
.
getDaoName
(
AskForService
));
}
async
getByUid
(
uid
,
page
=
1
)
{
return
await
this
.
dao
.
getByUid
(
uid
,
page
);
}
async
create
(
param
)
{
return
await
this
.
dao
.
create
(
param
);
}
async
delete
(
id
)
{
return
await
this
.
dao
.
delete
(
id
)
}
}
module
.
exports
=
AskForService
;
\ No newline at end of file
center-order/app/base/service/impl/askfor/collectSve.js
0 → 100644
View file @
8e000522
const
ServiceBase
=
require
(
"../../sve.base"
);
class
CollectService
extends
ServiceBase
{
constructor
()
{
super
(
"askfor"
,
ServiceBase
.
getDaoName
(
CollectService
));
}
async
getByUid
(
uid
,
page
=
1
)
{
return
await
this
.
dao
.
getByUid
(
uid
,
page
);
}
async
getByUidAndCollections
(
uid
,
collections
)
{
return
await
this
.
dao
.
getByUidAndCollections
(
uid
,
collections
)
}
async
create
(
param
)
{
return
await
this
.
dao
.
create
(
param
);
}
async
delete
(
id
)
{
return
await
this
.
dao
.
delete
(
id
)
}
}
module
.
exports
=
CollectService
;
\ No newline at end of file
center-order/表的更新
View file @
8e000522
示例:--
--------------------------------开始--------------------------------------------------------------------
示例:--
--------------------------------开始--------------------------------------------------------------------
...
@@ -70,3 +70,39 @@ CREATE TABLE `b_policy_subscribe` (
...
@@ -70,3 +70,39 @@ CREATE TABLE `b_policy_subscribe` (
`version` int(11) NOT NULL DEFAULT '0',
`version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2020-6-22 wkliang
----------------------------------开始--------------------------------------------------------------------
DROP TABLE IF EXISTS `a_askfor`;
CREATE TABLE `a_askfor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NULL DEFAULT NULL,
`a_type` int(11) NOT NULL COMMENT '申请类型 1 商标',
`a_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '{}' COMMENT '内容 具体格式为 {xxx: url: desc: } 默认空对象',
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申请人姓名',
`a_status` int(11) NOT NULL DEFAULT 1 COMMENT '申请状态 1: 已发布 2: 待响应 3: 待确认方案 4: 已完成',
`a_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '需求id 随机 ',
`a_mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ' 申请人手机号',
`a_addr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务区域 ',
`deleted_at` datetime(0) NULL DEFAULT NULL,
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`version` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `a_id_index`(`a_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `c_collect`;
CREATE TABLE `c_collect` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`c_type` int(255) NOT NULL COMMENT '收藏类型 枚举 1: 商标 剩余待定',
`c_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '{}' COMMENT '内容 具体格式为 {name: url: desc: }',
`deleted_at` datetime(0) NULL DEFAULT NULL,
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`version` int(255) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
----------------------------------结束--------------------------------------------------------------------
\ No newline at end of file
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