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.
99 lines
3.0 KiB
99 lines
3.0 KiB
<?php
|
|
namespace app\admin\logic\user;
|
|
|
|
use app\common\basics\Logic;
|
|
use app\common\enum\PayEnum;
|
|
use app\common\model\Client_;
|
|
use app\common\model\order\OrderUser;
|
|
use app\common\model\user\UserShip;
|
|
use app\common\model\user\UserTag;
|
|
use app\common\model\user\User;
|
|
|
|
class ShipLogLogic extends Logic
|
|
{
|
|
public static function lists($get)
|
|
{
|
|
|
|
// 订单来源
|
|
$order_source = Client_::getClient(true);
|
|
// 支付方式
|
|
$pay_way = PayEnum::getPayWay(true);
|
|
|
|
$where = [];
|
|
$where[] = ['a.del','=',0];
|
|
$where[] = ['a.order_status','=',3];
|
|
|
|
|
|
//订单类型
|
|
if (isset($get['keyword']) && $get['keyword'] != '') {
|
|
$where[] = ['a.order_sn|b.nickname|b.mobile', 'like', "%".$get['keyword']."%"];
|
|
}
|
|
|
|
//订单类型
|
|
if (isset($get['type']) && $get['type'] != '') {
|
|
$where[] = ['a.type', '=', $get['type']];
|
|
}
|
|
|
|
//付款方式
|
|
if (isset($get['pay_way']) && $get['pay_way'] != '') {
|
|
$where[] = ['a.pay_way', '=', $get['pay_way']];
|
|
}
|
|
|
|
//订单来源
|
|
if (isset($get['order_source']) && $get['order_source'] != '') {
|
|
$where[] = ['a.order_source', '=', $get['order_source']];
|
|
}
|
|
|
|
//下单时间
|
|
if (isset($get['start_time']) && $get['start_time'] != '') {
|
|
$where[] = ['a.create_time', '>=', strtotime($get['start_time'])];
|
|
}
|
|
|
|
if (isset($get['end_time']) && $get['end_time'] != '') {
|
|
$where[] = ['a.create_time', '<=', strtotime($get['end_time'])];
|
|
}
|
|
$orderuser = new OrderUser();
|
|
|
|
|
|
$lists = $orderuser
|
|
->where($where)
|
|
->field("a.*,b.nickname,b.avatar,b.mobile,c.title as ship_name")
|
|
->alias('a')
|
|
->join('user b','a.user_id=b.id','LEFT')
|
|
->join('user_ship c','a.org_id=c.id','LEFT')
|
|
->page($get['page'], $get['limit'])->select()->toArray();
|
|
|
|
|
|
$count = $orderuser ->alias('a')->alias('a')
|
|
->join('user b','a.user_id=b.id','LEFT')->where($where)->count();
|
|
foreach ($lists as &$item){
|
|
$item['pay_time_str'] = date("Y-m-d H:i:s",$item['pay_time']);
|
|
$item['type_name'] = $item['type']==0?'免费':'付费';
|
|
$item['order_source_name'] = $order_source[$item['order_source']];
|
|
$item['pay_way_name'] = $item['pay_way']==0?'无':$pay_way[$item['pay_way']];
|
|
$item['overdue_time_str'] = $item['overdue_time'] == 0?'永久': date("Y-m-d",$item['overdue_time']);
|
|
|
|
}
|
|
return [
|
|
'lists' => $lists,
|
|
'count' => $count
|
|
];
|
|
}
|
|
|
|
public static function del($id)
|
|
{
|
|
try{
|
|
$data = [
|
|
'id' => $id,
|
|
'update_time' => time(),
|
|
'del' => 1
|
|
];
|
|
UserShip::update($data);
|
|
return true;
|
|
}catch(\Exception $e){
|
|
self::$error = $e->getMessage();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|