Skip to content

Commit

Permalink
修复#27 文件上传问题
Browse files Browse the repository at this point in the history
  • Loading branch information
justmd5 committed Aug 7, 2023
1 parent 925cce2 commit 76a6a2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class Api extends AbstractAPI
{
const URL = 'https://gw-api.pinduoduo.com/api/router';
const UPLOAD_URL = 'https://gw-upload.pinduoduo.com/api/upload';

/**
* @var pinduoduo
Expand Down Expand Up @@ -78,12 +79,12 @@ public function request(string $type, array $params = [], string $data_type = 'J
$params['timestamp'] = strval(time());
$params['sign'] = $this->signature($params);
$method = 'post';
$data = [self::URL];
$data = [static::URL];
//文件上传兼容
if (!empty($params['file'])) {
$data=[static::UPLOAD_URL];
$method = 'upload';
array_push($data, [], ['file' => $params['file']]);
unset($params['file']);
}
$data[] = $params;
$response = call_user_func_array([$http, $method], $data);
Expand Down

0 comments on commit 76a6a2b

Please sign in to comment.