完善mailgun, sendmail 邮件发送
This commit is contained in:
parent
50ca3e4aff
commit
459bb3db51
|
|
@ -70,7 +70,7 @@ class AttributeGroupRepo
|
|||
{
|
||||
$group = AttributeGroup::query()->findOrFail($id);
|
||||
if ($group->attributes->count()) {
|
||||
throw New \Exception(trans('admin/attribute_groups.error_cannot_delete_attribute_used', ['attributes' => implode(', ', $group->attributes->pluck('id')->toArray())]));
|
||||
throw new \Exception(trans('admin/attribute_groups.error_cannot_delete_attribute_used', ['attributes' => implode(', ', $group->attributes->pluck('id')->toArray())]));
|
||||
}
|
||||
$group->descriptions()->delete();
|
||||
$group->delete();
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class AttributeRepo
|
|||
{
|
||||
$productIds = ProductAttribute::query()->where('attribute_id', $id)->pluck('product_id')->toArray();
|
||||
if ($productIds) {
|
||||
throw New \Exception(trans('admin/attribute.error_cannot_delete_product_used', ['product_ids' => implode(', ', $productIds)]));
|
||||
throw new \Exception(trans('admin/attribute.error_cannot_delete_product_used', ['product_ids' => implode(', ', $productIds)]));
|
||||
}
|
||||
$attribute = Attribute::query()->findOrFail($id);
|
||||
$attribute->descriptions()->delete();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,13 @@ class AdminForgottenNotification extends Notification implements ShouldQueue
|
|||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', 'database'];
|
||||
$drivers[] = 'database';
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
if ($mailEngine) {
|
||||
$drivers[] = 'mail';
|
||||
}
|
||||
|
||||
return $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,7 +44,13 @@ class ForgottenNotification extends Notification implements ShouldQueue
|
|||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', 'database'];
|
||||
$drivers[] = 'database';
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
if ($mailEngine) {
|
||||
$drivers[] = 'mail';
|
||||
}
|
||||
|
||||
return $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,13 @@ class NewOrderNotification extends Notification implements ShouldQueue
|
|||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', 'database'];
|
||||
$drivers[] = 'database';
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
if ($mailEngine) {
|
||||
$drivers[] = 'mail';
|
||||
}
|
||||
|
||||
return $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,13 @@ class RegistrationNotification extends Notification implements ShouldQueue
|
|||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', 'database'];
|
||||
$drivers[] = 'database';
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
if ($mailEngine) {
|
||||
$drivers[] = 'mail';
|
||||
}
|
||||
|
||||
return $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,7 +44,13 @@ class UpdateOrderNotification extends Notification implements ShouldQueue
|
|||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', 'database'];
|
||||
$drivers[] = 'database';
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
if ($mailEngine) {
|
||||
$drivers[] = 'mail';
|
||||
}
|
||||
|
||||
return $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,13 +14,12 @@ namespace Beike\Shop\Http\Controllers\Account;
|
|||
use Beike\Shop\Http\Requests\ForgottenRequest;
|
||||
use Beike\Shop\Http\Requests\VerifyCodeRequest;
|
||||
use Beike\Shop\Services\AccountService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ForgottenController
|
||||
{
|
||||
/**
|
||||
* 找回密码页面
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
|
@ -29,10 +28,10 @@ class ForgottenController
|
|||
|
||||
/**
|
||||
* 接收email地址,生成验证码发送到邮件地址
|
||||
* @param Request $request
|
||||
* @param VerifyCodeRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function sendVerifyCode(VerifyCodeRequest $request)
|
||||
public function sendVerifyCode(VerifyCodeRequest $request): array
|
||||
{
|
||||
AccountService::sendVerifyCodeForForgotten($request->get('email'), 'email');
|
||||
|
||||
|
|
@ -41,10 +40,11 @@ class ForgottenController
|
|||
|
||||
/**
|
||||
* 接收验证码和新密码、确认密码,验证验证码是否正确、密码和确认密码是否相等,然后修改密码
|
||||
* @param Request $request
|
||||
* @param ForgottenRequest $request
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function changePassword(ForgottenRequest $request)
|
||||
public function changePassword(ForgottenRequest $request): array
|
||||
{
|
||||
AccountService::verifyAndChangePassword($request->get('code'), $request->get('email'), $request->get('password'));
|
||||
|
||||
|
|
|
|||
|
|
@ -95,17 +95,25 @@ class ShopServiceProvider extends ServiceProvider
|
|||
*/
|
||||
protected function loadMailConfig()
|
||||
{
|
||||
$mailEngine = system_setting('base.mail_engine', 'smtp');
|
||||
$mailEngine = system_setting('base.mail_engine');
|
||||
$storeMail = system_setting('base.email', '');
|
||||
|
||||
if (empty($mailEngine)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Config::set('mail.default', $mailEngine);
|
||||
Config::set('mail.from.address', $storeMail);
|
||||
Config::set('mail.from.name', \config('app.name'));
|
||||
|
||||
$smtpSetting = system_setting('base.smtp');
|
||||
if ($smtpSetting) {
|
||||
$smtpSetting['transport'] = 'smtp';
|
||||
Config::set('mail.mailers.smtp', $smtpSetting);
|
||||
if ($setting = system_setting('base.smtp')) {
|
||||
$setting['transport'] = 'smtp';
|
||||
Config::set('mail.mailers.smtp', $setting);
|
||||
} elseif ($setting = system_setting('base.mailgun')) {
|
||||
Config::set('services.mailgun', $setting);
|
||||
} elseif ($setting = system_setting('base.sendmail')) {
|
||||
$setting['transport'] = 'sendmail';
|
||||
Config::set('mail.mailers.sendmail', $setting);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'index' => 'Attribute',
|
||||
'attribute_info' => 'Attribute information',
|
||||
'create_at' => 'Create attribute',
|
||||
'attribute_value' => 'Cttribute value',
|
||||
'set_attribute' => 'Configuration attribute',
|
||||
'add_attribute' => 'Add attribute value',
|
||||
'before_attribute' => 'Please select the left attribute first',
|
||||
'btn_at' => 'Go now',
|
||||
'btn_later' => 'Later',
|
||||
'to_info_values' => 'Please go to the details page to edit attribute values',
|
||||
'error_cannot_delete_product_used' => 'Attribute used by products (ID: :product_ids), can not be deleted!'
|
||||
'index' => 'Attribute',
|
||||
'attribute_info' => 'Attribute information',
|
||||
'create_at' => 'Create attribute',
|
||||
'attribute_value' => 'Cttribute value',
|
||||
'set_attribute' => 'Configuration attribute',
|
||||
'add_attribute' => 'Add attribute value',
|
||||
'before_attribute' => 'Please select the left attribute first',
|
||||
'btn_at' => 'Go now',
|
||||
'btn_later' => 'Later',
|
||||
'to_info_values' => 'Please go to the details page to edit attribute values',
|
||||
'error_cannot_delete_product_used' => 'Attribute used by products (ID: :product_ids), can not be deleted!',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'index' => 'Attribute group',
|
||||
'create_at_groups' => 'Create attribute group',
|
||||
'error_cannot_delete_attribute_used' => 'Attribute Group used by attribute (ID: :attributes), can not be deleted!'
|
||||
'index' => 'Attribute group',
|
||||
'create_at_groups' => 'Create attribute group',
|
||||
'error_cannot_delete_attribute_used' => 'Attribute Group used by attribute (ID: :attributes), can not be deleted!',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'index' => '属性',
|
||||
'attribute_info' => '属性信息',
|
||||
'create_at' => '创建属性',
|
||||
'attribute_value' => '属性值',
|
||||
'set_attribute' => '配置属性',
|
||||
'add_attribute' => '添加属性值',
|
||||
'before_attribute' => '请先选择左边属性',
|
||||
'btn_at' => '立即前往',
|
||||
'btn_later' => '稍后再去',
|
||||
'to_info_values' => '请前往详情页编辑属性值',
|
||||
'error_cannot_delete_product_used' => '属性不能删除,由于该属性被商品(商品ID: :product_ids)使用'
|
||||
'index' => '属性',
|
||||
'attribute_info' => '属性信息',
|
||||
'create_at' => '创建属性',
|
||||
'attribute_value' => '属性值',
|
||||
'set_attribute' => '配置属性',
|
||||
'add_attribute' => '添加属性值',
|
||||
'before_attribute' => '请先选择左边属性',
|
||||
'btn_at' => '立即前往',
|
||||
'btn_later' => '稍后再去',
|
||||
'to_info_values' => '请前往详情页编辑属性值',
|
||||
'error_cannot_delete_product_used' => '属性不能删除,由于该属性被商品(商品ID: :product_ids)使用',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'index' => '属性组',
|
||||
'create_at_groups' => '创建属性组',
|
||||
'error_cannot_delete_attribute_used' => '属性组不能删除,由于该属性组被属性(属性ID: :attributes)使用'
|
||||
'index' => '属性组',
|
||||
'create_at_groups' => '创建属性组',
|
||||
'error_cannot_delete_attribute_used' => '属性组不能删除,由于该属性组被属性(属性ID: :attributes)使用',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue