|
13 | 13 | public abstract class MinishopUploadRequestCustomizeExecutor<H, P> implements RequestExecutor<WxMinishopImageUploadCustomizeResult, File> {
|
14 | 14 | protected RequestHttp<H, P> requestHttp;
|
15 | 15 | protected String respType;
|
| 16 | + protected String uploadType; |
| 17 | + protected String imgUrl; |
16 | 18 |
|
17 |
| - public MinishopUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType) { |
| 19 | + public MinishopUploadRequestCustomizeExecutor(RequestHttp requestHttp, String respType, String imgUrl) { |
18 | 20 | this.requestHttp = requestHttp;
|
19 | 21 | this.respType = respType;
|
| 22 | + if (imgUrl == null || imgUrl.isEmpty()) { |
| 23 | + this.uploadType = "0"; |
| 24 | + } |
| 25 | + else { |
| 26 | + this.uploadType = "1"; |
| 27 | + this.imgUrl = imgUrl; |
| 28 | + } |
20 | 29 | }
|
21 | 30 |
|
22 | 31 | @Override
|
23 | 32 | public void execute(String uri, File data, ResponseHandler<WxMinishopImageUploadCustomizeResult> handler, WxType wxType) throws WxErrorException, IOException {
|
24 | 33 | handler.handle(this.execute(uri, data, wxType));
|
25 | 34 | }
|
26 | 35 |
|
27 |
| - public static RequestExecutor<WxMinishopImageUploadCustomizeResult, File> create(RequestHttp requestHttp, String respType) { |
| 36 | + public static RequestExecutor<WxMinishopImageUploadCustomizeResult, File> create(RequestHttp requestHttp, String respType, String imgUrl) { |
28 | 37 | switch (requestHttp.getRequestType()) {
|
29 | 38 | case APACHE_HTTP:
|
30 |
| - return new ApacheMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType); |
| 39 | + return new ApacheMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl); |
31 | 40 | case JODD_HTTP:
|
32 |
| - return new JoddHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType); |
| 41 | + return new JoddHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl); |
33 | 42 | case OK_HTTP:
|
34 |
| - return new OkHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType); |
| 43 | + return new OkHttpMinishopMediaUploadRequestCustomizeExecutor(requestHttp, respType, imgUrl); |
35 | 44 | default:
|
36 | 45 | return null;
|
37 | 46 | }
|
|
0 commit comments