| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace bizHd\stat\classes;
- use Yii;
- use bizHd\base\classes\BaseClass;
- class StatStudentClass extends BaseClass
- {
- public static $baseFile = '\bizHd\stat\models\StatStudent';
- public static function addStudent($shop, $date = null)
- {
- $shopId = $shop->id;
- $sjId = $shop->sjId;
- $date = isset($date) ? $date : date("Ymd");
- $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $date], true);
- if (empty($stat)) {
- $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $date], true);
- }
- $stat->riseNum += 1;
- $stat->save();
- StatStudentMonthClass::addStudent($shop);
- }
- //今天的新学员数 ssh 20210524
- public static function getTodayNum($shop)
- {
- $today = date("Ymd");
- $shopId = $shop->id;
- $sjId = $shop->sjId;
- $new = self::getByCondition(['time' => $today, 'sjId' => $sjId, 'shopId' => $shopId], true);
- return $new->riseNum ?? 0;
- }
- }
|