You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
994 B
36 lines
994 B
5 months ago
|
<?php
|
||
|
|
||
|
namespace app\common\model;
|
||
|
|
||
|
use think\Model;
|
||
|
|
||
|
/**
|
||
|
* 会员余额日志模型
|
||
|
*/
|
||
|
class MoneyLog extends Model
|
||
|
{
|
||
|
|
||
|
// 表名
|
||
|
protected $name = 'user_money_log';
|
||
|
// 开启自动写入时间戳字段
|
||
|
protected $autoWriteTimestamp = 'int';
|
||
|
// 定义时间戳字段名
|
||
|
protected $createTime = 'createtime';
|
||
|
protected $updateTime = '';
|
||
|
// 追加属性
|
||
|
protected $append = [
|
||
|
];
|
||
|
|
||
|
public function getlist($where, $order, $offset, $limit){
|
||
|
$order = empty($order)?['createtime'=>"desc"]:$order;
|
||
|
$list = $this->field('money,memo,createtime')->order($order)
|
||
|
->where($where)
|
||
|
->paginate(['page'=> $offset?? 1,'list_rows' => $limit])->each(function($item,$key){
|
||
|
$item['createtime'] = date("Y-m-d H:i:s",$item['createtime']);
|
||
|
return $item;
|
||
|
});
|
||
|
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
|
||
|
return $result;
|
||
|
}
|
||
|
}
|