sj) && !empty($this->sj) ? $this->sj->attributes : []; $deadline = $sj['deadline'] ?? 0; $current = time(); $remain = strtotime($deadline) - $current; if ($remain <= 1296000) { //是否有充值免费续期权限 $hasRight = SjClass::hasRechargeRenewRight($sj, $this->sjExtend); if ($hasRight) { $title = '您的试用期已到,点此免费续期'; if ($remain > 0) { $num = ceil($remain / 86400); $title = "您的试用期还有{$num}天,点此免费续期"; } $notice = array_merge($notice, [['title' => $title, 'action' => '查看', 'page' => '/admin/recharge/renew']]); } else { $title = '您的试用期已到,请及时续费'; if ($remain > 0) { $num = ceil($remain / 86400); $title = "您的试用期还有{$num}天,请及时续费"; } $notice = array_merge($notice, [['title' => $title, 'action' => '续期', 'page' => '/pagesClient/official/renewal']]); } } //引导关注公众号 $admin = $this->admin; $subscribe = $admin['subscribe'] ?? 0; if ($subscribe == 0) { $notice = array_merge($notice, [['title' => '您还未开启提醒,无法接收新订单通知', 'action' => '开启', 'page' => '/pagesClient/official/warn']]); } if (isset($this->shop) && !empty($this->shop)) { //今天访客 $todayVisit = StatVisitService::getTodayVisitNum($this->shopId); //今天开单 $orderData = StatOrderService::getTodayNum($this->shopId); $todayOrder = isset($orderData['riseNum']) ? $orderData['riseNum'] : 0; //今天收入 $incomeData = StatIncomeService::getTodayNum($this->shopId); $todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0; //今天新学员数 $newStudent = StatStudentClass::getTodayNum($this->shop); //今日概况 } else { $todayVisit = 0; $todayIncome = 0.00; $todayOrder = 0; $newStudent = 0; } $todayData = ['visit' => $todayVisit, 'income' => $todayIncome, 'order' => $todayOrder, 'newStudent' => $newStudent]; $incomeStat = []; if (httpUtil::isMiniProgram() == false) { //当月的收入 $currentMonthIncome = StatIncomeMonthService::getCurrentMonthIncome($this->shopId); //上个月收入 $previousMonthIncome = StatIncomeMonthService::getPreviousMonthIncome($this->shopId); //最近7天收入变化趋势 $latestIncome = StatIncomeService::getLatestSevenDay($this->shopId); $incomeStat = [ 'month' => $currentMonthIncome, 'week' => 999, 'previousMonth' => $previousMonthIncome, 'list' => $latestIncome, ]; } $visitStat = [ 'month' => 1999, 'week' => 999, 'list' => ['7.1' => 100, '7.2' => 200, '7.3' => 300, '7.4' => 400, '7.5' => 500], ]; $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : []; util::success([ 'asset' => $shop, 'notice' => $notice, 'todayData' => $todayData, 'visitStat' => $visitStat, 'incomeStat' => $incomeStat, ]); } //常用初始化 public function actionInit() { $dict = dict::get(); $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : []; util::success(['dict' => $dict, 'shop' => $shop]); } }