dlh_test_server/app/admin/logic/shop/LocalGoodsOrderLogic.php
2024-09-24 15:11:00 +08:00

52 lines
1.8 KiB
PHP

<?php
namespace app\admin\logic\shop;
use app\common\basics\Logic;
use app\common\model\localstore\LocalPay;
use think\facade\Config;
use think\facade\Db;
class LocalGoodsOrderLogic extends Logic
{
public static function lists($get)
{
$where = [];
if (!empty($get['order_no']) and $get['order_no'])
$where[] = ['lp.order_no', 'like', '%' . $get['order_no'] . '%'];
if (!empty($get['store_nickname']) and $get['store_nickname'])
$where[] = ['s.store_nickname', 'like', '%' . $get['store_nickname'] . '%'];
if (!empty($get['title']) and $get['title'])
$where[] = ['s.v', 'like', '%' . $get['title'] . '%'];
try {
$lists = Db::name('local_pay')->alias('lp')
// ->join('local_goods_order o', 'o.lsg_order_id = lp.lsg_order_id', 'left')
->join('local_store_goods g', 'g.id = lp.goods_id', 'left')
->join('user u', 'lp.user_id = u.id', 'left')
->join('local_store s', 'lp.local_id = s.lstore_id')
->field([
'lp.id', 'lp.order_no', 'lp.transaction_id', 'lp.order_source', 'lp.pay_way',
'lp.pay_status', 'lp.pay_time', 'lp.goods_num', 'lp.order_amount',
'u.nickname','u.real_name','g.title','s.store_nickname'
])
->where($where)
->where('lp.lsg_order_id', '>', '0')
->order('lp.id desc')
->paginate([
'page' => $get['page'],
'list_rows' => $get['limit'],
'var_page' => 'page'
])
->toArray();
return ['count'=>$lists['total'], 'lists'=>$lists['data']];
} catch (Exception $e) {
return ['error' => $e->getMessage()];
}
}
}