2018-06-15 23:03:24 +08:00
|
|
|
import Report from "admin/models/report";
|
2013-06-04 04:12:24 +08:00
|
|
|
|
2015-11-21 09:27:06 +08:00
|
|
|
export default Discourse.Route.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
queryParams: {
|
|
|
|
mode: {},
|
|
|
|
start_date: {},
|
|
|
|
end_date: {},
|
|
|
|
category_id: {},
|
|
|
|
group_id: {}
|
|
|
|
},
|
2016-04-14 13:46:01 +08:00
|
|
|
|
2017-07-06 04:47:01 +08:00
|
|
|
model(params) {
|
2018-06-15 23:03:24 +08:00
|
|
|
return Report.find(
|
|
|
|
params.type,
|
|
|
|
params["start_date"],
|
|
|
|
params["end_date"],
|
|
|
|
params["category_id"],
|
|
|
|
params["group_id"]
|
|
|
|
);
|
2014-11-06 03:46:27 +08:00
|
|
|
},
|
|
|
|
|
2018-06-18 18:31:56 +08:00
|
|
|
setupController(controller, model) {
|
2014-11-06 03:46:27 +08:00
|
|
|
controller.setProperties({
|
|
|
|
model: model,
|
2018-06-15 23:03:24 +08:00
|
|
|
categoryId: model.get("category_id") || "all",
|
|
|
|
groupId: model.get("group_id"),
|
|
|
|
startDate: moment(model.get("start_date"))
|
|
|
|
.utc()
|
|
|
|
.format("YYYY-MM-DD"),
|
|
|
|
endDate: moment(model.get("end_date"))
|
|
|
|
.utc()
|
|
|
|
.format("YYYY-MM-DD")
|
2014-11-06 03:46:27 +08:00
|
|
|
});
|
2013-02-28 11:39:42 +08:00
|
|
|
}
|
2014-06-10 23:54:38 +08:00
|
|
|
});
|