Commit 9ff6584a authored by hj's avatar hj

更新提交

parent 1373f38b
......@@ -9,14 +9,11 @@
* with this source code in the file LICENSE.
*/
namespace App\Services;
namespace App\Services\Api;
use App\Repositories\Contracts\PlatformCustomerRepository;
use App\Rhawn\Services\RhawnCustomerService;
use App\Support\Facades\SimpleLogs;
use App\Services\CustomerService;
use App\Support\Traits\Helpers;
use http\Env\Request;
use Illuminate\Support\Facades\DB;
class AuthService
{
......@@ -35,28 +32,7 @@ class AuthService
*/
public function getToken($requestParams)
{
$platformCustomer = $this->platformCustomerRepository->findWhere([
'token' => $requestParams['customer_token']
]);
if(!$platformCustomer->toArray()){
throw new \Exception('token无效',500);
}
$platformCustomer = current($platformCustomer->toArray());
if($platformCustomer['cus_type'] == 'chemsite'){
$token['company_token'] = $requestParams['customer_token'];
$token['cus_number'] = $requestParams['cus_number'] ?? '';
}else{
$token['customer_token'] = $requestParams['customer_token'];
}
$newToken = base64_encode(implode(',', $token));
$expTimestamp = strtotime(date('Y-m-d H:i:s', strtotime('+1 day')));
$jwtToken = $this->generateToken($newToken);
return [
'token' => $jwtToken,
'ttl' => $expTimestamp
];
return app(CustomerService::class)->getToken($requestParams);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment