StoreDailySalesSt.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\api\model;
  13. use app\common\model\StoreDailySalesSt as StoreStModel;
  14. /**
  15. * 商城销售数据每日统计模型
  16. * Class ShopsDailySalesSt
  17. * @package app\common\model
  18. */
  19. class StoreDailySalesSt extends StoreStModel
  20. {
  21. public function addOne($tj,$dayMid){
  22. $now = time();
  23. $temp['sale_volume'] = $tj['sale_volume'];
  24. $temp['order_count'] = $tj['order_count'];
  25. //todo 其它统计数据待后续补充
  26. $temp['st_time'] = $dayMid;
  27. $temp['st_month'] = substr($dayMid,0,6);
  28. $temp['create_time'] = $now;
  29. $temp['update_time'] = $now;
  30. //批量插入,当门店过多时,需优化成分批插入
  31. self::where('st_time',$dayMid)->delete();
  32. self::insert($temp);
  33. }
  34. }