Skip to content

Commit 246baf1

Browse files
committed
代码优化
1 parent 9c9fdc9 commit 246baf1

9 files changed

Lines changed: 43 additions & 25 deletions

File tree

app/Http/Controllers/RegisterController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function index(Request $request)
203203
// 生成激活账号的地址
204204
$token = md5(self::$systemConfig['website_name'] . $username . microtime());
205205
$activeUserUrl = self::$systemConfig['website_url'] . '/active/' . $token;
206-
$this->addVerify($user->id, $username, $token);
206+
$this->addVerify($user->id, $token);
207207

208208
try {
209209
Mail::to($username)->send(new activeUser(self::$systemConfig['website_name'], $activeUserUrl));
@@ -286,11 +286,11 @@ private function getAff($code = '', $aff = '')
286286
}
287287

288288
// 写入生成激活账号验证记录
289-
private function addVerify($userId, $username, $token)
289+
private function addVerify($userId, $token)
290290
{
291291
$verify = new Verify();
292+
$verify->type = 1;
292293
$verify->user_id = $userId;
293-
$verify->username = $username;
294294
$verify->token = $token;
295295
$verify->status = 0;
296296
$verify->save();

app/Http/Controllers/UserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ public function activeUser(Request $request)
636636
// 生成激活账号的地址
637637
$token = md5(self::$systemConfig['website_name'] . $username . microtime());
638638
$verify = new Verify();
639+
$verify->type = 1;
639640
$verify->user_id = $user->id;
640-
$verify->username = $username;
641641
$verify->token = $token;
642642
$verify->status = 0;
643643
$verify->save();
@@ -757,8 +757,8 @@ public function resetPassword(Request $request)
757757
// 生成取回密码的地址
758758
$token = md5(self::$systemConfig['website_name'] . $username . microtime());
759759
$verify = new Verify();
760+
$verify->type = 1;
760761
$verify->user_id = $user->id;
761-
$verify->username = $username;
762762
$verify->token = $token;
763763
$verify->status = 0;
764764
$verify->save();

config/domains.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,19 @@
3434
'neustar', 'ni', 'np', 'nr', 'nyc', 'okinawa', 'pa', 'pg', 'ph', 'pk', 'pn', 'ps', 'py', 'qpon', 'ren', 'rw', 'krd',
3535
'sd', 'sj', 'sl', 'sohu', 'sr', 'ss', 'sv', 'sz', 'td', 'tg', 'tj', 'tokyo', 'tp', 'trade', 'tt', 'um', 'uno', 'llc',
3636
'va', 'vi', 'vi', 'vn', 'webcam', 'ye', 'yokohoma', 'ryukyu', 'meet', 'vote', 'lc', 'voto', 'wed', 'zw', 'ooo', 'ltda',
37-
'stream', 'wtf', 'observer', 'site', 'tech', 'world' ,
37+
'stream', 'wtf', 'observer', 'site', 'tech', 'world', 'vet', 'video', 'vin', 'website', 'wedding', 'whoswho', 'win',
38+
'wine', 'work', 'yoga', 'tires', 'tickets', 'theatre', 'theater', 'tennis', 'team', 'taxi', 'tax', 'surgery', 'surf',
39+
'sucks', 'study', 'style', 'storage', 'studio', 'space', 'software', 'soccer', 'ski', 'show', 'shopping', 'shop',
40+
'security', 'science', 'schule', 'school', 'sarl', 'salon', 'sale', 'run', 'rip', 'review', 'restaurant', 'republican',
41+
'rent', 'reise', 'rehab', 'realty', 'racing', 'protection', 'property', 'promo', 'press', 'plus', 'place', 'pizza',
42+
'pet', 'party', 'organic', 'one', 'news', 'network', 'navy', 'movie', 'mortgage', 'money', 'mom', 'men', 'memorial',
43+
'mba', 'market', 'maison', 'love', 'lol', 'loan', 'live', 'limited', 'life', 'lgbt', 'legal', 'lawyer', 'juegos',
44+
'jewelry', 'irish', 'investments', 'insure', 'ink', 'hosting', 'host', 'hospital', 'hockey', 'hiv', 'hiphop', 'help',
45+
'healthcare', 'guide', 'group', 'green', 'gratis', 'golf', 'gold', 'gmbh', 'global', 'gives', 'gifts', 'garden', 'games',
46+
'game', 'fyi', 'furniture', 'fund', 'forsale', 'flowers', 'fitness', 'fit', 'finance', 'film', 'fashion', 'fans', 'family',
47+
'faith', 'fail', 'express', 'exchange', 'engineer', 'energy', 'earth', 'download', 'doctor', 'discount', 'direct',
48+
'digital', 'diet', 'design', 'dentist', 'dental', 'delivery', 'degree', 'deals', 'date', 'dance', 'cricket', 'creditcard',
49+
'credit', 'courses', 'coupons', 'condos', 'consulting', 'coach', 'cloud', 'clinic', 'click', 'claims', 'city', 'church',
50+
'chat', 'charity', 'casino', 'cafe', 'buzz', 'business', 'boston', 'blog', 'bio', 'bingo', 'bid', 'beer', 'band', 'audio',
51+
'auction', 'attorney', 'art', 'army', 'apartments', 'airforce', 'accountants', 'accountant'
3852
];

resources/views/admin/addUser.blade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<label for="username" class="col-md-3 control-label">用户名</label>
3131
<div class="col-md-8">
3232
<input type="text" class="form-control" name="username" id="username" placeholder="" autofocus required>
33-
<input type="hidden" name="_token" value="{{csrf_token()}}">
3433
</div>
3534
</div>
3635
<div class="form-group">

resources/views/admin/editUser.blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<div class="form-group">
3535
<label for="username" class="col-md-3 control-label">用户名</label>
3636
<div class="col-md-8">
37-
<input type="text" class="form-control" name="username" value="{{$user->username}}" id="username" placeholder="不填则不变" autofocus required>
38-
<input type="hidden" name="id" value="{{$user->id}}">
39-
<input type="hidden" name="_token" value="{{csrf_token()}}">
37+
<input type="text" class="form-control" name="username" value="{{$user->username}}" id="username" autofocus required>
4038
</div>
4139
</div>
4240
<div class="form-group">

resources/views/emails/activeUser.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<tbody>
6868
<tr style="padding:0;text-align:left;vertical-align:top">
6969
<th style="Margin:0;color:#333;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:19px;margin:0;padding:0;text-align:left">
70-
<div class="release" style="padding-top:5px;padding-left:20px;padding-bottom:20px;">
70+
<div class="release" style="padding-top:5px;padding-left:20px;padding-bottom:20px;padding-right:20px;">
7171
<p>如果您并没有访问过 {{$websiteName}} 或者没有进行上述操作,请忽略这封邮件。</p>
7272
<p>点击这里去<a href="{{$activeUserUrl}}" target="_blank">【激活账号】</a>,或者点击下面的链接(30分钟内有效)。</p>
7373
<p>

routes/web.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,16 @@
144144
});
145145

146146
// 自动提号机
147-
Route::group(['namespace' => 'Seller', 'prefix' => 'seller', 'middleware' => ['forbidden']], function () {
148-
Route::get('/', 'IndexController@index');
149-
Route::get('buy/{id}', 'IndexController@buy');
150-
Route::post('createPayment', 'IndexController@createPayment'); // 创建支付单
151-
Route::get('payment/{sn}', 'IndexController@payment'); // 支付单详情
152-
Route::post('redeemCoupon', 'IndexController@redeemCoupon'); // 检查优惠券
153-
Route::get('order', 'IndexController@order');
154-
Route::post('searchOrder', 'IndexController@searchOrder');
155-
Route::get('getPaymentStatus', 'IndexController@getPaymentStatus');
156-
Route::get('send', 'IndexController@send');
157-
Route::post('sendEmail', 'IndexController@sendEmail'); // 邮件重发
158-
Route::any('info', 'IndexController@info'); // 余量查询
147+
Route::group(['prefix' => 'seller', 'middleware' => ['forbidden']], function () {
148+
Route::get('/', 'SellerController@index');
149+
Route::get('buy/{id}', 'SellerController@buy');
150+
Route::post('createPayment', 'SellerController@createPayment'); // 创建支付单
151+
Route::get('payment/{sn}', 'SellerController@payment'); // 支付单详情
152+
Route::post('redeemCoupon', 'SellerController@redeemCoupon'); // 检查优惠券
153+
Route::get('order', 'SellerController@order');
154+
Route::post('searchOrder', 'SellerController@searchOrder');
155+
Route::get('getPaymentStatus', 'SellerController@getPaymentStatus');
156+
Route::get('send', 'SellerController@send');
157+
Route::post('sendEmail', 'SellerController@sendEmail'); // 邮件重发
158+
Route::any('info', 'SellerController@info'); // 余量查询
159159
});

sql/db.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ INSERT INTO `label` VALUES ('6', '免费体验', '0');
412412
-- ----------------------------
413413
CREATE TABLE `verify` (
414414
`id` int(11) NOT NULL AUTO_INCREMENT,
415+
`type` TINYINT NOT NULL DEFAULT '1' COMMENT '激活类型:1-自行激活、2-管理员激活',
415416
`user_id` int(11) NOT NULL COMMENT '用户ID',
416-
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',
417417
`token` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '校验token',
418418
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态:0-未使用、1-已使用、2-已失效',
419419
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
@@ -1096,7 +1096,7 @@ CREATE TABLE `user_login_log` (
10961096
`created_at` DATETIME NOT NULL,
10971097
`updated_at` DATETIME NOT NULL,
10981098
PRIMARY KEY (`id`)
1099-
) ENGINE=InnoDB COLLATE='utf8mb4_general_ci' COMMENT='用户登录日志';
1099+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户登录日志';
11001100

11011101

11021102
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

sql/update/20181021.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- 加入激活类型
2+
ALTER TABLE `verify`
3+
ADD COLUMN `type` TINYINT NOT NULL DEFAULT '1' COMMENT '激活类型:1-自行激活、2-管理员激活' AFTER `id`;
4+
5+
-- 移除无用username字段
6+
ALTER TABLE `verify`
7+
DROP COLUMN `username`;

0 commit comments

Comments
 (0)