public function orderinfo($orderId = '', $orderNumber = '') { if (!$this->isLogin()) { $this->redirect('Home/register'); } $this->commonProcess(); if ($orderId != '') { $order = D('Order', 'Logic')->findByOrderId($orderId); } else { if ($orderNumber != '') { $order = D('Order', 'Logic')->findByOrderNumber($orderNumber); } } $ordeItems = D('OrderItem', 'Logic')->getOrderItemsByOrdeId($order['orderId']); $orderBill = D('OrderBill', 'Logic')->findOrderSuccessPayBill($order['orderNumber']); $shippingAddress = D('ShippingAddress', 'Logic')->findExsitingAddress($order['shippingAddress']); $orderStatus = C('ORDERSTATUS'); $order['statusDescription'] = $orderStatus[$order['status']]; $order['orderDate'] = substr($order['orderDate'], 0, 10); $this->assign('order', $order); $this->assign('orderItems', $ordeItems); $this->assign('orderBill', $orderBill); $this->assign('address', parseAddressCode($shippingAddress)); $this->display(); }
protected function parseAddressListCode($addressList) { $i = 0; foreach ($addressList as $address) { $addressList[$i] = parseAddressCode($address); $i++; } return $addressList; }
function sendMailNewVersion($mailContent, $type, $userInfo) { $mail = new \PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->CharSet = 'UTF-8'; // Set CharSet to UTF-8 $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.ym.163.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->Port = 25; // TCP port to connect to $mail->setFrom(C('EMAIL_FROM'), 'StarballKids'); $mail->addAddress($userInfo["email"], $userInfo["userName"]); // Add a recipient //$mail->addAddress('*****@*****.**'); // Name is optional //$mail->addReplyTo('*****@*****.**', 'Information'); //$mail->addCC('*****@*****.**'); //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail->isHTML(true); // Set email format to HTML if ($type == "payment") { foreach (explode(';', C('SELLER_EMAIL_ADDRESS')) as $bccEmail) { $mail->addBCC($bccEmail); //发给卖家的邮件通知 } $address = D('ShippingAddress', 'Logic')->getDefaultAddress($mailContent['userId']); $address = parseAddressCode($address); $template = ""; $template = $template . "<p>尊敬的" . $userInfo["userName"] . ":</p>"; $template = $template . "<p>非常感谢您对StarBall.Kids的支持,您的订单下单时间为" . date('y-m-d H:i:s', time()) . ",您的订单号码为" . $mailContent["orderNumber"] . "。</p>"; $template = $template . "<p>我们正在打包您的包裹。当您的包裹开始邮寄时,您将会收到另一封邮件,包含您的包裹追踪号码。您可以登录快递公司官方网站,输入您的包裹追踪号码进而跟踪您的商品。</p>"; $template = $template . "<p>您的订单详情: </p>"; $currency = C('CURRENCY'); $tableContent = ""; $tableContent = $tableContent . "<table width='600' cellpadding='0' cellspacing='0' style='border: 1px #F2F2F2 solid; background-color: #F8F8F8'><tbody>\n\t\t<tr><td>描述</td><td>数量</td><td>尺寸</td><td>价钱(" . $currency[$mailContent['currency']] . ")</td></tr>"; foreach ($mailContent['orderItems'] as $orderItem) { $tableContent = $tableContent . "<tr><td>" . $orderItem['itemName'] . "</td><td>" . $orderItem['quantity'] . "</td><td>" . $orderItem['sizeDescription'] . "</td><td>" . $orderItem['price'] . "</td></tr>"; } $tableContent = $tableContent . "<tr><td>商品总计</td><td>-</td><td>-</td><td>" . $mailContent['totalAmount'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>运费</td><td>-</td><td>-</td><td>" . $mailContent['shippingFee'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>礼品包装费用</td><td>-</td><td>-</td><td>" . $mailContent['giftPackageFee'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>总金额</td><td>-</td><td>-</td><td>" . $mailContent['totalFee'] . "</td></tr>"; $tableContent = $tableContent . "</tbody></table>"; $template = $template . $tableContent; if ($mailContent['addtionalGreetings'] != '') { $template = $template . "<p>礼品包装祝福信息:" . $mailContent['addtionalGreetings'] . "</p>"; } $template = $template . "<p>您提供的收货地址:</p>"; $template = $template . "<p>" . $address['address'] . "<p>"; if ($address['postCode'] != '') { $template = $template . " " . $address['postCode']; } if ($address['city'] != '') { $template = $template . " " . $address['city']; } if ($address['province'] != '') { $template = $template . ' ' . $address['province']; } $template = $template . ' ' . $address['country'] . '<br></p>'; $template = $template . "收货人姓名:" . $address['contactName'] . ' 电话:' . $address['phone']; $template = $template . "<p><img src='http://7xr7p7.com2.z0.glb.qiniucdn.com/1660857294.jpg' width='80' height='51'></p>"; $template = $template . "<p>StarBall.Kids是一家来自香港的婴幼儿品牌集合店,主营进口婴幼儿童服装,这里有世界各地的大牌潮牌衣服供您选择。</p>"; $template = $template . "<p>联系我们:邮件(starballkidshk@gmail.com)</p>"; $mail->Subject = 'StarballKids支付成功通知-订单号' . $mailContent["orderNumber"]; $mail->Body = $template; } elseif ($type == "delivered") { $address = D('ShippingAddress', 'Logic')->getDefaultAddress($mailContent['userId']); $address = parseAddressCode($address); $mail->Subject = 'StarballKids发货通知-订单号' . $mailContent["orderNumber"]; $template = ""; $template = $template . "<p>尊敬的" . $userInfo["userName"] . ":</p>"; $template = $template . "<p>很高兴的通知您,您的订单" . $mailContent["orderNumber"] . "已经发货了。</p>"; $template = $template . "<p>您的订单详情:</p>"; $currency = C('CURRENCY'); $tableContent = ""; $tableContent = $tableContent . "<table width='600' cellpadding='0' cellspacing='0' style='border: 1px #F2F2F2 solid; background-color: #F8F8F8'><tbody>\n\t\t<tr><td>描述</td><td>数量</td><td>尺寸</td><td>价钱(" . $currency[$mailContent['currency']] . ")</td></tr>"; foreach ($mailContent['orderItems'] as $orderItem) { $tableContent = $tableContent . "<tr><td>" . $orderItem['itemName'] . "</td><td>" . $orderItem['quantity'] . "</td><td>" . $orderItem['sizeDescription'] . "</td><td>" . $orderItem['price'] . "</td></tr>"; } $tableContent = $tableContent . "<tr><td>商品总计</td><td>-</td><td>-</td><td>" . $mailContent['totalAmount'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>运费</td><td>-</td><td>-</td><td>" . $mailContent['shippingFee'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>礼品包装费用</td><td>-</td><td>-</td><td>" . $mailContent['giftPackageFee'] . "</td></tr>"; $tableContent = $tableContent . "<tr><td>总金额</td><td>-</td><td>-</td><td>" . $mailContent['totalFee'] . "</td></tr>"; $tableContent = $tableContent . "</tbody></table>"; $template = $template . $tableContent; $template = $template . "<p>您可以登录快递公司的官方网站,输入您的包裹追踪号码来跟踪您的商品。</p>"; $template = $template . "<p>您的快递公司:" . $mailContent["expressName"] . "</p>"; $template = $template . "<p>您的包裹追踪号码:" . $mailContent["expressNumber"] . "</p>"; $template = $template . "<p>您提供的收货地址:</p>"; $template = $template . "<p>" . $address['address']; if ($address['city'] != '') { $template = $template . " " . $address['city']; } if ($address['province'] != '') { $template = $template . ' ' . $address['province']; } $template = $template . ' ' . $address['country'] . '<br></p>'; $template = $template . "<p>有关于商品退换货事宜,请查看官网 www.starballkids.com 主页下方的退换政策了解详情。或联系我们的客服微信 starballkidshk. 我们会在第一时间给您回复并处理相关事宜。</p>"; $template = $template . "<p>非常感谢您选择StarBall.Kids,相信是一次愉快的购物体验。希望很快再见到您,谢谢光临。</p>"; $template = $template . "<p><img src='http://7xr7p7.com2.z0.glb.qiniucdn.com/1660857294.jpg' width='80' height='51'></p>"; $template = $template . "<p>StarBall.Kids是一家来自香港的婴幼儿品牌集合店,主营进口婴幼儿童服装,这里有世界各地的大牌潮牌衣服供您选择。</p>"; $template = $template . "<p>联系我们:邮件(starballkidshk@gmail.com)</p>"; $mail->Body = $template; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; } else { if ($type == 'itemSubscription') { $mail->Subject = 'StarballKids到货通知'; $template = ""; $template = $template . "<p>尊敬的顾客:</p>"; $template = $template . "<p>很高兴的通知您,您喜爱的商品 " . $mailContent['name'] . " 现货已登陆StarBall.Kids官方网站。库存有限,立即行动吧。</p>"; $template = $template . "<p>点击下方链接进行购买</p>"; $template = $template . "<p>http://www.starballkids.com/Starball/Item/index/itemId/" . $mailContent['itemId'] . ".html</p>"; $template = $template . "<p>我们的官方网站 www.starballkids.com 还有更多选择,欢迎浏览购买,相信会是一次愉快的购物体验。感谢您对StarBall.Kids的支持。</p>"; $template = $template . "<p><img src='http://7xr7p7.com2.z0.glb.qiniucdn.com/1660857294.jpg' width='80' height='51'></p>"; $template = $template . "<p>StarBall.Kids是一家来自香港的婴幼儿品牌集合店,主营进口婴幼儿童服装,这里有世界各地的大牌潮牌衣服供您选择。</p>"; $mail->Body = $template; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; } } if (!$mail->send()) { //echo 'Message could not be sent.'; logInfo('Mailer Error: ' . $mail->ErrorInfo); return false; } return true; }
public function getOrderInformationByOrderId($orderId) { $orderItemLogic = D("OrderItem", "Logic"); $shippingAddressLogic = D("ShippingAddress", "Logic"); $orderBillLogic = D("OrderBill", "Logic"); $userLogic = D("User", "Logic"); $map["orderId"] = $orderId; $information = current($this->where($map)->select()); $information["orderItems"] = $orderItemLogic->getOrderItemsByOrdeId($orderId); $shippingAddressId = $information["shippingAddress"]; $userId = $information["userId"]; $information["userInformation"] = $userLogic->getUserInformationByUserId($userId); if ($shippingAddressId == "0") { $information["shippingAddress"] = ""; } else { $information["shippingAddress"] = parseAddressCode($shippingAddressLogic->findExsitingAddress($shippingAddressId)); } $orderNumber = $information["orderNumber"]; if ($orderNumber == "") { $information["orderBills"] = ""; } else { $orderBillMap["orderNumber"] = $orderNumber; $information["orderBills"] = $orderBillLogic->queryBill($orderBillMap); $information['payChannel'] = $information["orderBills"][0]['channel']; } return $information; }