| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace app\common\model;
- use think\Collection;
- use think\Model;
- abstract class BaseModel extends Model
- {
- protected $autoWriteTimestamp = true;
- protected $updateTime = 'update_time';
- protected $createTime = 'create_time';
- public function __call($method, $args)
- {
- return parent::__call($method, $args); // TODO: Change the autogenerated stub
- }
- abstract protected function genSchema(array $schema);
- public function getCreateTimeAttr($v) {
- if(!$v)return $v;
- return date("Y-m-d H:i:s", $v);
- }
- public function getUpdateTimeAttr($v) {
- if(!$v)return $v;
- return date("Y-m-d H:i:s", $v);
- }
- public function deleteByIds(array $ids) {
- return $this->whereIn('id',$ids)->update(['is_delete' => 1]);
- }
- public function findById($id) {
- return $this->find([
- ['id',$id],
- ['is_delete', 0],
- ]);
- }
- }
|