|
...
|
...
|
@@ -107,14 +107,10 @@ class Base extends Model |
|
|
|
*/
|
|
|
|
public function read($condition,$files = ['*'])
|
|
|
|
{
|
|
|
|
$info = Common::get_user_cache($this->getTable(),$condition['id']);
|
|
|
|
if(empty($info)){
|
|
|
|
$query = $this->formatQuery($condition);
|
|
|
|
$info = $query->select($files)->first();
|
|
|
|
if (empty($info)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Common::set_user_cache($info,$this->getTable(),$condition['id']);
|
|
|
|
$query = $this->formatQuery($condition);
|
|
|
|
$info = $query->select($files)->first();
|
|
|
|
if (empty($info)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$info = $info->toArray();
|
|
|
|
return $info;
|
|
...
|
...
|
@@ -140,10 +136,6 @@ class Base extends Model |
|
|
|
$query = $this->formatQuery($condition);
|
|
|
|
$data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$rs = $query->update($data);
|
|
|
|
if($rs !== false){
|
|
|
|
//删除缓存
|
|
|
|
Common::del_user_cache($this->getTable(),$condition['id']);
|
|
|
|
}
|
|
|
|
return $rs;
|
|
|
|
}
|
|
|
|
/**
|
|
...
|
...
|
@@ -155,10 +147,6 @@ class Base extends Model |
|
|
|
public function del($condition){
|
|
|
|
$query = $this->formatQuery($condition);
|
|
|
|
$rs = $query->delete();
|
|
|
|
if($rs !== false){
|
|
|
|
//删除缓存
|
|
|
|
Common::del_user_cache($this->getTable(),$condition['id']);
|
|
|
|
}
|
|
|
|
return $rs;
|
|
|
|
}
|
|
|
|
/**
|
...
|
...
|
|