Files
chazhi_admin_broker/app/adminapi/lists/OrderTeamasterLists.php
2026-03-11 18:24:59 +08:00

140 lines
5.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\order\OrderTeamaster;
use app\common\lists\ListsSearchInterface;
use app\common\service\FileService;
/**
* OrderTeamaster列表
* Class OrderTeamasterLists
* @package app\adminapi\lists
*/
class OrderTeamasterLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2026/01/04 20:05
*/
public function setSearch(): array
{
return [
'=' => ['a.order_sn', 'b.nickname', 'c.mobile', 'a.server_type', 'a.is_teacup', 'a.pay_way', 'a.order_status', 'a.pay_status'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2026/01/04 20:05
*/
public function lists(): array
{
$day_time = "";
if(isset($this->params['start'])){
if($this->params['start']!=""&&$this->params['start']!=null&&$this->params['end']!=""&&$this->params['end']!=null){
$start = strtotime($this->params['start']);
$end = strtotime($this->params['end']);
$day_time = "a.day_time between '".$start."' and '".$end."'";
}
}
$lists =OrderTeamaster::alias("a")
->join("teamaster_user b", "b.id = a.team_user_id", "left")
->join("user c", "c.id = a.user_id", "left")
->where($this->searchWhere)
->where($day_time)
->field(['a.id', 'a.order_sn', 'a.transaction_id', 'a.user_id',
'a.team_user_id', 'a.day_time', 'a.start_time', 'a.end_time',
'a.server_type', 'a.address', 'a.is_teacup', 'a.teacup_price',
'a.server_price', 'a.mileage_price', 'a.server_all_price', 'a.mileage_server_price',
'a.coupon_price', 'a.tea_price', 'a.order_amount', 'a.team_income_price', 'a.renew_hour',
'a.renew_price', 'a.renew_tea_price', 'a.pay_way', 'a.order_status', 'a.pay_status', 'a.pay_time',
'a.refund_time', 'a.refund_price', 'a.take_order_time', 'a.travel_time', 'a.arrival_time', 'a.is_img',
'a.img_time', 'a.img', 'b.nickname','b.mobile','c.mobile as user_mobile','c.nickname as user_nickname'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
if($lists){
foreach ($lists as &$item){
$item['day_time'] = date('Y-m-d H:i',$item['day_time']);
$item['start_time'] = date('Y-m-d H:i',$item['start_time']);
$item['end_time'] = date('Y-m-d H:i',$item['end_time']);
if($item['pay_time'] == null){
$item['pay_time'] = "";
}else{
$item['pay_time'] = date('Y-m-d H:i',$item['pay_time']);
}
if($item['refund_time'] == null){
$item['refund_time'] = "";
}else{
$item['refund_time'] = date('Y-m-d H:i',$item['refund_time']);
}
if($item['take_order_time'] == null){
$item['take_order_time'] = "";
}else{
$item['take_order_time'] = date('Y-m-d H:i',$item['take_order_time']);
}
if($item['travel_time'] == null){
$item['travel_time'] = "";
}else{
$item['travel_time'] = date('Y-m-d H:i',$item['travel_time']);
}
if($item['arrival_time'] == null){
$item['arrival_time'] = "";
}else{
$item['arrival_time'] = date('Y-m-d H:i',$item['arrival_time']);
}
if($item['img_time'] == null){
$item['img_time'] = "";
}else{
$item['img_time'] = date('Y-m-d H:i',$item['img_time']);
}
// $item['img'] = !empty($item['img']) ? FileService::getFileUrl($item['img']) : '';
$item['img'] = !empty($item['img']) ? FileService::getImgUrl($item['img']) : '';
}
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2026/01/04 20:05
*/
public function count(): int
{
return OrderTeamaster::alias("a")
->join("teamaster_user b", "b.id = a.team_user_id", "left")
->join("user c", "c.id = a.user_id", "left")
->where($this->searchWhere)->count();
}
}