private function doRemindInWeinXin($orderInfo) { $wxUserInfo = WxUserModel::findUserByUserId($orderInfo['user_id']); if (empty($wxUserInfo['openid'])) { return; } if (time() - $wxUserInfo['atime'] < 48 * 3600) { $content = '亲,您有一个未支付订单,请您及时付款以免过期\\n\\n' . '<a href=\\"' . APP_URL_BASE . '/User/MyOrder/toPay' . '\\">' . '前往支付>>' . '</a>'; AsyncModel::asyncSendKfMsg($wxUserInfo['openid'], 'text', $content, 0); } }
public static function firstSend($smsPhones, $smsContent) { $url = 'http://si.800617.com:4400/SendSms.aspx?un=xxx&pwd=xxx' . '&mobile=' . $smsPhones . '&msg=' . urlencode(iconv('utf-8', 'gb2312', $smsContent)); $beginTime = microtime(true); $ret = HttpUtil::request($url, false, false, 3); $diff = round(microtime(true) - $beginTime, 3); if ((double) $diff > 1.5) { Log::warng('second smsservice - escape long time ' . $diff); } if ($ret === false) { return false; } if (strpos($ret, '=1&') !== false) { return true; } if (strpos($ret, '=-11&') !== false) { // 无余额 AsyncModel::monitor('短信余额不足', '首选短信运营商余额不足'); return false; } return false; }
private static function onUserSubscribe($openid, $from) { // 异步创建微信用户或更新用户信息 AsyncModel::asyncSubscribe($openid, $from); }