feat(statistics): 根据店铺ID统计地方商品数量

This commit is contained in:
mkm 2024-07-15 10:18:24 +08:00
parent 551f98d460
commit 15717de1d5
3 changed files with 16 additions and 8 deletions

View File

@ -78,15 +78,18 @@ class IndexController extends BaseLikeController
return $this->success('ok', ['merchatCountList' => $data, 'merchantTotalCount' => count($data)]);
}
/**
* 地方商品数量统计
*/
public function product_count_sotre_count()
{
$data = [
['street_name' => '喻寺镇', 'product_count' => 1],
['street_name' => '立石镇', 'product_count' => 1],
['street_name' => '百和镇', 'product_count' => 1],
['street_name' => '得胜镇', 'product_count' => 1],
['street_name' => '玄滩镇', 'product_count' => 1],
['street_name' => '云锦镇', 'product_count' => 1],
['street_name' => '喻寺镇', 'product_count' => StoreBranchProduct::where('store_id',1)->count()],
['street_name' => '立石镇', 'product_count' => StoreBranchProduct::where('store_id',2)->count()],
['street_name' => '百和镇', 'product_count' => StoreBranchProduct::where('store_id',3)->count()],
['street_name' => '得胜镇', 'product_count' => StoreBranchProduct::where('store_id',5)->count()],
['street_name' => '玄滩镇', 'product_count' => StoreBranchProduct::where('store_id',6)->count()],
['street_name' => '云锦镇', 'product_count' => StoreBranchProduct::where('store_id',7)->count()],
];
$townProductCount = StoreProduct::count();
$product_count = StoreBranchProduct::group('product_id')->order('total_sales desc')->limit(20)->field('image,product_id,store_name,sum(sales) as total_sales')->select();

View File

@ -4,6 +4,7 @@ namespace app\statistics\logic;
use app\common\logic\BaseLogic;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\system_store\SystemStore;
class ProductLogic extends BaseLogic
{
@ -24,6 +25,9 @@ class ProductLogic extends BaseLogic
} else {
$weeklyNewProductTotalGrowthRate =bcdiv(($todayNewProductCount - $yestertodayNewProductCount),$yestertodayNewProductCount) * 100;
}
$todayMerchantCount=SystemStore::where($where)->whereDay('create_time',$time)->count();
$where['is_show']=1;
$yestertodayMerchantCount=SystemStore::where($where)->count();
$data = [
"totalProductCounInfo" => [
"todayProductCount" => $todayProductCount,
@ -36,8 +40,8 @@ class ProductLogic extends BaseLogic
"weeklyNewProductTotalGrowthRate" => $weeklyNewProductTotalGrowthRate
],
"merchantCountInfo" => [
"todayMerchantCount" => 1,
"yestertodayMerchantCount" => 1,
"todayMerchantCount" => $todayMerchantCount,
"yestertodayMerchantCount" => $yestertodayMerchantCount,
"weeklyMerchantGrowthRate" => 0
]
];

View File

@ -416,6 +416,7 @@ class StoreOrderController extends BaseAdminController
'price' => $params['price'],
'recharge_type' => 'INDUSTRYMEMBERS',
'user_ship'=>$params['user_ship']??0,
'type'=>1,
];
$order = UserRecharge::create($data);
$order['pay_price'] = $order['price'];