Browse Source
Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix
master
Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix
master
13 changed files with 143 additions and 104 deletions
-
61app/Commons/LanzuRequest.php
-
12app/Controller/v3/WithdrawController.php
-
15app/Middleware/Auth/ApiMiddleware.php
-
54app/Middleware/CorsMiddleware.php
-
10app/Model/v3/FinancialRecord.php
-
1app/Model/v3/GoodsActivity.php
-
28app/Service/v3/Implementations/CouponRecService.php
-
18app/Service/v3/Implementations/FinancialRecordService.php
-
5app/Service/v3/Implementations/GoodsActivityService.php
-
12app/Service/v3/Implementations/OrderOfflineService.php
-
2app/Service/v3/Implementations/OrderOnlineService.php
-
4app/Service/v3/Implementations/SearchService.php
-
25app/Service/v3/Interfaces/FinancialRecordServiceInterface.php
@ -1,61 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
declare(strict_types=1); |
|
||||
|
|
||||
namespace App\Commons; |
|
||||
|
|
||||
use Hyperf\HttpServer\Request; |
|
||||
use Hyperf\Utils\Context; |
|
||||
|
|
||||
class LanzuRequest extends Request |
|
||||
{ |
|
||||
// protected function getInputData(): array
|
|
||||
// {
|
|
||||
|
|
||||
// return $this->storeParsedData(function () {
|
|
||||
// $request = $this->getRequest();
|
|
||||
// if (is_array($request->getParsedBody())) {
|
|
||||
// $data = $request->getParsedBody();
|
|
||||
// } else {
|
|
||||
// $data = [];
|
|
||||
// }
|
|
||||
|
|
||||
// return array_merge($data, $request->getQueryParams());
|
|
||||
// });
|
|
||||
// }
|
|
||||
|
|
||||
protected function storeParsedData(callable $callback) |
|
||||
{ |
|
||||
if (! Context::has($this->contextkeys['parsedData'])) { |
|
||||
return Context::set($this->contextkeys['parsedData'], call($callback)); |
|
||||
} |
|
||||
|
|
||||
// var_dump(Context::get($this->contextkeys['parsedData']));
|
|
||||
|
|
||||
$preDatas = Context::get($this->contextkeys['parsedData']); |
|
||||
|
|
||||
if(isset($preDatas['market_id'])){ |
|
||||
if($preDatas['market_id']==-1){ |
|
||||
$preDatas['market_id'] = 0; |
|
||||
unset($preDatas['sign']); |
|
||||
$sign = $this->signature($preDatas); |
|
||||
$preDatas['sign'] = $sign; |
|
||||
Context::set($this->contextkeys['parsedData'],$preDatas); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return Context::get($this->contextkeys['parsedData']); |
|
||||
} |
|
||||
|
|
||||
private function signature($params) |
|
||||
{ |
|
||||
ksort($params); |
|
||||
|
|
||||
$http_query = []; |
|
||||
foreach ($params as $key => $value) { |
|
||||
$http_query[] = $key.'='.$value; |
|
||||
} |
|
||||
|
|
||||
return sha1(md5(implode('&', $http_query)).config('auth.api.sign.secret_key')); |
|
||||
} |
|
||||
} |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue