"用户交易记录"

master
fangshicai 3 years ago
parent 1e377bef39
commit f39ffdb47b

@ -24,6 +24,7 @@
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/baseline_shopping_cart_24.xml" value="0.1345" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/baseline_shopping_cart_24.xml" value="0.1345" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/btn_shape_o.xml" value="0.136" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/btn_shape_o.xml" value="0.136" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/custom_rc_divider.xml" value="0.1" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/custom_rc_divider.xml" value="0.1" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/edittext_shape2.xml" value="0.1285" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_baseline_close_24.xml" value="0.1345" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_baseline_close_24.xml" value="0.1345" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1345" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1345" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_lock_outline_black_24dp.xml" value="0.1345" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/drawable/ic_lock_outline_black_24dp.xml" value="0.1345" />
@ -38,6 +39,7 @@
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_home_page.xml" value="0.2" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_home_page.xml" value="0.2" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_login.xml" value="0.176" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_login.xml" value="0.176" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_main.xml" value="0.264" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/activity_main.xml" value="0.264" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/edittext_shape1.xml" value="0.11770833333333333" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_goods_type.xml" value="0.15208333333333332" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_goods_type.xml" value="0.15208333333333332" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_home_page.xml" value="0.12" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_home_page.xml" value="0.12" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_message_page.xml" value="0.16799999999999998" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/fragment_message_page.xml" value="0.16799999999999998" />
@ -52,6 +54,8 @@
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/item_delivery_select.xml" value="0.1" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/item_delivery_select.xml" value="0.1" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/item_stagger.xml" value="0.264" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/item_stagger.xml" value="0.264" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/list_good_stype_item.xml" value="0.2" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/list_good_stype_item.xml" value="0.2" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/recycleview_message_item.xml" value="0.2" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/recycleview_mine_item.xml" value="0.152" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/third_fragment.xml" value="0.264" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/layout/third_fragment.xml" value="0.264" />
<entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/menu/bottom_navigation_menu.xml" value="0.176" /> <entry key="..\:/andriod/Android_Couser_Design/app/src/main/res/menu/bottom_navigation_menu.xml" value="0.176" />
<entry key="..\:/java/maven/apache-maven-3.3.9/repo/caches/transforms-3/ac7bf89d8f42b5a2421be3e38df6e03b/transformed/pictureselector-v3.10.2/res/drawable/ps_image_placeholder.xml" value="0.1285" /> <entry key="..\:/java/maven/apache-maven-3.3.9/repo/caches/transforms-3/ac7bf89d8f42b5a2421be3e38df6e03b/transformed/pictureselector-v3.10.2/res/drawable/ps_image_placeholder.xml" value="0.1285" />

@ -8,7 +8,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.android.activity.fragment.GoodsTypeFragment; import com.android.activity.fragment.GoodShowFragment;
import com.android.bean.Good; import com.android.bean.Good;
import com.android.bean.GoodsType; import com.android.bean.GoodsType;

@ -28,7 +28,6 @@ import java.util.List;
public class StaggerAdapter extends RecyclerView.Adapter<StaggerAdapter.InnerHolder> { public class StaggerAdapter extends RecyclerView.Adapter<StaggerAdapter.InnerHolder> {
protected final ArrayList<Good> mData; protected final ArrayList<Good> mData;
private RecyclerView mList;
Context context; Context context;
private OnItemClickListener mOnItemClickListener; private OnItemClickListener mOnItemClickListener;

@ -0,0 +1,73 @@
package com.android.activity.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.android.R;
import com.android.bean.BaseRecords;
import com.android.bean.queryBean.UserGoodsRecords;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class UserRecordsAdapter extends RecyclerView.Adapter<UserRecordsAdapter.UserRecordsAdapterHolder> {
private Context context;
private BaseRecords<UserGoodsRecords> recordsData;
private Long userId;
public UserRecordsAdapter(Context context, BaseRecords<UserGoodsRecords> recordsData,Long userId) {
this.context = context;
this.recordsData = recordsData;
this.userId = userId;
}
@NonNull
@Override
public UserRecordsAdapterHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).
inflate(R.layout.recycleview_message_item, parent, false);
return new UserRecordsAdapterHolder(view);
}
@Override
public void onBindViewHolder(@NonNull UserRecordsAdapterHolder holder, int position) {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy 年 MM 月 dd 日 HH 时 mm 分 ss 秒");
String sd = sdf.format(new Date(Long.parseLong(String.valueOf(recordsData.getRecords().get(position).getCreateTime())))); // 时间戳转换成时间
if (recordsData.getRecords().get(position).getSellerId() == userId){
holder.getTvName().setText("当前用户发布了:"+recordsData.getRecords().get(position).getGoodsDescription()+" "+sd);
}else {
holder.getTvName().setText("当前用户购买了: "+recordsData.getRecords().get(position).getGoodsDescription()+" "+sd);
}
}
@Override
public int getItemCount() {
return recordsData.getSize();
}
public class UserRecordsAdapterHolder extends RecyclerView.ViewHolder {
private TextView tvName;
public UserRecordsAdapterHolder(@NonNull View itemView) {
super(itemView);
tvName = itemView.findViewById(R.id.tv_message_item_desc);
}
public TextView getTvName() {
return tvName;
}
public void setTvName(TextView tvName) {
this.tvName = tvName;
}
}
}

@ -33,12 +33,8 @@ import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* A simple {@link Fragment} subclass. public class GoodShowFragment extends Fragment {
* Use the {@link GoodsTypeFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class GoodsTypeFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match // TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
@ -54,14 +50,14 @@ public class GoodsTypeFragment extends Fragment {
private Integer mParam1; private Integer mParam1;
public GoodsTypeFragment() { public GoodShowFragment() {
// Required empty public constructor // Required empty public constructor
} }
// TODO: Rename and change types and number of parameters // TODO: Rename and change types and number of parameters
public static GoodsTypeFragment newInstance(Integer param1,List<Good> goodsList) { public static GoodShowFragment newInstance(Integer param1,List<Good> goodsList) {
GoodsTypeFragment fragment = new GoodsTypeFragment(); GoodShowFragment fragment = new GoodShowFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putInt(ARG_TEXT, param1); args.putInt(ARG_TEXT, param1);
args.putSerializable(ARG_GOODS, (Serializable) goodsList); args.putSerializable(ARG_GOODS, (Serializable) goodsList);
@ -123,7 +119,6 @@ public class GoodsTypeFragment extends Fragment {
@Override @Override
public void onItemClick(int position) { public void onItemClick(int position) {
//监听的各种操作写在这里 //监听的各种操作写在这里
Toast.makeText(getActivity(), "我点击了第"+position+"item", Toast.LENGTH_SHORT).show();
Good goods = typeGoodList.get(position); Good goods = typeGoodList.get(position);
//Eventbus发生事件 //Eventbus发生事件

@ -17,11 +17,13 @@ import android.widget.Button;
import com.android.R; import com.android.R;
import com.android.activity.adapter.GoodsTypeFSAdapter; import com.android.activity.adapter.GoodsTypeFSAdapter;
import com.android.bean.BaseRecords;
import com.android.bean.Good; import com.android.bean.Good;
import com.android.bean.GoodRecords; import com.android.bean.GoodRecords;
import com.android.bean.GoodsType; import com.android.bean.GoodsType;
import com.android.bean.ResponseData; import com.android.bean.ResponseData;
import com.android.bean.User; import com.android.bean.User;
import com.android.bean.queryBean.UserGoodsRecords;
import com.android.model.goods.GoodsListener; import com.android.model.goods.GoodsListener;
import com.android.model.goods.GoodsModelimpl; import com.android.model.goods.GoodsModelimpl;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
@ -32,7 +34,9 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
@ -91,15 +95,17 @@ public class HomePageFragment extends Fragment implements View.OnClickListener,
goodsModelimpl = new GoodsModelimpl(); goodsModelimpl = new GoodsModelimpl();
} }
goodsModelimpl.getAllGood(this); Map<String, Object> map = new HashMap<>();
goodsModelimpl.getAllGoodsType(this); goodsModelimpl.getAllGoodsType(this);
new Handler().postDelayed(new Runnable() { //发送获取用户交易记录
@Override goodsModelimpl.getUserRecords(user.getId(),map,this);
public void run() { // new Handler().postDelayed(new Runnable() {
initRecyclerview(); // @Override
// public void run() {
} // initRecyclerview();
},2000); //
// }
// },2000);
} }
@ -109,24 +115,30 @@ public class HomePageFragment extends Fragment implements View.OnClickListener,
@Override @Override
public void onGetAllGoodsType(ResponseData<List<GoodsType>> responseData) { public void onGetAllGoodsType(ResponseData<List<GoodsType>> responseData) {
this.goodsTypeList = responseData.getData(); this.goodsTypeList = responseData.getData();
goodsModelimpl.getAllGood(this);
} }
//获取商品成功回调 //获取商品成功回调
@Override @Override
public void onGetAllGoodSuccess(ResponseData<GoodRecords> responseData) { public void onGetAllGoodSuccess(ResponseData<GoodRecords> responseData) {
this.goodList = responseData.getData().getRecords(); this.goodList = responseData.getData().getRecords();
initRecyclerview();
Log.e("goodList",goodList.get(1).getUsername()); Log.e("goodList",goodList.get(1).getUsername());
} }
//获取用户交易记录
@Override
public void onGetUserRecordsSuccess(ResponseData<BaseRecords<UserGoodsRecords>> responseData) {
//通过EventBus传输用户的交易记录
EventBus.getDefault().postSticky(responseData.getData());
}
private void initRecyclerview() { private void initRecyclerview() {
viewPager = rootView.findViewById(R.id.view_pager); viewPager = rootView.findViewById(R.id.view_pager);
ArrayList<Fragment> fragments = new ArrayList<>(); ArrayList<Fragment> fragments = new ArrayList<>();
for (int i = 0; i < goodsTypeList.size(); i++) { for (int i = 0; i < goodsTypeList.size(); i++) {
fragments.add(GoodShowFragment.newInstance(goodsTypeList.get(i).getId(), goodList));
fragments.add(GoodsTypeFragment.newInstance(goodsTypeList.get(i).getId(), goodList));
} }
goodsTypeFSAdapter = new GoodsTypeFSAdapter(getActivity().getSupportFragmentManager(), getLifecycle(),fragments); goodsTypeFSAdapter = new GoodsTypeFSAdapter(getActivity().getSupportFragmentManager(), getLifecycle(),fragments);

@ -3,47 +3,48 @@ package com.android.activity.fragment;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.android.R; import com.android.R;
import com.android.activity.adapter.UserRecordsAdapter;
import com.android.bean.BaseRecords;
import com.android.bean.ResponseData;
import com.android.bean.User;
import com.android.bean.queryBean.UserGoodsRecords;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
* Use the {@link MessagePageFragment#newInstance} factory method to * Use the {@link MessagePageFragment#newInstance} factory method to
* create an instance of this fragment. * create an instance of this fragment.
*/ */
public class MessagePageFragment extends Fragment { public class MessagePageFragment extends Fragment{
// TODO: Rename parameter arguments, choose names that match BaseRecords<UserGoodsRecords> recordsData;
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private View view;
private static final String ARG_PARAM1 = "param1"; private RecyclerView recyclerView;
private static final String ARG_PARAM2 = "param2"; private UserRecordsAdapter userRecordsAdapter;
private User user;
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public MessagePageFragment() { public MessagePageFragment() {
// Required empty public constructor // Required empty public constructor
} }
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MessagePageFragment.
*/
// TODO: Rename and change types and number of parameters
public static MessagePageFragment newInstance(String param1, String param2) { public static MessagePageFragment newInstance(String param1, String param2) {
MessagePageFragment fragment = new MessagePageFragment(); MessagePageFragment fragment = new MessagePageFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
@ -51,16 +52,51 @@ public class MessagePageFragment extends Fragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getArguments() != null) { EventBus.getDefault().register(this);
mParam1 = getArguments().getString(ARG_PARAM1); }
mParam2 = getArguments().getString(ARG_PARAM2);
} @Override
public void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
//获取用户交易记录
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
public void getUserGoodsRecords(BaseRecords<UserGoodsRecords> recordsData){
this.recordsData = recordsData;
}
//获取当前用户信息
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
public void getUserRes(ResponseData<User> responseData){
this.user = responseData.getData();
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_message_page, container, false); view = inflater.inflate(R.layout.fragment_message_page, container, false);
Log.e("MessagePageFragment",recordsData.getSize().toString());
initView();
return view;
}
private void initView() {
recyclerView = view.findViewById(R.id.rv_message);
if(recordsData.getRecords() != null){
userRecordsAdapter = new UserRecordsAdapter(getActivity(),recordsData,user.getId());
//准备布局管理器
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(1,
StaggeredGridLayoutManager.VERTICAL);
//设置布局管理器的方向
layoutManager.setReverseLayout(false);
recyclerView.setLayoutManager(layoutManager);
//设置布局管理器到RecyclerView中
recyclerView.setAdapter(userRecordsAdapter);
}
} }
} }

@ -186,7 +186,6 @@ public class PublishProductFragment extends Fragment implements View.OnClickList
//上传 //上传
private void updateImage(List<MultipartBody.Part> parts) { private void updateImage(List<MultipartBody.Part> parts) {
upModelimpl.UpImage(parts,this); upModelimpl.UpImage(parts,this);
} }
@ -194,6 +193,8 @@ public class PublishProductFragment extends Fragment implements View.OnClickList
public void upImageOnSuccess(ResponseData<ImageBean> responseData) { public void upImageOnSuccess(ResponseData<ImageBean> responseData) {
imageBean = responseData.getData(); imageBean = responseData.getData();
Log.e("str",String.valueOf(imageBean.getImageCode())); Log.e("str",String.valueOf(imageBean.getImageCode()));
} }
@Override @Override

@ -21,20 +21,25 @@ import retrofit2.http.QueryMap;
public interface GoodsHttp_interface { public interface GoodsHttp_interface {
@GET("tran/goods/type") @GET("tran/goods/type")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<List<GoodsType>>> sendGetAllGoodsType(); Observable<ResponseData<List<GoodsType>>> sendGetAllGoodsType();
@GET("tran/goods/all") @GET("tran/goods/all")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<GoodRecords>> sendGetAllGood(@Query("userId") Long userId, Observable<ResponseData<GoodRecords>> sendGetAllGood(@Query("userId") Long userId,
@QueryMap Map<String, Object> map @QueryMap Map<String, Object> map
); );
@GET("tran/trading/buy") @GET("tran/trading/buy")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<BaseRecords<UserGoodsRecords>>> sendUserBuyGoods(@Query("userId") Long userId, Observable<ResponseData<BaseRecords<UserGoodsRecords>>> sendUserBuyGoods(@Query("userId") Long userId,
@QueryMap Map<String, Object> map); @QueryMap Map<String, Object> map);
@GET("tran/trading/records")
@Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<BaseRecords<UserGoodsRecords>>> sendUserRecords(@Query("userId") Long userId,
@QueryMap Map<String, Object> map);
} }

@ -1,14 +1,18 @@
package com.android.model.goods; package com.android.model.goods;
import com.android.bean.BaseRecords;
import com.android.bean.Good; import com.android.bean.Good;
import com.android.bean.GoodRecords; import com.android.bean.GoodRecords;
import com.android.bean.GoodsType; import com.android.bean.GoodsType;
import com.android.bean.ResponseData; import com.android.bean.ResponseData;
import com.android.bean.User; import com.android.bean.User;
import com.android.bean.queryBean.UserGoodsRecords;
import java.util.List; import java.util.List;
public interface GoodsListener { public interface GoodsListener {
void onGetAllGoodsType(ResponseData<List<GoodsType>> responseData); void onGetAllGoodsType(ResponseData<List<GoodsType>> responseData);
void onGetAllGoodSuccess(ResponseData<GoodRecords> responseData); void onGetAllGoodSuccess(ResponseData<GoodRecords> responseData);
void onGetUserRecordsSuccess(ResponseData<BaseRecords<UserGoodsRecords>> responseData);
} }

@ -2,8 +2,11 @@ package com.android.model.goods;
import com.android.model.login.LoginListener; import com.android.model.login.LoginListener;
import java.util.Map;
public interface GoodsModel { public interface GoodsModel {
void getAllGoodsType(GoodsListener goodsListener); void getAllGoodsType(GoodsListener goodsListener);
void getAllGood(GoodsListener goodsListener); void getAllGood(GoodsListener goodsListener);
void getUserRecords(Long userId, Map<String,Object> map,GoodsListener goodsListener);
} }

@ -4,11 +4,13 @@ import android.net.Uri;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.Log; import android.util.Log;
import com.android.bean.BaseRecords;
import com.android.bean.Good; import com.android.bean.Good;
import com.android.bean.GoodRecords; import com.android.bean.GoodRecords;
import com.android.bean.GoodsType; import com.android.bean.GoodsType;
import com.android.bean.ResponseData; import com.android.bean.ResponseData;
import com.android.bean.User; import com.android.bean.User;
import com.android.bean.queryBean.UserGoodsRecords;
import com.android.model.login.LoginListener; import com.android.model.login.LoginListener;
import com.android.utils.constraint.Constants; import com.android.utils.constraint.Constants;
@ -119,5 +121,45 @@ public class GoodsModelimpl implements GoodsModel{
} }
@Override
public void getUserRecords(Long userId, Map<String, Object> map,GoodsListener goodsListener) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Constants.BASE_URL)
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build();
GoodsHttp_interface httpInterface = retrofit.create(GoodsHttp_interface.class);
Observable<ResponseData<BaseRecords<UserGoodsRecords>>> observable
= httpInterface.sendUserRecords(userId, map);
observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ResponseData<BaseRecords<UserGoodsRecords>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull ResponseData<BaseRecords<UserGoodsRecords>> baseRecordsResponseData) {
goodsListener.onGetUserRecordsSuccess(baseRecordsResponseData);
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("获取用户交易记录",e.toString());
}
@Override
public void onComplete() {
}
});
}
} }

@ -18,19 +18,19 @@ import retrofit2.http.Query;
public interface longinHttp_Interface { public interface longinHttp_Interface {
//登录 //登录
@POST("tran/user/login") @POST("tran/user/login")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<User>> login(@Body User user); Observable<ResponseData<User>> login(@Body User user);
//获取验证码 //获取验证码
@GET("tran/user/send") @GET("tran/user/send")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<String>> sendCode(@Query("phone") String phone); Observable<ResponseData<String>> sendCode(@Query("phone") String phone);
@POST("tran/user/register") @POST("tran/user/register")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<String>> register(@Body User user); Observable<ResponseData<String>> register(@Body User user);

@ -15,8 +15,8 @@ import retrofit2.http.Query;
public interface Purchase_interface { public interface Purchase_interface {
@FormUrlEncoded @FormUrlEncoded
@POST("tran/trading") @POST("tran/trading")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<String>> sendTrading(@Field("buyerId") Long buyerId, Observable<ResponseData<String>> sendTrading(@Field("buyerId") Long buyerId,
@Field("goodsId") Long goodsId, @Field("goodsId") Long goodsId,
@Field("price") Integer price, @Field("price") Integer price,

@ -18,13 +18,13 @@ import retrofit2.http.Part;
public interface UpHttp_interface { public interface UpHttp_interface {
@Multipart @Multipart
@POST("tran/image/upload") @POST("tran/image/upload")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<ImageBean>> sendUpImage(@Part List<MultipartBody.Part> fileList); Observable<ResponseData<ImageBean>> sendUpImage(@Part List<MultipartBody.Part> fileList);
@POST("tran/goods/add") @POST("tran/goods/add")
@Headers({"appId:b34ac21286ae45938add627b418a4871", @Headers({"appId:e843562fefa144bf808a9621b107b3a4",
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"}) "appSecret:76387a99d8b52fad54b94bea1118262573381"})
Observable<ResponseData<Good>> sendAddGoods(@Body Good goods); Observable<ResponseData<Good>> sendAddGoods(@Body Good goods);
} }

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="20dp"/>
<solid android:color="@color/whitesmoke"/>
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="20dp"/>
<solid android:color="@color/white"/>
</shape>

@ -3,13 +3,38 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/tag_bg"
tools:context=".activity.fragment.MessagePageFragment"> tools:context=".activity.fragment.MessagePageFragment">
<!-- TODO: Update blank fragment layout --> <androidx.core.widget.NestedScrollView
<TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="message" />
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/dt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="交易记录"
android:textColor="@color/black"
android:textSize="30dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/dt">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout> </FrameLayout>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp">
<RelativeLayout
android:id="@+id/q"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- <ImageView-->
<!-- android:id="@+id/m_hImg"-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- />-->
<TextView
android:id="@+id/tv_message_user_name"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/edittext_shape1"
android:gravity="center"
android:textColor="@color/teal_200"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/r"
android:layout_toRightOf="@+id/q"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="@drawable/edittext_shape2">
<TextView
android:id="@+id/tv_message_item_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="145dp"
android:layout_marginBottom="7dp"
android:text="发布了"
android:textColor="@color/black"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_below="@+id/r">
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/layout_goodsdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="商品描述"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_goods_description"
android:text="商品描述"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_below="@+id/layout_goodsdescription"
android:id="@+id/layout_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="价格(元)"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_message_price"
android:text="价格"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_below="@+id/layout_goods"
android:id="@+id/layout_message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="发布时间"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_message_create_time"
android:text="发布"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_toRightOf="@+id/layout_message_time"
android:layout_below="@+id/layout_goods"
android:id="@+id/layout_message_seller_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="100dp">
<TextView
android:text="发布时间"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_message_seller_time"
android:text="发布"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_below="@+id/layout_message_time"
android:id="@+id/layout_seller"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="卖家"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_seller"
android:text="卖家"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_toRightOf="@+id/layout_message_time"
android:layout_below="@+id/layout_message_seller_time"
android:id="@+id/layout_buyer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="100dp">
<TextView
android:text="买家"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginStart="8dp"
android:id="@+id/tv_buyer"
android:text="买家"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>

@ -27,6 +27,8 @@
<color name="menubar_default">#767676</color> <color name="menubar_default">#767676</color>
<color name="menubar_active">#E2752F</color> <color name="menubar_active">#E2752F</color>
<color name="whitesmoke">#f5f5f5</color><!--烟白色 -->
<!-- color for book detail --> <!-- color for book detail -->

Loading…
Cancel
Save