return_code != 'SUCCESS') { Yii::warning('return_code error:' . $postObj->return_code); util::end(); } $orderId = $postObj->out_trade_no; Yii::info('recharge order id:' . $orderId); $total_fee = $postObj->total_fee; $totalFee = $total_fee / 100; $attach = $postObj->attach; parse_str($attach);//接收流水类型、代金劵 $couponId = isset($couponId) ? $couponId : 0; $capitalType = isset($capitalType) ? $capitalType : null;//流水类型 if (isset($capitalType) == false) { Yii::warning('capitalType empty,orderId:' . $orderId); util::end(); } $recharge = xhRechargeService::getById($orderId); if (empty($recharge)) { Yii::warning('recharge order empty'); util::end(); } $return = xhRechargeService::miniRecharge($orderId, $totalFee); if ($return['status'] == false) { Yii::warning($return['msg']); util::end(); } echo ''; } public function actionMiniPayCallback() { $postStr = file_get_contents('php://input');//接收微信服务器返回的xml消息体 if (empty($postStr)) { util::end(); } $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); if ($postObj->return_code != 'SUCCESS') { Yii::warning('return_code error:' . $postObj->return_code); util::end(); } $orderId = $postObj->out_trade_no; $total_fee = $postObj->total_fee; $totalFee = $total_fee / 100; $attach = $postObj->attach; parse_str($attach);//接收流水类型、代金劵 $couponId = isset($couponId) ? $couponId : 0; $capitalType = isset($capitalType) ? $capitalType : null;//流水类型 if (isset($capitalType) == false) { Yii::warning('capitalType empty,orderId:' . $orderId); util::end(); } $return = xhPayToolService::weixinPay($orderId, $totalFee, $capitalType, $couponId);//支付回调流程 if ($return['code'] == 'A0002') { Yii::warning('callback exec and failed,capitalType:' . $capitalType . ' orderId:' . $orderId); util::end(); } echo ''; } }