|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace app\common\library;
|
|
|
|
|
|
+use app\common\model\CompanyStaff;
|
|
|
use app\common\model\Company as User;
|
|
|
use app\common\model\UserRule;
|
|
|
use fast\Random;
|
|
@@ -300,10 +301,10 @@ class Authcompany
|
|
|
* @param string $password 密码
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- /*public function login($account, $password)
|
|
|
+ public function login($account, $password)
|
|
|
{
|
|
|
- $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username');
|
|
|
- $user = User::get([$field => $account]);
|
|
|
+ $field = 'mobile';
|
|
|
+ $user = CompanyStaff::get([$field => $account]);
|
|
|
if (!$user) {
|
|
|
$this->setError('Account is incorrect');
|
|
|
return false;
|
|
@@ -319,8 +320,9 @@ class Authcompany
|
|
|
}
|
|
|
|
|
|
//直接登录会员
|
|
|
- return $this->direct($user->id);
|
|
|
- }*/
|
|
|
+ return $this->direct($user->company_id,$user);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 退出
|
|
@@ -384,7 +386,7 @@ class Authcompany
|
|
|
* @param int $user_id
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public function direct($user_id)
|
|
|
+ public function direct($user_id,$staff)
|
|
|
{
|
|
|
$user = User::get($user_id);
|
|
|
if ($user) {
|
|
@@ -409,6 +411,8 @@ class Authcompany
|
|
|
|
|
|
$user->save();*/
|
|
|
|
|
|
+ $user->staff = $staff;// 追加员工
|
|
|
+
|
|
|
$this->_user = $user;
|
|
|
|
|
|
$this->_token = Random::uuid();
|