Prechádzať zdrojové kódy

红包记录的接口修改

jixionghui 4 rokov pred
rodič
commit
edc1eb20b8

+ 1 - 0
pullToRefershLibraryMy/.gitignore

@@ -0,0 +1 @@
+/build

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
skWeiChatBaidu/src/main/java/com/liaobo/im/AppConfig.java


+ 0 - 90
skWeiChatBaidu/src/main/java/com/liaobo/im/bean/redpacket/RedListItemRecive.java

@@ -1,90 +0,0 @@
-package com.liaobo.im.bean.redpacket;
-
-import java.io.Serializable;
-
-/**
- * Created by wzw on 2016/9/23.
- */
-public class RedListItemRecive implements Serializable {
-    /**
-     * id : 57e48852f9143ee31ee1f9d1
-     * time : 1474594898
-     * redId : 57e4884cf9143ee31ee1f9ce
-     * userId : 10005921
-     * money : 5.72
-     * userName : in旅行
-     */
-    private String id;
-    private int time;
-    private String redId;
-    private String userId;
-    private double money;
-    private String userName;
-    private String sendName;
-    private String sendId;
-
-    public String getSendName() {
-        return sendName;
-    }
-
-    public void setSendName(String sendName) {
-        this.sendName = sendName;
-    }
-
-    public String getSendId() {
-        return sendId;
-    }
-
-    public void setSendId(String sendId) {
-        this.sendId = sendId;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public void setTime(int time) {
-        this.time = time;
-    }
-
-    public void setRedId(String redId) {
-        this.redId = redId;
-    }
-
-    public void setUserId(String userId) {
-        this.userId = userId;
-    }
-
-    public void setMoney(double money) {
-        this.money = money;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public int getTime() {
-        return time;
-    }
-
-    public String getRedId() {
-        return redId;
-    }
-
-    public String getUserId() {
-        return userId;
-    }
-
-    public double getMoney() {
-        return money;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 140
skWeiChatBaidu/src/main/java/com/liaobo/im/bean/redpacket/RedListItemSend.java


+ 50 - 0
skWeiChatBaidu/src/main/java/com/liaobo/im/bean/redpacket/RedPacket.java

@@ -47,6 +47,56 @@ public class RedPacket implements Serializable {
     @JSONField(name = "userName")
     private String userName;
 
+    @JSONField(name = "receivedRemark")
+    private String receivedRemark;
+    @JSONField(name = "roomJid")
+    private String roomJid;
+    @JSONField(name = "toUserId")
+    private String toUserId;
+    @JSONField(name = "userRedType")
+    private int userRedType;
+    @JSONField(name = "assignUserId")
+    private String assignUserId;
+
+    public String getReceivedRemark() {
+        return receivedRemark;
+    }
+
+    public void setReceivedRemark(String receivedRemark) {
+        this.receivedRemark = receivedRemark;
+    }
+
+    public String getRoomJid() {
+        return roomJid;
+    }
+
+    public void setRoomJid(String roomJid) {
+        this.roomJid = roomJid;
+    }
+
+    public String getToUserId() {
+        return toUserId;
+    }
+
+    public void setToUserId(String toUserId) {
+        this.toUserId = toUserId;
+    }
+
+    public int getUserRedType() {
+        return userRedType;
+    }
+
+    public void setUserRedType(int userRedType) {
+        this.userRedType = userRedType;
+    }
+
+    public String getAssignUserId() {
+        return assignUserId;
+    }
+
+    public void setAssignUserId(String assignUserId) {
+        this.assignUserId = assignUserId;
+    }
 
     public int getCount() {
         return count;

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 141 - 0
skWeiChatBaidu/src/main/java/com/liaobo/im/bean/redpacket/RedPacketReceviceBean.java


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 218 - 0
skWeiChatBaidu/src/main/java/com/liaobo/im/bean/redpacket/RedPacketSendBean.java


+ 39 - 24
skWeiChatBaidu/src/main/java/com/liaobo/im/ui/me/redpacket/RedListActivity.java

@@ -12,14 +12,16 @@ import android.widget.TextView;
 import com.handmark.pulltorefresh.library.PullToRefreshBase;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
 import com.liaobo.im.R;
-import com.liaobo.im.bean.redpacket.RedListItemRecive;
-import com.liaobo.im.bean.redpacket.RedListItemSend;
+import com.liaobo.im.bean.redpacket.RedPacketReceviceBean;
+import com.liaobo.im.bean.redpacket.RedPacketSendBean;
 import com.liaobo.im.db.InternationalizationHelper;
 import com.liaobo.im.ui.base.BaseActivity;
 import com.liaobo.im.ui.smarttab.SmartTabLayout;
 import com.liaobo.im.xuan.xuanhttplibrary.okhttp.HttpUtils;
+import com.liaobo.im.xuan.xuanhttplibrary.okhttp.callback.BaseCallback;
 import com.liaobo.im.xuan.xuanhttplibrary.okhttp.callback.ListCallback;
 import com.liaobo.im.xuan.xuanhttplibrary.okhttp.result.ArrayResult;
+import com.liaobo.im.xuan.xuanhttplibrary.okhttp.result.ObjectResult;
 
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
@@ -47,8 +49,8 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
     private PullToRefreshListView pullToRefreshListViewRedrecive;
     private PullToRefreshListView pullToRefreshListViewRedsend;
     // 数据集合
-    private List<RedListItemSend> sendRedList;
-    private List<RedListItemRecive> reciveRedList;
+    private RedPacketSendBean redSendBean;
+    private RedPacketReceviceBean mRedPacketReceviceBean;
     // 表示发出的还是接受的红包list  0代表收到  1代表发出
     private int adapterType;
     // 两个listview数据加载的页数
@@ -80,8 +82,8 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
         mTitleList = new ArrayList<String>();
         views = new ArrayList<View>();
 
-        sendRedList = new ArrayList<RedListItemSend>();
-        reciveRedList = new ArrayList<RedListItemRecive>();
+        redSendBean = new RedPacketSendBean();
+        mRedPacketReceviceBean = new RedPacketReceviceBean();
         //        mTitleList.add("收到的红包");
         //        mTitleList.add("发出的红包");
         mTitleList.add(InternationalizationHelper.getString("PACKETS_RECEIVED"));
@@ -148,16 +150,21 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
         params.put("access_token", coreManager.getSelfStatus().accessToken);
         params.put("pageIndex", pageIndexSend + "");
         params.put("pageSize", 25 + "");
+        params.put("secret","");
 
         HttpUtils.get().url(coreManager.getConfig().SEND_REDPACKET_LIST_GET)
                 .params(params)
                 .build()
-                .execute(new ListCallback<RedListItemSend>(RedListItemSend.class) {
+                .execute(new BaseCallback<RedPacketSendBean>(RedPacketSendBean.class) {
+
                     @Override
-                    public void onResponse(ArrayResult<RedListItemSend> result) {
-                        if (result.getData().size() > 0) {
-                            for (RedListItemSend redListItemSend : result.getData()) {
-                                sendRedList.add(redListItemSend);
+                    public void onResponse(ObjectResult<RedPacketSendBean> result) {
+                        if (result!=null && result.getData()!=null && result.getData().getList()!=null && result.getData().getList().size() > 0) {
+                            if (redSendBean.getList()==null){
+                                redSendBean.setList(new ArrayList<>());
+                            }
+                            for (RedPacketSendBean.RedSendRedItemEntry item : result.getData().getList()) {
+                                redSendBean.getList().add(item);
                             }
                             redListItemAdapter.notifyDataSetChanged();
                             pageIndexSend++;
@@ -167,6 +174,7 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
 
                     @Override
                     public void onError(Call call, Exception e) {
+
                     }
                 });
     }
@@ -180,12 +188,17 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
         HttpUtils.get().url(coreManager.getConfig().RECIVE_REDPACKET_LIST_GET)
                 .params(params)
                 .build()
-                .execute(new ListCallback<RedListItemRecive>(RedListItemRecive.class) {
+                .execute(new BaseCallback<RedPacketReceviceBean>(RedPacketReceviceBean.class) {
+
                     @Override
-                    public void onResponse(ArrayResult<RedListItemRecive> result) {
-                        if (result.getData().size() > 0) {
-                            for (RedListItemRecive redListItemRecive : result.getData()) {
-                                reciveRedList.add(redListItemRecive);
+                    public void onResponse(ObjectResult<RedPacketReceviceBean> result) {
+
+                        if (mRedPacketReceviceBean.getList()==null){
+                            mRedPacketReceviceBean.setList(new ArrayList<>());
+                        }
+                        if (result!=null && result.getData()!=null&& result.getData().getList()!=null && result.getData().getList().size() > 0) {
+                            for (RedPacketReceviceBean.RedPacketReceviceItemEntity  itemEntity : result.getData().getList()) {
+                                mRedPacketReceviceBean.getList().add(itemEntity);
                             }
                             redListItemAdapter.notifyDataSetChanged();
                             getPageIndexRecive++;
@@ -261,9 +274,11 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
         public int getCount() {
 
             if (adapterType == 0) {
-                return reciveRedList.size();
+                if (mRedPacketReceviceBean.getList()==null) return 0;
+                return mRedPacketReceviceBean.getList().size();
             } else {
-                return sendRedList.size();
+                if (redSendBean.getList()==null) return 0;
+                return redSendBean.getList().size();
             }
         }
 
@@ -294,14 +309,14 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
             }
 
             if (adapterType == 0) {
-                long lcc_time = Long.valueOf(reciveRedList.get(position).getTime());
+                long lcc_time = mRedPacketReceviceBean.getList().get(position).getTime();
                 String StrTime = sdf.format(new Date(lcc_time * 1000L));
-                redViewHolder.userNameTv.setText(reciveRedList.get(position).getSendName());
+                redViewHolder.userNameTv.setText(mRedPacketReceviceBean.getList().get(position).getSendName());
                 redViewHolder.timeTv.setText(StrTime);
-                redViewHolder.moneyTv.setText(df.format(reciveRedList.get(position).getMoney()) + InternationalizationHelper.getString("YUAN"));
+                redViewHolder.moneyTv.setText(df.format(mRedPacketReceviceBean.getList().get(position).getMoney()) + InternationalizationHelper.getString("YUAN"));
             } else if (adapterType == 1) {
 
-                switch (sendRedList.get(position).getType()) {
+                switch (redSendBean.getList().get(position).getType()) {
                     case 1: {
                         //                        redViewHolder.userNameTv.setText("普通红包");
                         redViewHolder.userNameTv.setText(InternationalizationHelper.getString("JX_UsualGift"));
@@ -320,10 +335,10 @@ public class RedListActivity extends BaseActivity implements View.OnClickListene
                     }
                     break;
                 }
-                long lcc_time = Long.valueOf(sendRedList.get(position).getSendTime());
+                long lcc_time = (long) redSendBean.getList().get(position).getSendTime();
                 String StrTime = sdf.format(new Date(lcc_time * 1000L));
                 redViewHolder.timeTv.setText(StrTime);
-                redViewHolder.moneyTv.setText(df.format(sendRedList.get(position).getMoney()) + InternationalizationHelper.getString("YUAN"));
+                redViewHolder.moneyTv.setText(df.format(redSendBean.getList().get(position).getMoney()) + InternationalizationHelper.getString("YUAN"));
             }
             return convertView;
         }

+ 9 - 1
skWeiChatBaidu/src/main/java/com/liaobo/im/ui/message/MucChatActivity.java

@@ -1548,7 +1548,7 @@ public class MucChatActivity extends BaseActivity implements
      * @param count 数量
      * @param words 祝福语(或者口令)
      */
-    public void sendRed(String type, String money, String count, String words, String payPassword) {
+    public void sendRed(String type, String money, String count, String words, String payPassword,String assignUserId,String secret) {
         /**
          * 步骤
          * 1.调发红包的接口,发送一个红包
@@ -1557,6 +1557,12 @@ public class MucChatActivity extends BaseActivity implements
         Map<String, String> params = new HashMap<>();
         params.put("access_token", coreManager.getSelfStatus().accessToken);
         params.put("type", type);
+        if (type.equals("4")){
+            params.put("assignUserId", assignUserId);
+        }
+        if ("3".equals(type)){
+            params.put("secret", secret);
+        }
         params.put("moneyStr", money);
         params.put("count", count);
         params.put("greetings", words);
@@ -1988,6 +1994,8 @@ public class MucChatActivity extends BaseActivity implements
                                 , bundle.getString("count")
                                 , bundle.getString("words")
                                 , bundle.getString("payPassword")
+                                , bundle.getString("assignUserId")
+                                , bundle.getString("secret")
                         );
                     }
                     break;