public function doSaveInformationAction() { $returnMs; $userid = $this->loginUser->uid; if (!$userid > 0) { $returnMsg = "您还没有登录,请登录后在兑换礼品!"; $this->redirectAndShowMsg($returnMsg); } $userMoney = $this->_getMyMoneyDS()->getMyMoney($userid); $userMoney = $userMoney[0]; if (empty($userMoney)) { $returnMsg = "未知的用户!"; $this->redirectAndShowMsg($returnMsg); } $pid = $this->getInput('pid'); $prize = $this->_getGiftExchange()->getPrizeById($pid); if (empty($prize)) { $returnMsg = "您所选择的商品不存在,请重新兑换。"; $this->redirectAndShowMsg($returnMsg); } if ($prize['dmoney'] > $userMoney['money']) { $returnMsg = "您的点币不足,点餐返点币,赶快去点餐吧!"; $this->redirectAndShowMsg($returnMsg); } $deductDMoeny = 0 - $prize['dmoney']; $isDeduct = $this->_getMyMoneyDS()->updateMyMoney($userMoney['userid'], $deductDMoeny, 0, $prize['name']); if ($isDeduct != 1) { $returnMsg = "非常抱歉,您刚才的兑换失败了,请再次尝试。"; $this->redirectAndShowMsg($returnMsg); } $myMoney = $this->_getMyMoneyDS()->getMyMoney($userMoney['userid']); $this->setOutput($myMoney[0], 'myMoney'); $this->setOutput($prize, "prize"); list($pid, $receiveContactor, $receivePhone, $receiveQQ, $receiveAddress) = $this->getInput(array('pid', 'receiveContactor', 'receivePhone', 'receiveQQ', 'receiveAddress')); $dm = new App_Giftexchange_Dm(); $dm->setUserId($userMoney['userid'])->setContact($receiveContactor)->setPhoneNumber($receivePhone)->setqq($receiveQQ)->setAddress($receiveAddress)->setProductId($prize['id'])->setCreateTime(Pw::getTime()); $row = $this->_getGiftExchange()->add($dm); if (!$row > 0) { $returnMsg = "收货信息保存失败,请联系点餐哟客服人工处理,给您带来的不便我们深表歉意!"; $this->redirectAndShowMsg($returnMsg); } if ($row) { $nowtime = date('Y-m-d H:i:s'); Wind::import('LIB:utility.PwMail'); $mail = new PwMail(); $mail->sendMail($receiveQQ . '@qq.com', $nowtime . '点餐哟点币兑换', '您已成功兑换' . $prize['name']); } $returnMsg = "您已成功兑换" . $prize['name'] . ",消耗点币" . $prize['dmoney'] . "个。我们将尽快处理,相关信息将以短信或电话的方式通知您。兑换详情请到零钱包中查看。"; $this->redirectAndShowMsg($returnMsg); die; }
public function doReportAction() { $reportId = $this->getInput("reportid"); $postData = print_r($_POST, true); $requestData = print_r($_REQUEST, true); $content = "Post:<br/>" . $postData . "<br/>" . $requestData; $mail = new PwMail(); $result = $mail->sendMail('*****@*****.**', "点餐哟客户端:" . $reportId, $content); if ($result instanceof PwError) { $result = false; } else { $result = true; } $this->output($result); }
/** * 发送测试邮件 */ public function dosendAction() { Wind::import('LIB:utility.PwMail'); list($fromEmail, $toEmail) = $this->getInput(array('fromEmail', 'toEmail'), 'post'); if (!$toEmail) { $this->showError('ADMIN:email.test.toemail.require'); } $mail = new PwMail(); $title = Wekit::C('site', 'info.name') . ' 测试邮件'; $content = '恭喜您,如果您收到此邮件则代表后台邮件发送设置正确!'; $result = $mail->sendMail($toEmail, $title, $content); if ($result === true) { $this->showMessage('ADMIN:email.test.success'); } $this->showError(array('ADMIN:email.test.error', array('{error}' => $result->getError()))); }
/** * 发送重置邮件 * * @param string $state 加密串 * @return boolean */ public function sendResetEmail($state) { if (true !== ($check = $this->allowFindBy(self::WAY_EMAIL))) { return $check; } //TODO 产生激活码的方法 $code = substr(md5(Pw::getTime()), mt_rand(1, 8), 8); $url = WindUrlHelper::createUrl('u/findPwd/resetpwd', array('code' => $code, '_statu' => $state)); list($title, $content) = $this->_buildTitleAndContent($this->info['username'], $url); /* @var $activeCodeDs PwUserActiveCode */ $activeCodeDs = Wekit::load('user.PwUserActiveCode'); $activeCodeDs->addActiveCode($this->info['uid'], $this->info['email'], $code, Pw::getTime(), PwUserActiveCode::RESETPWD); $mail = new PwMail(); $mail->sendMail($this->info['email'], $title, $content); return true; }
/** * 发送欢迎信息 * * @param int $uid 用户ID * @param string $username 用户名 * @param string $email 邮箱 * @return boolean */ public function sendWelcomeMsg($uid, $username, $email) { list($title, $content) = $this->_buildTitleAndContent('welcome.title', 'welcome.content', $username); if (in_array(1, $this->config['welcome.type'])) { /* @var $notice PwNoticeService */ $notice = Wekit::load('message.srv.PwNoticeService'); $notice->sendDefaultNotice($uid, $content, $title); } /*如果含有激活邮件则发送到*/ if (!in_array(2, $this->config['welcome.type'])) { return true; } //如果是邮件激活开启,则不需要发送欢迎邮件 if ($this->config['active.mail'] == 1) { return true; } $mail = new PwMail(); $mail->sendMail($email, $title, $content); return true; }
private function sendEmailActive($username, $email, $statu = '', $uid) { $code = substr(md5(Pw::getTime()), mt_rand(1, 8), 8); $url = WindUrlHelper::createUrl('app/4tschool/emailvalidation/run', array('code' => $code, '_statu' => $statu)); list($title, $content) = $this->_buildTitleAndContent('active.mail.title', 'active.mail.content', $username, $url); /* @var $activeCodeDs PwUserActiveCode */ $activeCodeDs = Wekit::load('user.PwUserActiveCode'); $activeCodeDs->addActiveCode($uid, $email, $code, Pw::getTime()); $mail = new PwMail(); $mail->sendMail($email, $title, $content); return true; }
$startDate = '2013-08-01'; $isfirstrun = false; //if it is first time run, then need to calculate the data from start date date_default_timezone_set('Asia/Shanghai'); $today = date('Y-m-d H:i:s'); echo "today:" . $today; if ($isfirstrun) { while ($startDate < $today) { calDailySale($startDate); //prepare next day $fromDateArray = getdate(strtotime($startDate)); $nextday = mktime(0, 0, 0, $fromDateArray['mon'], $fromDateArray['mday'] + 1, $fromDateArray['year']); $startDate = date('Y-m-d', $nextday); } } else { //if it is not first time run, then just cal previous $fromDateArray = getdate(strtotime($today)); $nextday = mktime(0, 0, 0, $fromDateArray['mon'], $fromDateArray['mday'] - 1, $fromDateArray['year']); $calDate = date('Y-m-d', $nextday); echo $calDate; calDailySale($calDate); Wind::import('LIB:utility.PwMail'); $mail = new PwMail(); $mail->sendMail('*****@*****.**', $calDate . '商家返利统计计算完毕', '如题,谢谢'); } function calDailySale($currentday) { $cShopDaily = Wekit::load('EXT:4tschool.service.shopdailysale.App_ShopDailySale'); $result = $cShopDaily->calDailySale($currentday); $cShopDaily->saveDailyCal($result); }
public function emailAction() { Wind::import("Lib:utility.PwMail"); $mail = new PwMail(); $mail->sendMail('*****@*****.**', '测试邮件', '测试邮件内容'); }
protected function sendVerifyEmail($email) { $userBo = Wekit::getLoginUser(); $user = $userBo->info; Wind::import('SRV:user.srv.PwRegisterService'); $code = substr(md5(Pw::getTime()), mt_rand(1, 8), 8); $url = WindUrlHelper::createUrl('app/verify/index/verifyEmail', array('code' => $code)); list($title, $content) = $this->_buildTitleAndContent('verify.email.title', 'verify.email.content', $user['username'], $url); $activeCodeDs = Wekit::load('user.PwUserActiveCode'); $activeCodeDs->addActiveCode($user['uid'], $email, $code, Pw::getTime(), self::VERIFY_EMAIL); $mail = new PwMail(); $mail->sendMail($email, $title, $content); return true; }