Related fields:
is_delete: false deletion, whether it has been deleted
create_time: creation time
update_time: last update time
tp version 3.2
I hope to process the data through tp , perform the following operations:
When adding new data
Save is_delete=0
create_time=Creation time
update_time=creation time
When modifying [or deleting] data
is_delete=1 (1 means delete)
create_time=Creation time
update_time=current time
Each table operation must implement such a function. It would be unscientific if each file is hard-coded. Should there be some public method? How to achieve this?
Related fields:
is_delete: false deletion, whether it has been deleted
create_time: creation time
update_time: last update time
tp version 3.2
I hope to process the data through tp , perform the following operations:
When adding new data
Save is_delete=0
create_time=Creation time
update_time=creation time
When modifying [or deleting] data
is_delete=1 (1 means delete)
create_time=Creation time
update_time=current time
Each table operation must implement such a function. It would be unscientific if each file is hard-coded. Should there be some public method? How to achieve this?
You need to use autocomplete in your model
http://document.thinkphp.cn/manual_3_2.html#auto_operate
Directly set the type of update_time to timestamp and update it based on the current timestamp