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.
63 lines
2.6 KiB
63 lines
2.6 KiB
<?php
|
|
|
|
namespace app\admin\model;
|
|
|
|
use think\Model;
|
|
use traits\model\SoftDelete;
|
|
|
|
class Order extends Model
|
|
{
|
|
|
|
use SoftDelete;
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'order';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = 'deletetime';
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
|
|
];
|
|
|
|
// 查询当前用户是否已经付过费
|
|
public function getlist($where, $order, $offset, $limit,$sort){
|
|
$order = empty($order)?['o.createtime'=>"desc"]:$order;
|
|
$list = $this->field("o.id,o.user_id,o.createtime,order_no,title,o.money,paytime,content_id,ispay,user_money,system_money,o.status,type,f.user_id as fabu_user_id,f.title")->alias('o')->join('fa_content f','f.id = o.content_id','LEFT')
|
|
->where($where)
|
|
->paginate($limit);
|
|
// ->paginate(['page'=> $offset?? 1,'list_rows' => $limit]);
|
|
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
|
|
return $result;
|
|
}
|
|
public function getlistapi($where, $order, $offset, $limit,$sort){
|
|
$order = empty($order)?['o.createtime'=>"desc"]:$order;
|
|
$list = $this->field("o.id,o.user_id,o.createtime,order_no,title,o.money,paytime,content_id,ispay,user_money,system_money,o.status,type,f.user_id as fabu_user_id,f.title")->alias('o')->join('fa_content f','f.id = o.content_id','LEFT')
|
|
->where($where)
|
|
// ->paginate($limit);
|
|
->paginate(['page'=> $offset?? 1,'list_rows' => $limit]);
|
|
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
|
|
return $result;
|
|
}
|
|
// 查询当前用户是否已经付过费
|
|
public function yungudong($where, $order, $offset, $limit,$sort,$type){
|
|
$order = empty($order)?['o.createtime'=>"desc"]:$order;
|
|
$page = $offset/ $limit+1;
|
|
$list = $this->field("o.id,o.user_id,o.createtime,order_no,title,o.money,paytime,content_id,u.nickname,ispay,user_money,system_money,o.status,type,f.user_id as fabu_user_id,f.title")->alias('o')->join('fa_content f','f.id = o.content_id','LEFT')->join('fa_user u','u.id = o.user_id','LEFT')
|
|
->where($where)
|
|
->where('ispay',1)
|
|
->where('type',$type)
|
|
->paginate($limit);
|
|
// ->paginate(['page'=> $page?? 1,'list_rows' => $limit]);
|
|
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
|
|
return $result;
|
|
}
|
|
}
|
|
|