validate()) { return $this->errorResponse; } $data = OrderDetail::find()->alias('od')->leftJoin(['g' => Goods::tableName()], 'od.goods_id=g.id')->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where([ 'o.is_delete' => 0, 'o.user_id' => $this->user_id, 'o.store_id' => $this->store_id, 'od.id' => $this->order_detail_id, ])->select('od.id AS order_detail_id,g.id AS goods_id,g.name,od.attr,od.num,od.total_price,o.pay_price')->asArray()->one(); if (!$data) { return [ 'code' => 1, 'msg' => '订单不存在', ]; } $data['attr'] = json_decode($data['attr']); $data['goods_pic'] = Goods::getGoodsPicStatic($data['goods_id']); $data['max_refund_price'] = min($data['total_price'], $data['pay_price']); $data['template_id'] = NoticeAction::getSendTamplateId(['order_refund']); return [ 'code' => 0, 'msg' => 'success', 'data' => $data, ]; } }