Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
6368489b
Commit
6368489b
authored
Aug 10, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getBackColumns
parent
b4c1716a
Pipeline
#27243
passed with stage
in 23 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
7 deletions
+74
-7
back.js
app/controller/course/back.js
+9
-0
courseBackColumn.js
app/model/class/courseBackColumn.js
+41
-0
course.js
app/router/course.js
+1
-0
back.js
app/service/course/back.js
+15
-1
user.js
app/service/course/v5/user.js
+8
-6
No files found.
app/controller/course/back.js
View file @
6368489b
...
@@ -113,6 +113,15 @@ class BackController extends Controller {
...
@@ -113,6 +113,15 @@ class BackController extends Controller {
await
service
.
course
.
back
.
exportUsedRedeemCode
(
queryParams
);
await
service
.
course
.
back
.
exportUsedRedeemCode
(
queryParams
);
}
}
// 获取额外字段
async
getBackColumns
()
{
const
{
ctx
,
service
}
=
this
;
const
ret
=
await
service
.
course
.
back
.
getBackColumns
();
ctx
.
success
(
ret
);
}
}
}
module
.
exports
=
BackController
;
module
.
exports
=
BackController
;
app/model/class/courseBackColumn.js
0 → 100644
View file @
6368489b
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseBackColumn
=
app
.
classModel
.
define
(
'course_back_column'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
title
:
STRING
,
column
:
STRING
,
status
:
INTEGER
,
created_time
:
{
type
:
DATE
,
allowNull
:
true
,
get
()
{
const
date
=
this
.
getDataValue
(
'created_time'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
updated_time
:
{
type
:
DATE
,
allowNull
:
true
,
get
()
{
const
date
=
this
.
getDataValue
(
'updated_time'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
},
{
timestamps
:
false
,
tableName
:
'course_back_column'
,
});
return
CourseBackColumn
;
};
app/router/course.js
View file @
6368489b
...
@@ -14,4 +14,5 @@ module.exports = app => {
...
@@ -14,4 +14,5 @@ module.exports = app => {
router
.
get
(
'third'
,
'/export/redeem'
,
auth
,
'course.back.exportRedeemCode'
);
router
.
get
(
'third'
,
'/export/redeem'
,
auth
,
'course.back.exportRedeemCode'
);
router
.
get
(
'third'
,
'/export/redeem/used'
,
auth
,
'course.back.exportUsedRedeemCode'
);
router
.
get
(
'third'
,
'/export/redeem/used'
,
auth
,
'course.back.exportUsedRedeemCode'
);
router
.
get
(
'third'
,
'/redeem/used'
,
auth
,
'course.back.getUsedRedeemCodeList'
);
router
.
get
(
'third'
,
'/redeem/used'
,
auth
,
'course.back.getUsedRedeemCodeList'
);
router
.
get
(
'third'
,
'/column/all'
,
'course.back.getBackColumns'
);
};
};
app/service/course/back.js
View file @
6368489b
...
@@ -88,7 +88,7 @@ class BackService extends Service {
...
@@ -88,7 +88,7 @@ class BackService extends Service {
ctx
.
failed
(
'用户异常'
);
ctx
.
failed
(
'用户异常'
);
}
}
const
filter
=
{
where
:
{
type
:
1
,
status
:
1
,
is_deleted
:
0
},
limit
,
offset
,
attributes
:
[
'id'
,
'order_no'
,
'class_id'
,
'pay'
,
'pay_time'
,
'address'
],
order
:
[[
'pay_time'
,
'desc'
]]
};
const
filter
=
{
where
:
{
type
:
1
,
status
:
1
,
is_deleted
:
0
},
limit
,
offset
,
attributes
:
[
'id'
,
'order_no'
,
'class_id'
,
'pay'
,
'pay_time'
,
'address'
,
'columns'
],
order
:
[[
'pay_time'
,
'desc'
]]
};
let
filterClassIds
=
[];
let
filterClassIds
=
[];
if
(
!
ctx
.
isEmpty
(
input
.
class_name
))
{
if
(
!
ctx
.
isEmpty
(
input
.
class_name
))
{
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
({
where
:
{
name
:
{
$like
:
`%
${
input
.
class_name
}
%`
}
},
attributes
:
[
'id'
]
});
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
({
where
:
{
name
:
{
$like
:
`%
${
input
.
class_name
}
%`
}
},
attributes
:
[
'id'
]
});
...
@@ -139,6 +139,7 @@ class BackService extends Service {
...
@@ -139,6 +139,7 @@ class BackService extends Service {
pay
:
v
.
pay
,
pay
:
v
.
pay
,
pay_time
:
v
.
pay_time
,
pay_time
:
v
.
pay_time
,
address
:
ctx
.
isEmpty
(
v
.
address
)
?
{}
:
JSON
.
parse
(
v
.
address
),
address
:
ctx
.
isEmpty
(
v
.
address
)
?
{}
:
JSON
.
parse
(
v
.
address
),
columns
:
ctx
.
isEmpty
(
v
.
columns
)
?
{}
:
JSON
.
parse
(
v
.
columns
),
});
});
}
}
...
@@ -513,6 +514,19 @@ class BackService extends Service {
...
@@ -513,6 +514,19 @@ class BackService extends Service {
return
true
;
return
true
;
}
}
// 获取额外字段
async
getBackColumns
()
{
const
{
ctx
}
=
this
;
const
columns
=
await
ctx
.
classModel
.
CourseBackColumn
.
findAll
({
where
:
{
status
:
1
},
attributes
:
[
'title'
,
'column'
]
});
const
ret
=
{
list
:
columns
,
};
return
ret
;
}
}
}
module
.
exports
=
BackService
;
module
.
exports
=
BackService
;
app/service/course/v5/user.js
View file @
6368489b
...
@@ -366,7 +366,6 @@ class UserService extends Service {
...
@@ -366,7 +366,6 @@ class UserService extends Service {
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
userUuid
=
ctx
.
userUuid
;
const
userUuid
=
ctx
.
userUuid
;
const
id
=
input
.
id
||
0
;
const
id
=
input
.
id
||
0
;
const
address
=
input
.
address
||
''
;
const
columns
=
ctx
.
isEmpty
(
input
.
columns
)
?
{}
:
JSON
.
parse
(
input
.
columns
);
const
columns
=
ctx
.
isEmpty
(
input
.
columns
)
?
{}
:
JSON
.
parse
(
input
.
columns
);
if
(
ctx
.
isEmpty
(
userUuid
))
{
if
(
ctx
.
isEmpty
(
userUuid
))
{
...
@@ -385,11 +384,14 @@ class UserService extends Service {
...
@@ -385,11 +384,14 @@ class UserService extends Service {
ctx
.
failed
(
'课程不存在'
);
ctx
.
failed
(
'课程不存在'
);
}
}
// // 获取用户地址
// 获取用户地址
// const address = await ctx.classModel.V5.CourseUserAddress.findOne({ where: { user_uuid: ctx.userUuid, is_deleted: 0 }, attributes: [ 'province', 'city', 'area', 'address', 'name', 'phone' ], raw: true });
let
address
=
''
;
// if (ctx.isEmpty(address)) {
if
(
classInfo
.
has_address
===
1
)
{
// ctx.failed('地址不能为空');
address
=
await
ctx
.
classModel
.
V5
.
CourseUserAddress
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'province'
,
'city'
,
'area'
,
'address'
,
'name'
,
'phone'
],
raw
:
true
});
// }
if
(
ctx
.
isEmpty
(
address
))
{
ctx
.
failed
(
'地址不能为空'
);
}
}
const
orderNo
=
'11'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
);
const
orderNo
=
'11'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
);
if
(
ctx
.
isEmpty
(
order
))
{
if
(
ctx
.
isEmpty
(
order
))
{
...
...
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