msg = $msg; $pattern= '/^[A-Z0-9]{9,12}(?=\s)|(?<=Ksh)[\d,]+\.[\d]{2}|(?<=from\s)[a-zA-z]*\s{0,2}[a-zA-z]*|(?<=\s)\d+(?=\s)|\d{1,2}\/\d{1,2}\/\d{1,4}\sat\s\d{1,2}:\d{2}\s[AMP]{2}/'; $match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); if ($match_num != false && $match_num > 0 && $matches[0]) { $this->orderInfo = [ 'pay_money' => str_replace(',', '', $matches[0][1]), 'from_card' => $matches[0][3], 'from_name' => $matches[0][2], 'order_number' => $matches[0][0], 'sms_date' => $matches[0][4], ]; } } //获取订单信息 public function orderInfo($requestArr) { $showInfo = $this->showInfo(); $ewm_account = $showInfo['from_card']; $order_money = $showInfo['pay_money']; $from_name = $showInfo['from_name']; $order_money = number_format($order_money, 2, '.', ''); //查找未支付的订单 $t = date('Y-m-d H:i:s'); return Order::where('order_at', '<', $t) ->where('order_money', $order_money) ->where('ewm_account', $ewm_account) // ->whereIn('status', [0, 2]) ->orderBy('id', 'desc')->first(); } }