24
24
class Customer extends Service
25
25
{
26
26
public $ customer_register ;
27
+
27
28
const USER_LOGIN_SUCCESS_REDIRECT_URL_KEY = 'usr_login_success_redirect_url ' ;
28
29
29
30
protected $ _customerModelName = '\fecshop\models\mysqldb\Customer ' ;
31
+
30
32
protected $ _customerModel ;
33
+
31
34
protected $ _customerLoginModelName = '\fecshop\models\mysqldb\customer\CustomerLogin ' ;
35
+
32
36
protected $ _customerLoginModel ;
37
+
33
38
protected $ _customerRegisterModelName = '\fecshop\models\mysqldb\customer\CustomerRegister ' ;
39
+
34
40
protected $ _customerRegisterModel ;
35
41
36
42
public function init ()
@@ -45,6 +51,7 @@ public function init()
45
51
list ($ this ->_customerLoginModelName , $ this ->_customerLoginModel ) = \Yii::mapGet ($ this ->_customerLoginModelName );
46
52
list ($ this ->_customerRegisterModelName , $ this ->_customerRegisterModel ) = \Yii::mapGet ($ this ->_customerRegisterModelName );
47
53
}
54
+
48
55
/**
49
56
* 注册用户名字的最小长度.
50
57
*/
@@ -147,6 +154,7 @@ protected function actionRegister($param)
147
154
}
148
155
return false ;
149
156
}
157
+
150
158
/**
151
159
* @property $email | String , email字符串
152
160
* 查看该email是否被注册过。
@@ -160,6 +168,7 @@ protected function actionIsRegistered($email)
160
168
return false ;
161
169
}
162
170
}
171
+
163
172
/**
164
173
* @property $param | array ,用户的数组
165
174
* 数据格式如下:
@@ -237,6 +246,7 @@ protected function actionGetModelName()
237
246
238
247
return get_class ($ model );
239
248
}
249
+
240
250
/**
241
251
* 通过主键,得到customer model
242
252
*/
@@ -372,6 +382,7 @@ protected function actionGetLoginSuccessRedirectUrl()
372
382
373
383
return $ url ? $ url : '' ;
374
384
}
385
+
375
386
/**
376
387
* @property $urlKey | String
377
388
* **注意**:该方法不能在接口类型里面使用
@@ -412,13 +423,15 @@ protected function actionGetStatusActive()
412
423
$ model = $ this ->_customerModel ;
413
424
return $ model ::STATUS_ACTIVE ;
414
425
}
426
+
415
427
/**
416
428
* 得到customer 表的主键(mysql表)
417
429
*/
418
430
protected function actionGetPrimaryKey ()
419
431
{
420
432
return 'id ' ;
421
433
}
434
+
422
435
/**
423
436
* @property $filter|array
424
437
* get collection by $filter
@@ -447,7 +460,6 @@ protected function actionColl($filter = '')
447
460
];
448
461
}
449
462
450
-
451
463
/**
452
464
* @property $id | String 主键值
453
465
* 通过主键值找到分类,并且删除分类在url rewrite表中的记录
@@ -497,6 +509,7 @@ protected function actionGetEmailByIds($user_ids)
497
509
}
498
510
499
511
//2. 创建第三方用户的账户,密码自动生成
512
+
500
513
/**
501
514
* @property $user | Array ,example:
502
515
* ['first_name' => $first_name,'last_name' => $last_name,'email' => $email,]
@@ -555,6 +568,7 @@ protected function getRandomPassword()
555
568
//return $authnum;
556
569
return $ authnum ;
557
570
}
571
+
558
572
/** AppServer 部分使用的函数
559
573
* @property $email | String
560
574
* @property $password | String
@@ -596,6 +610,7 @@ protected function actionLoginAndGetAccessToken($email, $password)
596
610
return $ identity ->access_token ;
597
611
}
598
612
}
613
+
599
614
/** AppServer 部分使用的函数
600
615
* @property $type | null or Object
601
616
* 从request headers中获取access-token,然后执行登录
@@ -631,6 +646,7 @@ protected function actionLoginByAccessToken($type = null)
631
646
}
632
647
}
633
648
}
649
+
634
650
/**
635
651
* 通过accessToek的方式,进行登出从操作。
636
652
*/
@@ -649,7 +665,6 @@ public function logoutByAccessToken()
649
665
650
666
return $ userComponent ->getIsGuest ();
651
667
}
652
-
653
668
654
669
protected function actionSetHeaderAccessToken ($ accessToken )
655
670
{
0 commit comments