通用详情页的打造
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">大前端 哔哩哔哩技术 2024年07月12日 12:01 上海</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">背景介绍</span></strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-axegupay5k/0d31dea318e54911b68959a3dc802eff~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=t4xf%2BPCSPUE93yy3YVkw%2BbvRaTc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">大众</span>都<span style="color: black;">晓得</span>,详情页承载了站内的核心流量。它的量级到底有多大呢?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span>来看一下,日均播放次数数亿次,这么大的流量,其重要程度可想而知。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在<span style="color: black;">这般</span>一个页面,每一个功能都是<span style="color: black;">海量</span>业务的汇总点。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">做为</span>用户核心消费场景,详情页不仅<span style="color: black;">必须</span>承接<span style="color: black;">各样</span>业务的转化,还要负责展示各业务在播放页的功能。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">能够</span>说,播放页的代码<span style="color: black;">繁杂</span>度属于客户端最高的代码之一,这不仅<span style="color: black;">由于</span>播放页本身的功能<span style="color: black;">繁杂</span>,还<span style="color: black;">由于</span>它<span style="color: black;">必须</span>融合<span style="color: black;">海量</span><span style="color: black;">外边</span>业务功能。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">繁杂</span>的功能自然会带来较高的代码<span style="color: black;">繁杂</span>度,而高代码<span style="color: black;">繁杂</span>度<span style="color: black;">常常</span><span style="color: black;">寓意</span>着高代码<span style="color: black;">守护</span>成本。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">知道</span>需求</span></strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/c2b479af04294ca198fb3806d44095b2~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=jwILkuXUCZ2XfontzlEXHwRZbMc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span>来看一下<span style="color: black;">无</span>做这个项目之前的状态。如图所示,<span style="color: black;">她们</span>分别为三个业务团队各自<span style="color: black;">守护</span>。页面间相互独立。能力<span style="color: black;">没法</span>复用。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/73b092a3f9784088beae918b4ff9974a~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=kbNGMzisop%2FO%2FPYncrVeA5Y76J0%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span>这个项目,<span style="color: black;">咱们</span>要将<span style="color: black;">她们</span>融合<span style="color: black;">成为了</span>一个页面。<span style="color: black;">制品</span>的诉求<span style="color: black;">便是</span>将<span style="color: black;">她们</span>融合为一个,来达到多业务形态统一的<span style="color: black;">目的</span>。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/9ab5436d386649d8a65c2986b8507eb4~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=%2B0g8lN3pg%2FAkWWanElfOY7ao8Q0%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">然则</span>,这三个详情页并不像<span style="color: black;">制品</span>想象的<span style="color: black;">那样</span>简单。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">每一个</span>业务都有自己的特殊形态,如大型活动态、主客态、播单态、PUGV/OGV态等一系列业务形态。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">每种形态都有自己的特殊<span style="color: black;">规律</span>,<span style="color: black;">况且</span>这些业务形态间还<span style="color: black;">能够</span>互相切换。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">需求分析</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">为了更好地达成<span style="color: black;">目的</span>,<span style="color: black;">咱们</span><span style="color: black;">必须</span>进行如下思考:</p><strong style="color: blue;">从业务<span style="color: black;">方向</span>:</strong>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">要<span style="color: black;">处理</span>多业务形态不统一的问题。例如,<span style="color: black;">制品</span>既想要UGC大型活动的能力,又想要OGV的多视角功能。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">但这两个能力在之前分别是两个业务团队各自<span style="color: black;">研发</span>的,<span style="color: black;">没法</span>复用,<span style="color: black;">制品</span>在业务<span style="color: black;">选取</span>上<span style="color: black;">没法</span>兼得。</p><strong style="color: blue;">从效率<span style="color: black;">方向</span>:</strong>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">要<span style="color: black;">处理</span>迭代方式不统一的问题。例如,进度条体验优化需求,<span style="color: black;">制品</span>在给UGC团队提需求的<span style="color: black;">同期</span>,还要复制一份给OGV团队。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">两个业务方的<span style="color: black;">研发</span>和测试都<span style="color: black;">必须</span>进入这个项目,并且双方的<span style="color: black;">研发</span>进度和排期可能不一致。<span style="color: black;">倘若</span><span style="color: black;">制品</span><span style="color: black;">剧烈</span><span style="color: black;">需求</span>同一版本上线,还<span style="color: black;">必须</span>协调各方资源。</p><strong style="color: blue;">从质量<span style="color: black;">方向</span>:</strong>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">要<span style="color: black;">处理</span><span style="color: black;">怎样</span><span style="color: black;">保证</span>稳定性的问题。例如,多团队协作,之前都是组内同事协作<span style="color: black;">研发</span>,<span style="color: black;">此刻</span>融入了两个新的业务团队,<span style="color: black;">咱们</span>该<span style="color: black;">怎样</span><span style="color: black;">保证</span>稳定性。</p><strong style="color: blue;">从团队<span style="color: black;">方向</span>:</strong>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">要<span style="color: black;">处理</span><span style="color: black;">怎样</span>让新人快速上手的问题。正常<span style="color: black;">状况</span>下,新人想要进入<span style="color: black;">研发</span><span style="color: black;">必要</span>对这个系统足够<span style="color: black;">认识</span>后才行。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">更何况<span style="color: black;">此刻</span>变<span style="color: black;">成为了</span>三个业务融合的页面。有<span style="color: black;">无</span>一种手段,让新人无需关心<span style="color: black;">繁杂</span>的业务形态和业务<span style="color: black;">规律</span>,只<span style="color: black;">必须</span>关注自己的需求?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">具体<span style="color: black;">方法</span></span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">针对以上问题,<span style="color: black;">咱们</span><span style="color: black;">能够</span>总结出通用详情页框架<span style="color: black;">必要</span>满足以上三点,分别为:复用性,灵活性,稳定性</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/579359e0341547d3aec31b9a52418a81~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=ALIWxEph40RSq72t9QHauMY55GE%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">接下来<span style="color: black;">咱们</span>继续对多业务形态进行分析。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">首要</span><span style="color: black;">咱们</span>从横向上进行拆解,<span style="color: black;">经过</span>对比,<span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">发掘</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">多业务形态间其实有<span style="color: black;">非常多</span>的相同模块。如互动,弹幕发送框,<span style="color: black;">关联</span><span style="color: black;">举荐</span>等。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">从纵向上进行拆解,<span style="color: black;">咱们</span><span style="color: black;">亦</span><span style="color: black;">能够</span><span style="color: black;">发掘</span><span style="color: black;">非常多</span>相同模块,如弹窗管理器,主题组件,转场组件等。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">那样</span>从横向和纵向上<span style="color: black;">咱们</span><span style="color: black;">发掘</span>,多种业务形态间其实有<span style="color: black;">非常多</span><span style="color: black;">能够</span>复用的能力。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/19f64949dddc4e27872f9c24014ac4b4~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=tmeOY4YSFvcy1bDqcd6Srg%2BBf1E%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">基于前面的思考,<span style="color: black;">咱们</span>设计了一套通用详情页的框架。将其分为三层:</p><strong style="color: blue;">业务层:</strong>将业务模块分为两类,能够在多业务间复用的模块抽象到通用业务,业务独有模块则由各业务<span style="color: black;">自动</span>负责。<strong style="color: blue;">组件层:</strong>抽象出<span style="color: black;">各样</span>通用组件,业务方可自由选取和组装。<strong style="color: blue;">框架层:</strong>抽象生命周期管理、数据管理等核心<span style="color: black;">规律</span>,以此来<span style="color: black;">保准</span><span style="color: black;">全部</span>详情页的稳定性。<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这般</span><span style="color: black;">咱们</span>就初步<span style="color: black;">处理</span>了复用性的问题,<span style="color: black;">然则</span>随之而来的<span style="color: black;">便是</span>灵活性问题。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/52621a282dd54561ba980116f3df8b50~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=iJdLtAy%2BqqAYa5NKgXJTObxNNN8%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span>以<span style="color: black;">实质</span>场景为例,<span style="color: black;">关联</span><span style="color: black;">举荐</span>模块在课堂态不展示,<span style="color: black;">然则</span>在ugc和ogv下<span style="color: black;">必须</span>展示,<span style="color: black;">另一</span>他的点击事件在ugc和ogv下还会<span style="color: black;">显现</span>差异。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">同期</span><span style="color: black;">关联</span><span style="color: black;">举荐</span>模块还强依赖简介模块。<span style="color: black;">由于</span>简介模块<span style="color: black;">亦</span>是一个通用组件,业务方<span style="color: black;">能够</span>自由替换。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>哪天业务方替换了了简介模块,那<span style="color: black;">关联</span><span style="color: black;">举荐</span>模块将<span style="color: black;">没法</span>正常运行。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">从<span style="color: black;">关联</span><span style="color: black;">举荐</span>这个例子<span style="color: black;">咱们</span><span style="color: black;">能够</span>得出<span style="color: black;">倘若</span>想让业务模块复用,<span style="color: black;">必要</span>满足两个<span style="color: black;">要求</span>。</p>支持业务异化,即<span style="color: black;">准许</span>业务能<span style="color: black;">插进</span>自定义<span style="color: black;">规律</span>,否则<span style="color: black;">此刻</span>抽象的通用模块在迭代的过程<span style="color: black;">必定</span>会变成非通用,<span style="color: black;">或</span>里面掺杂<span style="color: black;">各样</span>if else<span style="color: black;">规律</span>来支持异化。<span style="color: black;">必要</span><span style="color: black;">保准</span>模块间相互独立,<span style="color: black;">由于</span>所有业务<span style="color: black;">规律</span><span style="color: black;">这里</span>框架下都变<span style="color: black;">成为了</span>模块,模块是<span style="color: black;">能够</span>由业务方自由<span style="color: black;">选取</span>的。<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/b72c95f41ea84328be1f3c31f43cd638~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=BoUreqSMyF9pO1BH%2BEHQeGZEpFc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">引入依赖注入</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">因此呢</span>,<span style="color: black;">咱们</span><span style="color: black;">必须</span>在流程和模块中加入依赖注入的能力,用于业务方实现差异化<span style="color: black;">规律</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">业务方可<span style="color: black;">自动</span><span style="color: black;">插进</span>自己的业务<span style="color: black;">规律</span>,并<span style="color: black;">选取</span>或替换业务模块。来<span style="color: black;">处理</span>模块间的耦合。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">定义依赖注入容器</p><span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">class</span> <span style="color: black;">BlocStore</span> </span>{
<span style="color: black;">typealias</span> <span style="color: black;">StoreLock</span> = <span style="color: black;">RecursiveLock</span>
<span style="color: black;">typealias</span> <span style="color: black;">StoreTable</span> = [<span style="color: black;">String</span>: <span style="color: black;">BlocTable</span>]
<span style="color: black;">private</span> <span style="color: black;">let</span> lock: <span style="color: black;">StoreLock</span> = <span style="color: black;">StoreLock</span>()
<span style="color: black;">private</span> <span style="color: black;">lazy</span> <span style="color: black;">var</span>storeTable:<span style="color: black;">StoreTable</span> = [:]
}
<span style="color: black;"><span style="color: black;">extension</span> <span style="color: black;">BlocStore</span> </span>{
<span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">register</span><Service><span style="color: black;">(service: Service.<span style="color: black;">Type</span> = Service.<span style="color: black;">self</span>, to: Bloc.<span style="color: black;">Type</span>)</span></span> {
<span style="color: black;">let</span> key = <span style="color: black;">"\(service)"</span>lock.lock()<span style="color: black;">defer</span> { lock.unlock() }
serviceTable = to
}
<span style="color: black;">@discardableResult</span>
<span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">optional</span><Service><span style="color: black;">(service: Service.<span style="color: black;">Type</span> = Service.<span style="color: black;">self</span>)</span></span> -> <span style="color: black;">Service?</span> {
<span style="color: black;">let</span> key = <span style="color: black;">"\(service)"</span>
lock.lock()
<span style="color: black;">defer</span> { lock.unlock() }
<span style="color: black;">let</span> service = resolve(bloc)
<span style="color: black;">return</span> s
}
}
<span style="color: black;">// Bind and unbind</span>
<span style="color: black;"><span style="color: black;">extension</span> <span style="color: black;">BlocStore</span> </span>{
<span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">bindBloc</span><span style="color: black;">(bloc: Bloc)</span></span> {
}
<span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">unbindBloc</span><T: Bloc><span style="color: black;">(<span style="color: black;">_</span> blocType: T.<span style="color: black;">Type</span>)</span></span> {
}
}
<span style="color: black;">// BlocLifeCycle</span>
<span style="color: black;"><span style="color: black;">extension</span> <span style="color: black;">BlocStore</span> </span>{
<span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">onStart</span><span style="color: black;">(bloc: Bloc?)</span></span>{
bloc?.onStart()
}<span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">onPause</span><span style="color: black;">(bloc: Bloc?)</span></span> {
bloc?.onPause()
}
<span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">onResume</span><span style="color: black;">(bloc: Bloc?)</span></span> {
bloc?.onResume()
}
<span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">onStop</span><span style="color: black;">(bloc: Bloc?)</span></span> {
bloc?.onStop()
}
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">组件注册</p><span style="color: black;">// 业务方<span style="color: black;">按照</span>业务<span style="color: black;">规律</span><span style="color: black;">能够</span>注入<span style="color: black;">区别</span>的实现</span>
<span style="color: black;">register</span>(<span style="color: black;">service</span>: XXXProtocol.self, <span style="color: black;">to</span>: ABloc.self) <span style="color: black;">// A业务形态</span>
<span style="color: black;">register</span>(<span style="color: black;">service</span>: XXXProtocol.self,<span style="color: black;">to</span>: BBloc.self) <span style="color: black;">// B业务形态</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">组件解析</p><span style="color: black;">let</span> s: <span style="color: black;">XXXProtocol</span> = store.<span style="color: black;">optional</span>()<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">引入scope</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">scope分为页面级和业务级两种scope:</p><span style="color: black;">class</span> <span style="color: black;">VDScope</span> {
<span style="color: black;">public</span> <span style="color: black;">static</span> <span style="color: black;">let</span> core = <span style="color: black;">"store.core.scope"</span>
<span style="color: black;">public</span> <span style="color: black;">static</span> <span style="color: black;">let</span> biz = <span style="color: black;">"store.biz.scope"</span>
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">定义 Scope 管理来管理模块的生命周期:</p>Page scope的生命周期与页面保持一致,Biz scope与业务形态的生命周期保持一致。即在页面形态<span style="color: black;">出现</span>变化时,框架层会自动将bizscope下的所有模块进行销毁。<span style="color: black;">public</span> <span style="color: black;"><span style="color: black;">class</span> <span style="color: black;">BlocStore</span> </span>{
<span style="color: black;">typealias</span> <span style="color: black;">ScopeTable</span> = [<span style="color: black;">String</span>: <span style="color: black;">String</span>]
...
<span style="color: black;"><span style="color: black;">func</span> <span style="color: black;">bizTypeDidChanged</span><span style="color: black;">()</span></span> {
<span style="color: black;">// 销毁上一个bizscope下所有模块</span>
xxxx
<span style="color: black;">// 初始化新bizscope下模块</span>
xxx
}
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这般</span>,新人进入<span style="color: black;">研发</span>时无需关注当前业务形态或业务形态切换的问题,达到快速上手的目的。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">怎样</span><span style="color: black;">保证</span>吞吐速度和质量稳定?</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在<span style="color: black;">研发</span>资源和测试资源不变的<span style="color: black;">状况</span>下,业务范围扩大了,<span style="color: black;">咱们</span>该<span style="color: black;">怎样</span><span style="color: black;">保证</span>吞吐速度和质量的稳定呢?</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/f966c826d4604609a46b98b343819b06~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=rfz%2Bv8KDA2ycTkR2Li9WM0Z48s8%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span><span style="color: black;">能够</span>将策略分为三个<span style="color: black;">周期</span>:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">1.<span style="color: black;">研发</span><span style="color: black;">周期</span>:</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">针对</span>核心流程添加全链路日志,<span style="color: black;">倘若</span><span style="color: black;">发掘</span>不符合预期的数据则直接抛出<span style="color: black;">反常</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">同期</span>进行技术埋点上报。<span style="color: black;">倘若</span>是<span style="color: black;">针对</span>核心流程的修改,强制添加AB降级<span style="color: black;">方法</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">2.测试<span style="color: black;">周期</span>:</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">有些bug非常隐蔽,在用户体验上可能<span style="color: black;">无</span>任何差异,但内部流程或数据可能<span style="color: black;">已然</span><span style="color: black;">出现</span><span style="color: black;">反常</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">针对</span>类似问题,测试<span style="color: black;">基本</span><span style="color: black;">没法</span><span style="color: black;">发掘</span>。<span style="color: black;">引起</span>此类问题流入线上的<span style="color: black;">危害</span>。<span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">经过</span>添加监控和告警,让<span style="color: black;">咱们</span><span style="color: black;">即时</span><span style="color: black;">发掘</span>问题。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">3.灰度/线上<span style="color: black;">周期</span>:</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">经过</span>添加监控和告警,让<span style="color: black;">咱们</span><span style="color: black;">即时</span><span style="color: black;">发掘</span>问题。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">详细</span>实施<span style="color: black;">方法</span>:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">首要</span>,<span style="color: black;">咱们</span>对通用详情页里核心流程添加了全链路日志,并为日志服务添加了两项额外能力:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span><span style="color: black;">发掘</span>日志类型为Error,内部自动触发DEBUG弹窗提醒,并上报技术埋点,达到对线上稳定性的监控。</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/3b0e2079fd5d47c8b6708316e91f9aa4~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1723657342&x-signature=FIO2iogb%2BZD5Dp5ZHurbqmwGTcw%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">同期</span>,搭建离在线数据报表和<span style="color: black;">反常</span>告警,进一步<span style="color: black;">保证</span>稳定性。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">至此,搭建了通用详情页从<span style="color: black;">发掘</span>问题到定向拉取再到快速定位的闭环。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-End-</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">作者丨凉茶</span></p>
楼主继续加油啊!外链论坛加油! i免费外链发布平台 http://www.fok120.com/ 你的留言真是温暖如春,让我感受到了无尽的支持与鼓励。
页:
[1]