dlhmaster/app/api/logic/BillionsLogic.php
2024-07-02 02:48:03 +08:00

45 lines
1.2 KiB
PHP

<?php
namespace app\api\logic;
use app\common\basics\Logic;
use app\common\model\billions\Billions;
class BillionsLogic extends Logic
{
public static function lists($page, $size, $state, $user_id)
{
$where[] = ['b.user_id', '=', $user_id];
if ($state == 1) {
$where[] = ['b.state', '>=', 1];
} else {
$where[] = ['b.state', '=', 0];
}
$list = Billions::alias('b')->where($where)
->join('order o', 'o.id = b.order_id')
->join('goods g', 'g.id = b.goods_id')
->field('b.*, o.order_sn')
->order('billions_id desc')->page($page,$size)->select();
$count = Billions::alias('b')->where($where)
->alias('b')
->join('order o', 'o.id = b.order_id')
->join('goods g', 'g.id = b.goods_id')
->count();
$historyOrder = Billions::where('user_id', $user_id)->count();
$more = is_more($count, $page, $size); //是否有下一页
$data = [
'list' => $list,
'page_no' => $page,
'page_size' => $size,
'count' => $count,
'more' => $more,
'historyOrder' => $historyOrder
];
return $data;
}
}