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
ff5c7ef7
Commit
ff5c7ef7
authored
Feb 18, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
3e8f497d
Pipeline
#19401
passed with stage
in 1 minute 5 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
84 deletions
+83
-84
courseOnlineArea.js
app/model/class/v4/courseOnlineArea.js
+82
-83
online.js
app/service/course/v4/online.js
+1
-1
No files found.
app/model/class/v4/courseOnlineArea.js
View file @
ff5c7ef7
'use strict'
;
'use strict'
;
'use strict'
;
const
moment
=
require
(
'moment'
);
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
,
DECIMAL
,
TEXT
,
ENUM
,
FLOAT
}
=
app
.
Sequelize
;
const
{
STRING
,
INTEGER
,
DATE
,
DECIMAL
,
TEXT
,
ENUM
,
FLOAT
}
=
app
.
Sequelize
;
const
CourseOnlineArea
=
app
.
classModel
.
define
(
'courseOnlineA
rea'
,
{
const
CourseOnlineArea
=
app
.
classModel
.
define
(
'course_online_a
rea'
,
{
id
:
{
id
:
{
type
:
INTEGER
,
type
:
INTEGER
,
primaryKey
:
true
,
primaryKey
:
true
,
autoIncrement
:
true
autoIncrement
:
true
,
},
},
institution_id
:
INTEGER
,
institution_id
:
INTEGER
,
name
:
STRING
,
name
:
STRING
,
address
:
STRING
,
address
:
STRING
,
phone
:
STRING
,
phone
:
STRING
,
lat
:
DECIMAL
,
lat
:
DECIMAL
,
lng
:
DECIMAL
,
lng
:
DECIMAL
,
status
:
ENUM
(
'offline'
,
'online'
),
status
:
ENUM
(
'offline'
,
'online'
),
is_deleted
:
INTEGER
,
is_deleted
:
INTEGER
,
created_time
:
{
created_time
:
{
type
:
DATE
,
type
:
DATE
,
allowNull
:
true
,
allowNull
:
true
,
get
()
{
get
()
{
const
date
=
this
.
getDataValue
(
'created_time'
);
const
date
=
this
.
getDataValue
(
'created_time'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
}
},
},
{
},
{
timestamps
:
false
,
timestamps
:
false
,
tableName
:
'courseOnlineA
rea'
,
tableName
:
'course_online_a
rea'
,
});
});
CourseOnlineArea
.
one
=
async
(
data
)
=>
{
CourseOnlineArea
.
one
=
async
data
=>
{
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
return
await
CourseOnlineArea
.
findOne
({
return
await
CourseOnlineArea
.
findOne
({
attributes
:
attributes
,
attributes
,
where
:
where
,
where
,
});
});
}
};
CourseOnlineArea
.
all
=
async
(
data
)
=>
{
CourseOnlineArea
.
all
=
async
data
=>
{
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
const
order
=
data
.
order
?
data
.
order
:
[];
const
order
=
data
.
order
?
data
.
order
:
[];
return
await
CourseOnlineArea
.
findAll
({
return
await
CourseOnlineArea
.
findAll
({
attributes
:
attributes
,
attributes
,
where
:
where
,
where
,
order
,
order
,
});
});
}
};
CourseOnlineArea
.
list
=
async
(
data
=
{})
=>
{
CourseOnlineArea
.
list
=
async
(
data
=
{})
=>
{
const
limit
=
data
.
limit
?
Number
(
data
.
limit
)
:
10
;
const
limit
=
data
.
limit
?
Number
(
data
.
limit
)
:
10
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
order
=
data
.
order
?
data
.
order
:
[];
const
order
=
data
.
order
?
data
.
order
:
[];
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
const
where
=
data
.
where
?
data
.
where
:
{};
const
condition
=
{
const
condition
=
{
offset
:
(
page
-
1
)
*
limit
,
offset
:
(
page
-
1
)
*
limit
,
limit
,
limit
,
where
:
where
,
where
,
order
:
order
,
order
,
attributes
:
attributes
,
attributes
,
};
};
const
{
count
,
rows
}
=
await
CourseOnlineArea
.
findAndCountAll
(
condition
);
const
{
count
,
rows
}
=
await
CourseOnlineArea
.
findAndCountAll
(
condition
);
return
{
page
,
count
,
rows
};
return
{
page
,
count
,
rows
};
}
};
CourseOnlineArea
.
add
=
async
(
data
)
=>
{
CourseOnlineArea
.
add
=
async
data
=>
{
try
{
try
{
//返回promise对象实力 instance
// 返回promise对象实力 instance
const
res
=
await
CourseOnlineArea
.
create
(
data
);
const
res
=
await
CourseOnlineArea
.
create
(
data
);
//从promise 实例中中获得需要的id号,id 必须是自增长,而且必须主键,否则返回null
// 从promise 实例中中获得需要的id号,id 必须是自增长,而且必须主键,否则返回null
return
res
.
id
;
return
res
.
id
;
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
(
error
);
throw
(
error
);
}
}
}
};
CourseOnlineArea
.
edit
=
async
(
data
)
=>
{
CourseOnlineArea
.
edit
=
async
data
=>
{
const
where
=
data
.
where
;
const
where
=
data
.
where
;
const
params
=
data
.
params
;
const
params
=
data
.
params
;
try
{
try
{
const
res
=
await
CourseOnlineArea
.
update
(
params
,
{
where
:
where
})
const
res
=
await
CourseOnlineArea
.
update
(
params
,
{
where
});
return
res
;
return
res
;
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
(
error
);
throw
(
error
);
}
}
}
};
return
CourseOnlineArea
;
return
CourseOnlineArea
;
};
};
\ No newline at end of file
app/service/course/v4/online.js
View file @
ff5c7ef7
...
@@ -56,7 +56,7 @@ class OnlineService extends Service {
...
@@ -56,7 +56,7 @@ class OnlineService extends Service {
const
cats
=
await
ctx
.
classModel
.
V4
.
CourseOnlineCat
.
findAll
({
where
:
{
id
:
{
$in
:
catIds
}
},
attributes
:
[
'id'
,
'name'
]
});
const
cats
=
await
ctx
.
classModel
.
V4
.
CourseOnlineCat
.
findAll
({
where
:
{
id
:
{
$in
:
catIds
}
},
attributes
:
[
'id'
,
'name'
]
});
// 收藏信息
// 收藏信息
const
userCollect
=
await
ctx
.
classModel
.
V4
.
CourseUserCollection
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
3
,
type_id
:
id
,
status
:
'online'
,
is_deleted
:
0
}
});
const
userCollect
=
await
ctx
.
classModel
.
V4
.
CourseUserCollection
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
type
:
3
,
type_id
:
id
,
is_deleted
:
0
}
});
const
ret
=
{
const
ret
=
{
id
,
id
,
...
...
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