工作小结-2018十一月

好几周没有写工作小结了。上个月母亲生病,请假回去,加上十月份国庆节,前前后后只持续工作了一周左右,工作上面的事情大都委托给同组的同事帮忙了。

所以这个月才开始继续写工作小结。

十一月的工作主要是针对商品缺货现象进行优化。产品部门给了两个个需求点,一是增加会员专区,二是进行缺货订阅推送。这两个需求点演化为很多独立或者不独立的需求。

增加会员专区

增加会员专区的目的是将部分商品从所有商品中拉出来,保证这些商品能够给VIP选择,这样至少能保证在货源不足的情况下付费用户能够选择。针对该问题我们开发需要做的是加入VIP专区,针对商品是否是vip设置专门的标识,另外在打包的流程中需要额外将成为会员的路径加上。

增加会员标识有些问题,比如说对非会员用户,需要显示成为会员的区域,但是对于已是会员的用户,就需要遮蔽这个区域,这个地方以前的做法是在activity的onresume的时候做检查,检查一遍会员的状态,但是其实商品详情页面如果总这样做的话,onresume里面做的事情过于多了。

我看了一下别的app,像京东这种支持无限订单模式的,返回的状态刷新不是在onresume里面的,而是返回时直接显示出来改变的结果。因此我判断此处使用的应该是广播的方式。因此我觉得在设计app的activity的时候需要将视图同时与广播绑定,在广播发送来的时候,直接针对广播的内容进行相关行为的实施。因此在封装activity的时候,其实需要额外开辟一个针对广播的ui修改区。当然这个广播只需要是应用内广播即可,我使用eventbus来实现了一款。不过鉴于发送广播会造成ui修改,而在activity内的相关行为,一般造成相同ui修改,也会同时发个广播,此时就需要鉴别一下,不要重复刷新。

说道eventbus,在支付宝和微信的回调处理的时候,我也使用的是eventbus,假以时日需要总结一下eventbus原理。

sku订阅推送

订阅推送是上周提出的需求,但是这周才开始实施,期初的想法是一个spu可以订阅一个缺货的sku,这样在sku到货的时候通过推送来唤醒用户。

因此需要在商品详情页面进行订阅功能的添加。但是后来说需要在确认订单页面也同样进行订阅功能的添加,这就将原本的一个spu订阅一个sku的需求变更了,变成了一个spu可以订阅多个sku,相关的逻辑也需要进行改变。

订单流程页面,一直是独立发起,但是并未有比较好的处理措施。由于订单流程本来自身支持很多跳转,而跳转到的页面又支持相应的订单发起,因此其实应该将订单发起页面做成singletask模式,这样可以保证订单发起页面的独立性。但是回来的时候,需要做本地的刷新措施。

回到这个问题,单sku订阅spu涉及到订阅和取消订阅的关系,订阅的时候代表这个spu中的这个sku被订阅,取消订阅也只能说是这个sku被取消订阅。而单品详情页面则拥有取消全部的关系。另外由于订单流程页面并未做单栈模式,所以也有在别的订单流程进行了操作,回到这个未关闭的流程时需要处理订阅的相关消息。

因此此处也使用的广播模式,两种广播,一种是携带了单独sku的广播,这类广播获取之后只需要判断sku的id是否是自己的id,然后做相应的处理即可。另外一种广播是携带了spu信息的广播,这类广播获取之后只需要判断spuid和自己携带的spuid是否相同,如果相同并且为取消订阅的时候,就可以直接取消自己的订阅关系。

bug修复类

ui那边提出了一个修改建议,需要将所有的button通用为一个style,这个比较好做,在别的页面都处理的很好,但是在物流页面发现button点击失效

原来的布局

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?xml version="1.0" encoding="utf-8"?>
<Android.support.constraint.ConstraintLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
xmlns:tools="http://schemas.Android.com/tools"
Android:background="@color/color_half_alpha_black"
xmlns:app="http://schemas.Android.com/apk/res-auto">
<View
Android:id="@+id/view_background"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/text_confirm"
Android:background="@color/white"
Android:layout_marginTop="135dp"
Android:layout_width="match_parent"
Android:layout_height="0dp"/>

<TextView
Android:id="@+id/text_confirm"
Android:layout_width="match_parent"
Android:layout_height="49dp"
Android:text="我知道了"
style="@style/BlackButtonStyle"
app:layout_constraintBottom_toBottomOf="parent"
/>

<TextView
Android:id="@+id/text_express_name"
tools:text="顺丰快递"
app:layout_constraintTop_toTopOf="@id/view_background"
app:layout_constraintStart_toStartOf="@id/view_background"
app:layout_constraintEnd_toEndOf="@id/view_background"
Android:layout_marginTop="20dp"
Android:textSize="15dp"
Android:textColor="@color/black"
Android:layout_width="wrap_content"
Android:layout_height="wrap_content" />
<TextView
Android:id="@+id/text_express_number"
tools:text="(运单编号:3832333043290)"
app:layout_constraintTop_toBottomOf="@id/text_express_name"
app:layout_constraintStart_toStartOf="@id/view_background"
app:layout_constraintEnd_toEndOf="@id/view_background"
Android:layout_marginTop="10dp"
Android:textColor="@color/color_666666"
Android:layout_width="wrap_content"
Android:layout_height="wrap_content" />

<View
Android:id="@+id/divider_express_number"
Android:layout_width="0dp"
app:layout_constraintTop_toBottomOf="@id/text_express_number"
app:layout_constraintStart_toStartOf="@id/view_background"
app:layout_constraintEnd_toEndOf="@id/view_background"
Android:layout_marginTop="20dp"
Android:background="@color/color_ececec"
Android:layout_marginStart="20dp"
Android:layout_marginEnd="20dp"
Android:layout_height="0.5dp"/>
<ScrollView
Android:id="@+id/scroll_view"
app:layout_constraintTop_toBottomOf="@id/divider_express_number"
app:layout_constraintStart_toStartOf="@id/view_background"
app:layout_constraintEnd_toEndOf="@id/view_background"
app:layout_constraintBottom_toBottomOf="@id/view_background"
Android:layout_width="match_parent"
Android:layout_height="0dp">
<LinearLayout
Android:id="@+id/container_logistic"
Android:orientation="vertical"
Android:paddingTop="5dp"
Android:layout_width="match_parent"
Android:layout_height="wrap_content">
<include
Android:visibility="gone"
tools:visibility="visible"
layout="@layout/item_popupwindow_logistic"/>
</LinearLayout>
</ScrollView>
</Android.support.constraint.ConstraintLayout>

当时只知道从layoutinspecter中发现布局存在,并且点击事件没有更改。当时做的措施是将id为text_confirm的控件挪到底部,挪到底部保证这个view最后被绘制并且不会被覆盖。但是今天检查了一下发现其实是scrollview的布局的底部写错了,应该以text_confirm的头部为底。当时分析的时候没有注重到这个,而且从布局分析器上面来看其实很难看出这个问题。