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
d2cdb5a3
Commit
d2cdb5a3
authored
Aug 19, 2020
by
钟占达
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gsb-marketplat' of gitlab.gongsibao.com:jiangyong/zhichan into gsb-marketplat
parents
5cfee64c
c15061c6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
11 deletions
+56
-11
gsb-marketplat/app/base/api/impl/action/template.js
+1
-0
gsb-marketplat/app/base/db/models/configmag/formsubmitrecord.js
+9
-2
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
+6
-4
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
+1
-1
gsb-marketplat/app/base/service/impl/configmag/formsubmitrecordSve.js
+4
-4
gsb-marketplat/app/front/entry/public/apidoc/customer/template.md
+35
-0
No files found.
gsb-marketplat/app/base/api/impl/action/template.js
View file @
d2cdb5a3
...
...
@@ -59,6 +59,7 @@ class Template extends APIBase {
opResult
=
await
this
.
templatelinkSve
.
getTemplateAndLinkInfo
(
pobj
);
break
;
case
"submitFormRecord"
:
//提交表单记录
var
a
=
0
;
opResult
=
await
this
.
formsubmitrecordSve
.
submitFormRecord
(
pobj
);
break
;
default
:
...
...
gsb-marketplat/app/base/db/models/configmag/formsubmitrecord.js
View file @
d2cdb5a3
...
...
@@ -4,13 +4,20 @@
* @param DataTypes
* @returns {Model|void|*}
*/
const
record_status
=
{
"1"
:
"未读"
,
"2"
:
"已读"
,
"3"
:
"无效"
};
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"formsubmitrecord"
,
{
business_code
:
DataTypes
.
STRING
(
100
),
template_id
:
DataTypes
.
INTEGER
(
11
),
//模板id
templatelink_id
:
DataTypes
.
INTEGER
(
11
),
//模板链接id
form_id
:
DataTypes
.
INTEGER
(
11
),
//表单id
record_status
:
DataTypes
.
STRING
(
60
),
//记录状态 1未读 2已读 3无效
form_id
:
DataTypes
.
INTEGER
(
11
),
//表单id
record_status
:{
//记录状态 1未读 2已读 3无效
type
:
DataTypes
.
STRING
(
60
),
set
:
function
(
val
)
{
this
.
setDataValue
(
"record_status"
,
val
);
this
.
setDataValue
(
"record_status_name"
,
record_status
[
val
]);
}
},
record_status_name
:
DataTypes
.
STRING
(
60
),
//记录状态名称
templatelink_snapshot
:
DataTypes
.
JSON
,
//模板链接快照
record_content
:
DataTypes
.
JSON
,
//记录内容
...
...
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
View file @
d2cdb5a3
...
...
@@ -156,17 +156,19 @@ class ForminfoService extends ServiceBase {
let
ctls
=
[];
if
(
items
.
length
>
0
){
items
.
forEach
(
item
=>
{
if
(
item
.
is_enabled
==
=
1
){
if
(
item
.
is_enabled
==
1
){
let
ctl
=
{}
ctl
[
'type'
]
=
data
[
item
.
item_type
];
ctl
[
'label'
]
=
item
.
name
;
ctl
[
'prop'
]
=
item
.
code
;
let
rules
=
[];
//单选框 多选框 下拉选项 添加options属性 结构为 a,b,c
if
([
'singleBtn'
,
'multipleBtn'
,
'downOptions'
].
includes
(
item
.
item_type
)
&&
item
.
config_params
){
ctl
[
'options'
]
=
item
.
config_params
.
options
rules
=
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'change'
}];
}
else
{
rules
=
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
}];
}
//校验
let
rules
=
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
}];
//单行文本 多行文本 增加校验项 有最小和最大值
if
([
'singleText'
,
'multipleText'
].
includes
(
item
.
item_type
)
&&
item
.
config_params
){
let
rule
=
{
"validator"
:
"validatex"
,
"trigger"
:
"blur"
,
"minchars"
:
item
.
config_params
.
input_length
[
0
],
"maxchars"
:
item
.
config_params
.
input_length
[
1
]}
...
...
@@ -194,7 +196,7 @@ class ForminfoService extends ServiceBase {
ctl
[
'archName'
]
=
'regionJSON'
;
ctl
[
'rootName'
]
=
'全国区域'
;
}
if
(
item
.
is_required
==
=
1
){
if
(
item
.
is_required
==
1
){
ctl
[
'rules'
]
=
rules
;
}
ctls
.
push
(
ctl
);
...
...
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
View file @
d2cdb5a3
...
...
@@ -14,7 +14,7 @@ class FormitemService extends ServiceBase {
}
var
list
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[[
"code"
,
"key"
],[
"name"
,
"title"
]],
where
:{
form_id
:
pobj
.
form_id
},
where
:{
form_id
:
pobj
.
form_id
,
is_enabled
:
1
},
raw
:
true
,
order
:[[
"sequence"
,
"asc"
]]
});
...
...
gsb-marketplat/app/base/service/impl/configmag/formsubmitrecordSve.js
View file @
d2cdb5a3
...
...
@@ -37,10 +37,10 @@ class FormsubmitrecordService extends ServiceBase {
if
(
!
linkInfo
.
template_id
){
return
system
.
getResultFail
(
-
301
,
"链接模板信息错误"
)
}
var
templateinfo
=
await
this
.
templateinfoDao
.
model
.
findOne
{
var
templateinfo
=
await
this
.
templateinfoDao
.
model
.
findOne
(
{
where
:{
id
:
linkInfo
.
template_id
},
raw
:
true
,
attributes
:[
"id"
,
"business_code"
]
};
}
)
;
if
(
!
templateinfo
||
!
templateinfo
.
id
){
return
system
.
getResultFail
(
-
500
,
"未知模板信息"
);
}
...
...
@@ -53,7 +53,7 @@ class FormsubmitrecordService extends ServiceBase {
}
//获取表单项
var
formitems
=
await
this
.
formitemDao
.
model
.
findAll
({
where
:{
form_id
:
ab
.
form_id
},
raw
:
true
where
:{
form_id
:
ab
.
form_id
},
raw
:
true
,
order
:[[
"sequence"
,
"asc"
]]
});
//校验封装参数
var
res
=
await
this
.
checkAndPackageFormItems
(
formitems
,
ab
);
...
...
@@ -83,7 +83,7 @@ class FormsubmitrecordService extends ServiceBase {
if
(
item
&&
item
.
code
&&
item
.
is_enabled
){
//显示状态的表单项
var
value
=
ab
[
item
.
code
];
if
(
item
.
is_required
===
1
){
//必填
if
(
!
ab
[
item
.
code
]){
if
(
!
ab
[
item
.
code
]
||
ab
[
item
.
code
].
length
<
1
){
return
system
.
getResultFail
(
-
100
,
item
.
name
+
"参数不能为空"
);
}
}
...
...
gsb-marketplat/app/front/entry/public/apidoc/customer/template.md
View file @
d2cdb5a3
...
...
@@ -10,6 +10,7 @@
1.
[
获取表单列表
](
#getFormList
)
1.
[
获取文件上传配置信息
](
#getOssConfig
)
1.
[
根据链接参数获取模板链接信息
](
#getTemplateAndLinkInfo
)
1.
[
提交表单记录
](
#submitFormRecord
)
## **<a name="createTemplate"> 创建模板</a>**
[
返回到目录
](
#menu
)
...
...
@@ -513,6 +514,7 @@
}
```
## **<a name="getTemplateAndLinkInfo"> 根据链接参数获取模板链接信息</a>**
[
返回到目录
](
#menu
)
##### URL
...
...
@@ -595,3 +597,36 @@
}
```
## **<a name="submitFormRecord"> 提交表单记录</a>**
[
返回到目录
](
#menu
)
##### URL
[
/api/action/template/springBoard
]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:submitFormRecord
```
javascript
{
"actionType"
:
"submitFormRecord"
,
"actionBody"
:
{
"link_code"
:
"TL202008141607VdD4le"
,
"form_id"
:
79
,
"contact_mobile"
:
"13075556693"
,
"contact_name"
:
"1234"
,
"IT202008171022jen9Ar"
:
"test"
,
"IT202008171023jxT06N"
:
"10"
}
}
```
#### 返回结果
```
javascript
{
"status"
:
0
,
"msg"
:
"success"
,
"requestId"
:
"77d3b071053c44a9b5322bb01b0a27aa"
}
```
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