|
|
@@ -1,5 +1,7 @@
|
|
|
package com.miekir.eden.ui.home.coupon;
|
|
|
|
|
|
+import android.text.TextUtils;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.miekir.eden.base.ApiService;
|
|
|
@@ -40,6 +42,7 @@ public class TemplatePresenter extends BasePresenter<ITemplateView<String>> {
|
|
|
if (EdenManager.getInstance().isKwyPhotoReady()) {
|
|
|
RetrofitHelper.getInstance().getRequestApi(KwyAPI.class, KwyAPI.KWY_BASE)
|
|
|
.getKwyPhotoList()
|
|
|
+
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new Observer<BaseKwyBean>() {
|
|
|
@@ -59,7 +62,7 @@ public class TemplatePresenter extends BasePresenter<ITemplateView<String>> {
|
|
|
List<EncryptKwyPhotoBean> photoBeanList = JSON.parseObject(detailJson, new TypeReference<List<EncryptKwyPhotoBean>>() {});
|
|
|
if (photoBeanList != null && photoBeanList.size() > 0) {
|
|
|
for (EncryptKwyPhotoBean bean : photoBeanList) {
|
|
|
- photoList.addAll(bean.getFiles());
|
|
|
+ photoList.addAll(getValidPhotoUrl(bean.getFiles()));
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -107,6 +110,25 @@ public class TemplatePresenter extends BasePresenter<ITemplateView<String>> {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 去除无用的图片后缀
|
|
|
+ * @param rawPhotoUrlList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<String> getValidPhotoUrl(List<String> rawPhotoUrlList) {
|
|
|
+ if (rawPhotoUrlList == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> validUrlList = new ArrayList<>();
|
|
|
+ for (String rawUrl : rawPhotoUrlList) {
|
|
|
+ if (!TextUtils.isEmpty(rawUrl)) {
|
|
|
+ validUrlList.add(rawUrl.replaceAll("\\?v=2", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return validUrlList;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void deleteCouponById(int position, long couponId) {
|
|
|
RetrofitHelper.getInstance()
|