where([ 'pay_status' => 0, 'order_no' => PaymentTradeOrder::find() ->where(['trade_id' => $id]) ->select('order_no') ->column(), ]) ->select(['store_id', 'pay_money']) ->all(); } /** * 通过收银台订单号查找支付订单 * * @param string $order_no * @return int|null|false */ public static function getPaymentIdByCashierOrderNo(string $order_no) { return static::getPaymentIdByOrderNo($order_no, YunfastPayEnum::CASHIER_ORDER); } /** * 通过商城订单号查找支付订单 * * @param string $order_no * @param string $order_type * @return int|null|false */ public static function getPaymentIdByMallOrderNo(string $order_no, string $order_type = YunfastPayEnum::MALL_ORDER) { return static::getPaymentIdByOrderNo($order_no, $order_type ?: YunfastPayEnum::MALL_ORDER); } /** * 通过订单号查找支付订单 * * @param string $order_no * @return int|null|false */ public static function getPaymentIdByOrderNo(string $order_no, string $order_type) { return static::find() ->where([ 'order_no' => $order_no, 'is_pay' => 1, 'pay_type' => YunfastPayTypeEnum::YUNFAST_PAY_NUM, 'order_type' => $order_type, ]) ->select('trade_id') ->scalar(); } }