Merge commit '4da9ea5dd5210674ccc3d20d470d337857182474' into develop

* commit '4da9ea5dd5210674ccc3d20d470d337857182474':
  增加临时文件目录配置
  增加忽略eclipse本地配置文件目录
  fix README
This commit is contained in:
ukid
2015-06-17 13:10:10 +08:00
9 changed files with 111 additions and 30 deletions

View File

@ -1,5 +1,7 @@
package me.chanjar.weixin.mp.api;
import java.io.File;
import me.chanjar.weixin.common.bean.WxAccessToken;
/**
@ -68,7 +70,8 @@ public interface WxMpConfigStorage {
public String getHttp_proxy_username();
public String getHttp_proxy_password();
public File getTmpDirFile();
}

View File

@ -1,5 +1,7 @@
package me.chanjar.weixin.mp.api;
import java.io.File;
import me.chanjar.weixin.common.bean.WxAccessToken;
/**
@ -11,8 +13,8 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
protected volatile String appId;
protected volatile String secret;
protected volatile String partnerId;
protected volatile String partnerKey;
protected volatile String partnerId;
protected volatile String partnerKey;
protected volatile String token;
protected volatile String accessToken;
protected volatile String aesKey;
@ -28,6 +30,11 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
protected volatile String jsapiTicket;
protected volatile long jsapiTicketExpiresTime;
/**
* 临时文件目录
*/
protected volatile File tmpDirFile;
public String getAccessToken() {
return this.accessToken;
}
@ -181,6 +188,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
", http_proxy_password='" + http_proxy_password + '\'' +
", jsapiTicket='" + jsapiTicket + '\'' +
", jsapiTicketExpiresTime='" + jsapiTicketExpiresTime + '\'' +
", tmpDirFile='" + tmpDirFile + '\'' +
'}';
}
@ -201,4 +209,9 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
public void setPartnerKey(String partnerKey) {
this.partnerKey = partnerKey;
}
@Override
public File getTmpDirFile() {
return this.getTmpDirFile();
}
}

View File

@ -7,6 +7,7 @@ import com.google.gson.internal.Streams;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.bean.WxMenu;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
@ -27,6 +28,7 @@ import me.chanjar.weixin.mp.bean.*;
import me.chanjar.weixin.mp.bean.result.*;
import me.chanjar.weixin.mp.util.http.QrCodeRequestExecutor;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import org.apache.http.Consts;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
@ -214,7 +216,7 @@ public class WxMpServiceImpl implements WxMpService {
public File mediaDownload(String media_id) throws WxErrorException {
String url = "http://file.api.weixin.qq.com/cgi-bin/media/get";
return execute(new MediaDownloadRequestExecutor(), url, "media_id=" + media_id);
return execute(new MediaDownloadRequestExecutor(wxMpConfigStorage.getTmpDirFile()), url, "media_id=" + media_id);
}
public WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException {