Commit ef1278edd9d4a9b2c2e972e8e30371c7952c96b3
1 parent
bbe623b4
delete create_time, update_time fields
Showing
2 changed files
with
20 additions
and
9 deletions
back-end/h5-api/api/work/models/Work.settings.json
| ... | ... | @@ -7,7 +7,10 @@ |
| 7 | 7 | }, |
| 8 | 8 | "options": { |
| 9 | 9 | "increments": true, |
| 10 | - "timestamps": true, | |
| 10 | + "timestamps": [ | |
| 11 | + "created_at", | |
| 12 | + "updated_at" | |
| 13 | + ], | |
| 11 | 14 | "comment": "" |
| 12 | 15 | }, |
| 13 | 16 | "attributes": { |
| ... | ... | @@ -23,12 +26,6 @@ |
| 23 | 26 | "pages": { |
| 24 | 27 | "type": "json" |
| 25 | 28 | }, |
| 26 | - "create_time": { | |
| 27 | - "type": "date" | |
| 28 | - }, | |
| 29 | - "update_time": { | |
| 30 | - "type": "date" | |
| 31 | - }, | |
| 32 | 29 | "is_publish": { |
| 33 | 30 | "type": "boolean" |
| 34 | 31 | }, | ... | ... |
front-end/h5/src/components/core/models/work.js
| 1 | +/* | |
| 2 | + * @Author: ly525 | |
| 3 | + * @Date: 2019-11-24 18:51:58 | |
| 4 | + * @LastEditors: ly525 | |
| 5 | + * @LastEditTime: 2019-12-15 16:24:33 | |
| 6 | + * @FilePath: /luban-h5/front-end/h5/src/components/core/models/work.js | |
| 7 | + * @Github: https://github.com/ly525/luban-h5 | |
| 8 | + * @Description: work model | |
| 9 | + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved | |
| 10 | + */ | |
| 1 | 11 | import Page from './page.js' |
| 2 | 12 | |
| 3 | 13 | class Work { |
| ... | ... | @@ -12,8 +22,12 @@ class Work { |
| 12 | 22 | this.cover_image_url = '' |
| 13 | 23 | // TODO 后期可以添加一个类似项目组的概念,每个项目组下可以有多个作品 |
| 14 | 24 | // this.project_id = 1 |
| 15 | - this.create_time = new Date() | |
| 16 | - this.update_time = new Date() | |
| 25 | + | |
| 26 | + // #!zh: strapi.js 会自动创建与维护 created_at、updated_at | |
| 27 | + // #!en: strapi.js will auto create and maintain the fields: created_at、updated_at | |
| 28 | + // this.created_at = new Date() | |
| 29 | + // this.updated_at = new Date() | |
| 30 | + | |
| 17 | 31 | this.is_publish = false |
| 18 | 32 | this.is_template = false |
| 19 | 33 | } | ... | ... |