|
...
|
...
|
@@ -24,7 +24,7 @@ class Base extends Model |
|
|
|
*/
|
|
|
|
public function lists($map, $p, $row, $order = 'id', $fields = ['*']){
|
|
|
|
//TODO::where(['id'=>'','name'=>''])
|
|
|
|
$lists = $this->select($fields)->wheres($map)->orderBy($order)->paginate($row, ['*'], 'page', $p);
|
|
|
|
$lists = $this->select($fields)->where($map)->orderBy($order)->paginate($row, ['*'], 'page', $p);
|
|
|
|
if (empty($lists)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
...
|
...
|
@@ -43,7 +43,7 @@ class Base extends Model |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function list($map,$order = 'id',$fields = ['*']){
|
|
|
|
$lists = $this->select($fields)->wheres($map)->orderBy($order)->get();
|
|
|
|
$lists = $this->select($fields)->where($map)->orderBy($order)->get();
|
|
|
|
if (empty($lists)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
...
|
...
|
@@ -59,7 +59,8 @@ class Base extends Model |
|
|
|
*/
|
|
|
|
public function read($condition,$files = ['*'])
|
|
|
|
{
|
|
|
|
$info = $this->select($files)->wheres($condition)->first();
|
|
|
|
$query = formatQuery($condition);
|
|
|
|
$info = $query->select($files)->where($condition)->first();
|
|
|
|
if (empty($info)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
...
|
...
|
@@ -88,7 +89,7 @@ class Base extends Model |
|
|
|
*/
|
|
|
|
public function edit($data,$condition){
|
|
|
|
$data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
return $this->wheres($condition)->update($data);
|
|
|
|
return $this->where($condition)->update($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -98,11 +99,11 @@ class Base extends Model |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function del($condition){
|
|
|
|
return $this->wheres($condition)->delete();
|
|
|
|
return $this->where($condition)->delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function wheres($map,$val = ''){
|
|
|
|
public function formatQuery($map,$val = ''){
|
|
|
|
$query = $this;
|
|
|
|
$query->where(function ($query) use ($map,$val){
|
|
|
|
//拼接数据
|
...
|
...
|
|