企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 销售情况统计栏 #### 1.视图展示 文件路径:\\shop\\views\\default\\Seller\\IndexCtl\\index.php ``` <pre class="calibre14">``` <span class="token"><</span>div class<span class="token">=</span><span class="token4">"m white-panel"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"pannel_div"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"mt"</span><span class="token">></span> <span class="token"><</span>h3 class<span class="token">=</span><span class="token4">"bbc_seller_border"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'销售情况统计'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>h3<span class="token">></span> <span class="token"><</span>h5<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'按周期统计商家店铺的订单量和订单金额'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>h5<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"mc"</span><span class="token">></span> <span class="token"><</span>table width<span class="token">=</span><span class="token4">"100%"</span> cellspacing<span class="token">=</span><span class="token4">"0"</span> cellpadding<span class="token">=</span><span class="token4">"0"</span><span class="token">></span> <span class="token"><</span>tr<span class="token">></span> <span class="token"><</span>td width<span class="token">=</span><span class="token4">"20%"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td width<span class="token">=</span><span class="token4">"40%"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'订单量'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td width<span class="token">=</span><span class="token4">"40%"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'订单金额'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span>tr<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'今日销量'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@$today<span class="token1">[</span><span class="token4">'sales_num'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@<span class="token3">format_money</span><span class="token1">(</span>$today<span class="token1">[</span><span class="token4">'order_sales'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span>tr<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'周销量'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@$week<span class="token1">[</span><span class="token4">'sales_num'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@<span class="token3">format_money</span><span class="token1">(</span>$week<span class="token1">[</span><span class="token4">'order_sales'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span>tr<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'月销量'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@$month<span class="token1">[</span><span class="token4">'sales_num'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span>@<span class="token3">format_money</span><span class="token1">(</span>$month<span class="token1">[</span><span class="token4">'order_sales'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span><span class="token">/</span>table<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> ``` ``` #### 2.数据获取 接口地址:index.php?ctl=Seller\_Index&met=index&typ=e 接口文件:\\shop\\controllers\\Seller\\IndexCtl.php 控制器:Seller\_IndexCtl 方法:index() ``` <pre class="calibre15">``` <span class="token5">//销量统计</span> $start_date <span class="token">=</span> <span class="token3">date</span><span class="token1">(</span><span class="token4">"Y-m-d"</span><span class="token1">,</span> <span class="token3">strtotime</span><span class="token1">(</span><span class="token4">"-30 days"</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $start_today_date <span class="token">=</span> <span class="token3">date</span><span class="token1">(</span><span class="token4">"Y-m-d"</span><span class="token1">)</span><span class="token1">;</span> $start_yes_date <span class="token">=</span> <span class="token3">date</span><span class="token1">(</span><span class="token4">"Y-m-d"</span><span class="token1">,</span> <span class="token3">strtotime</span><span class="token1">(</span><span class="token4">"-1 days"</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $start_week_date <span class="token">=</span> <span class="token3">date</span><span class="token1">(</span><span class="token4">"Y-m-d"</span><span class="token1">,</span> <span class="token3">strtotime</span><span class="token1">(</span><span class="token4">"-7 days"</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $today <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getShopSales</span><span class="token1">(</span>Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">,</span>$start_today_date<span class="token1">)</span><span class="token1">;</span> $week <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getShopSales</span><span class="token1">(</span>Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">,</span>$start_week_date<span class="token1">)</span><span class="token1">;</span> $month <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getShopSales</span><span class="token1">(</span>Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">,</span>$start_date<span class="token1">)</span><span class="token1">;</span> ``` ```