master
elf 1 year ago
parent 691c1cfdeb
commit 5e5f1e8722

@ -10,6 +10,7 @@ use App\Model\App;
use App\Service\AppService;
use App\Service\MerchantService;
use App\Service\PaymentService;
use App\Service\RequestService;
use App\Service\UserService;
use Hyperf\Command\Annotation\Command;
use Hyperf\Command\Command as HyperfCommand;
@ -42,7 +43,7 @@ class MineCommand extends HyperfCommand
public function handle(): void
{
$this->payment();
$this->getRequestLog();
}
protected function generateToken() {
@ -194,4 +195,16 @@ class MineCommand extends HyperfCommand
$result = $userService->pwdModify(['userId' => 'ELF1990'], $this->getApp(), $this->getToken());
var_dump($result);
}
public function getRequestLog()
{
/**
* @var RequestService $requestService
*/
$requestService = $this->container->make(RequestService::class);
$requestLog = $requestService->getRequestLogByToken('21a640fdfc8dad25ad44512b22da9324');
$userId = $requestLog->getDataValue('userId');
var_dump($userId);
}
}

@ -8,6 +8,10 @@ class RequestLog extends Model
{
protected $table = 'request_logs';
protected $casts = [
'request_data' => 'array',
];
public function generateToken() {
return md5($this->app_id . '_' . $this->request_id);
}
@ -18,7 +22,7 @@ class RequestLog extends Model
}
public function getData() {
$data = $this->request_data['data'] ?: null;
$data = $this->request_data['data'] ?? null;
if ($data) {
return json_decode($data, true);
}

@ -26,7 +26,7 @@ class RequestService extends AbstractService
$requestLog->request_id = StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_REQUEST_ID);
$requestLog->request_token = $requestLog->generateToken();
$requestLog->request_uri = $requestUri;
$requestLog->request_data = json_encode($params, JSON_UNESCAPED_UNICODE);
$requestLog->request_data = $params;
$requestLog->request_time = date('Y-m-d H:i:s');
$requestLog->save();
return $requestLog;

Loading…
Cancel
Save