diff --git a/FlyCube/MpApi/Controller/AdminController.class.php b/FlyCube/MpApi/Controller/AdminController.class.php index c99e33c..917cf68 100644 --- a/FlyCube/MpApi/Controller/AdminController.class.php +++ b/FlyCube/MpApi/Controller/AdminController.class.php @@ -804,16 +804,18 @@ class AdminController extends PublicController } } /** - * @description: 获取订单列表(只拿已付款 和已退款但是发货状态为 已发货 订单列表) 链表查询还有关联的站点列表的 bind_route runing字段一并取出 + * @description: 获取订单列表(只拿已付款和已退款但发货状态为已发货的订单),并联查 receive_site 表 bind_route、runing 字段 */ public function getPaidOrderList() { if ($this->tokenShop_id != C('powerId')) { - $where['o.shop_id'] = $this->tokenShop_id; // 非总管理员只返回自己的账户信息 + $where['o.shop_id'] = $this->tokenShop_id; // 非总管理员只返回自己的订单 } $orderDb = D('order'); - // 构建查询条件 + $prefix = C('DB_PREFIX'); // 获取表前缀 + + // 构建复合查询条件 $where['_complex'] = array( '_logic' => 'or', array('o.main_status' => '已付款'), @@ -822,11 +824,12 @@ class AdminController extends PublicController 'o.shipment_status' => '已发货' ) ); + + // 执行查询 $paidOrderList = $orderDb - ->alias('o') // 别名为 o - ->join('lr_receive_site rs ON o.receive_site_id = rs.id') // 关联 lr_receive_site 表 - ->field('o.id,o. - shop_id,o.order_sn,o.food_sn,o.total_weight,o.total_num,o.total_price,transport_price,pack_price,o.apply_price,o.receiver,o.tel,o.by_plane_id,o.receive_site_id,o.receive_site_name,o.remark,o.product_snapshot,o.main_status,o.shipment_status,o.refund_status,o.refund_remark,o.order_time,o.paid_time,o.refundapply_time,o.refundagree_time,o.received_time,o.shipped_time, rs.bind_route, rs.runing') // 选择字段,包括 bind_route 和 runing + ->alias('o') + ->join("{$prefix}receive_site rs ON o.receive_site_id = rs.id") // 动态表前缀 + ->field("o.id,o.shop_id,o.order_sn,o.food_sn,o.total_weight,o.total_num,o.total_price,o.transport_price,o.pack_price,o.apply_price,o.receiver,o.tel,o.by_plane_id,o.receive_site_id,o.receive_site_name,o.remark,o.product_snapshot,o.main_status,o.shipment_status,o.refund_status,o.refund_remark,o.order_time,o.paid_time,o.refundapply_time,o.refundagree_time,o.received_time,o.shipped_time, rs.bind_route, rs.runing") ->where($where) ->select(); @@ -836,6 +839,7 @@ class AdminController extends PublicController echo json_encode(array('status' => 0, 'msg' => '暂无订单数据')); } } + /** * @description: 获取订单列表 */ diff --git a/FlyCube/MpApi/Controller/PlaneController.class.php b/FlyCube/MpApi/Controller/PlaneController.class.php index 036143d..3c2d253 100644 --- a/FlyCube/MpApi/Controller/PlaneController.class.php +++ b/FlyCube/MpApi/Controller/PlaneController.class.php @@ -88,7 +88,7 @@ class PlaneController extends PublicController } } /** - * @description: 删除指定飞机 + * @description: 删除指定机型 */ public function deletePlaneClass() { @@ -115,23 +115,37 @@ class PlaneController extends PublicController } } - /** - * @description: 获取 飞机列表 - */ public function getAirList() { - if ($this->tokenShop_id != C('powerId')) { //非总管理员 + $airDb = D('airplane'); + + if ($this->tokenShop_id != C('powerId')) { // 非总管理员 $where['shop_id'] = $this->tokenShop_id; } - $where['del'] = "0"; - $airListDb = D('airplane_register'); - $field = array('id', 'name', 'macadd', 'describe', 'shop_id', 'apply_time', 'onoff', 'del'); - if ($airList = $airListDb->where($where)->field($field)->select()) { - echo json_encode(array('status' => 1, 'msg' => '访问成功', "airList" => $airList)); + $where['del'] = '0'; + + $field = 'a.id, a.name, a.class_id, a.shop_id, a.status, c.class_name, c.wheelbase, c.category, c.weight_max'; + $prefix = C('DB_PREFIX'); + + $airList = $airDb + ->alias('a') + ->join("LEFT JOIN {$prefix}airplane_class c ON a.class_id = c.id") + ->where($where) + ->field($field) + ->order('a.id desc') + ->select(); + + if ($airList) { + echo json_encode(array( + 'status' => 1, + 'msg' => '访问成功', + 'airList' => $airList + )); } else { echo json_encode(array('status' => 0, 'msg' => '暂无飞机数据')); } } + /** * @description: 创建新飞机 */