StatStudentMonthClass.php 714 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace bizHd\stat\classes;
  3. use Yii;
  4. use bizHd\base\classes\BaseClass;
  5. class StatStudentMonthClass extends BaseClass
  6. {
  7. public static $baseFile = '\bizHd\stat\models\StatStudentMonth';
  8. //月订单数增加 ssh 2020.5.25
  9. public static function addStudent($shop, $month = null)
  10. {
  11. $sjId = $shop->sjId;
  12. $shopId = $shop->id;
  13. $month = isset($month) ? $month : date("Ym");
  14. $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $month], true);
  15. if (empty($stat)) {
  16. $stat = self::add(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $month], true);
  17. }
  18. $stat->riseNum += 1;
  19. $stat->save();
  20. }
  21. }