CommonModel::$del_normal, 'company_id' => self::$company_id, 'card_id' => self::$card_id, ]); $count = $db->count('id'); $list = $db ->field('id,original_price,activity_price,title,activity_status') ->page($data['page'], $data['size']) ->order(['id' => 'desc']) ->select() ->toArray(); return json_show(CommonModel::$success, '获取服务列表成功', ['count' => $count, 'list' => $list]); } //详情 public static function read(int $id = 0): Json { $info = ServiceModel::field('id,original_price,activity_price,title,content,starttime,endtime,expiretime,activity_status') ->where(['id' => $id, 'is_del' => CommonModel::$del_normal]) ->findOrEmpty() ->toArray(); return $info ? json_show(CommonModel::$success, '获取服务详情成功', $info) : json_show(CommonModel::$error_param, '服务为空'); } //订单列表 public static function list(array $data = []): Json { $db = OrderModel::alias('a') ->leftJoin('good b', 'b.id=a.good_id AND b.is_del=' . CommonModel::$del_normal) ->where(['a.is_del'=>CommonModel::$del_normal, 'a.uid' => self::$aid]); if ($data['status'] != '') $db->where('a.status', $data['status']); $count = $db->count('a.id'); $list = $db ->field('a.id,a.orderCode,b.good_name,a.num,a.status,a.addtime,a.type,a.price,a.total_price') ->page($data['page'], $data['size']) ->order('a.id', 'desc') ->select() ->toArray(); return json_show(CommonModel::$success, '获取订单列表成功', ['count' => $count, 'list' => $list]); } //订单详情 public static function info(int $id = 0): Json { $rs = OrderModel::alias('a') ->field('a.id,a.orderCode,a.status,a.addtime,a.type,b.good_name,a.num,c.contactor,c.mobile,c.addr,c.addr_code,a.price,a.total_price,a.post_name,a.post_code,a.remark,"支付流水号" p') ->leftJoin('good b', 'b.id=a.good_id AND b.is_del=' . CommonModel::$del_normal) ->leftJoin('addr c', 'c.id=a.addr_id AND c.is_del=' . CommonModel::$del_normal) ->leftJoin('pay_info d', 'd.id=a.pay_info_id') ->where(['a.is_del' => CommonModel::$del_normal, 'a.id' => $id, 'a.uid' => self::$aid]) ->withAttr('addr', function ($val, $da) { return $da['addr_code'] ? get_addr_name($da['addr_code']) . $val : $val; }) ->findOrEmpty() ->toArray(); return $rs ? json_show(CommonModel::$success, '获取订单详情成功', $rs) : json_show(CommonModel::$error_param, '该订单不存在'); } }