|
@@ -10,6 +10,7 @@ use app\index\model\OrderAddress;
|
|
|
use app\index\model\user\PointsLog as PointsLogModel;
|
|
|
use app\index\model\Goods as GoodsModel;
|
|
|
use app\index\model\Order as OrderModel;
|
|
|
+use app\index\service\passport\UMailer;
|
|
|
use app\store\model\Express as ExpressModel;
|
|
|
use think\facade\Cache;
|
|
|
use think\facade\Log;
|
|
@@ -176,16 +177,26 @@ class User extends Controller
|
|
|
$encryptUserId = encrypt(strval($userId));
|
|
|
|
|
|
$url = 'Your friend shared a product with you. Click on the link to view it now:'
|
|
|
- . config('app.app_host') . '/index/index/productDetails.html?goodsId=' . $goodsId . '&key=' . $encryptUserId;
|
|
|
+ . config('app.app_host') . '/index/index/productDetails/goodsId/' . $goodsId . '?key=' . $encryptUserId;
|
|
|
Log::info($url);
|
|
|
|
|
|
- $MailCaptchaService = new MailCaptchaService;
|
|
|
- if ($MailCaptchaService->sendText($mailbox, 'From Your Friend', $url)) {
|
|
|
+ $smtp = new UMailer(config('smtp.host'), config('smtp.port'), true,
|
|
|
+ config('smtp.username'), config('smtp.password'));
|
|
|
+ $smtp->debug = true; //是否显示发送的调试信息
|
|
|
+ $flag = $smtp->sendShareText($mailbox, config('smtp.username'),'Code','TXT','','','', $url);
|
|
|
+ if ($flag) {
|
|
|
$shareKeyModel = new ShareKey();
|
|
|
$shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
|
|
|
return $this->renderSuccess([], 'Successful! Tell your friends to check for new emails.');
|
|
|
}
|
|
|
|
|
|
+/* $MailCaptchaService = new MailCaptchaService;
|
|
|
+ if ($MailCaptchaService->sendText($mailbox, 'From Your Friend', $url)) {
|
|
|
+ $shareKeyModel = new ShareKey();
|
|
|
+ $shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
|
|
|
+ return $this->renderSuccess([], 'Successful! Tell your friends to check for new emails.');
|
|
|
+ }*/
|
|
|
+
|
|
|
if (is_debug()) {
|
|
|
$shareKeyModel = new ShareKey();
|
|
|
$shareKeyModel->save(['key_string' => $encryptUserId, 'user_id' => $userId, 'store_id' => $this->storeId, 'create_time' => time(), 'is_delete' => 0, 'update_time' => time()]);
|