/** * 向指定openID用户发送红包 * @param to $userOpenID * @param array $redpack * @param $time curl request 超时时间 * @return mixed|string */ public function sendRedpackTo($userOpenID, array $redpack, $time) { $time = isset($time) ? $time : 30; return BCWxmpApiUtil::sendWxmpRedpack(BCWxmpRedPackSetting::getServerRandomUrl(), $userOpenID, $redpack, $this, $time); }
} else { if (preg_match("/^该用户已达到发送红包上限/", $result->sendMsg)) { echo $api->responseText($redpackRepeatMsg); } else { if (preg_match("/^该用户随机未成功/", $result->sendMsg)) { echo $api->responseText($redpackMissMsg); } } } } else { if ($result->errMsg == "WX_SERVER_ERROR" && $result->err_code == "NOTENOUGH") { echo $api->responseText($redpackNotenoughMsg); } } } break; default: break; } } } exit; } catch (Exception $e) { if (BCWxmpRedPackSetting::$wxmpRedpackDebug) { //通过 微信显示debug信息,可以本地写log $msg = BCWxmpApiUtil::responseDebugText($e->getMessage()); if ($msg != false) { echo $msg; } } }