diff --git a/app/command/dayValue.php b/app/command/dayValue.php index 3a4f543..eb55c62 100644 --- a/app/command/dayValue.php +++ b/app/command/dayValue.php @@ -35,7 +35,35 @@ class dayValue extends Command protected function execute(Input $input, Output $output) { + $currentDate = date('Y-m-01'); // 获取当前月的第一天 + //判断当月第一天 + if (date('Y-m-d') === $currentDate) { + //获取上个月时间 + list($start, $end) = $this->getLastMonth(); + //根据社区等级分配贡献值 + //重置社区等级 + } + } + public function getLastMonth() + { + // 获取当前日期 + $currentDate = date('Y-m-d'); + // 提取当前日期的年、月和日 + $currentYear = date('Y', strtotime($currentDate)); + $currentMonth = date('m', strtotime($currentDate)); + // 计算上个月的年份和月份 + $lastMonthYear = $currentYear - 1; + $lastMonth = $currentMonth - 1; + // 处理特殊情况:如果上个月的月份小于1,则年份减1,月份设为12 + if ($lastMonth < 1) { + $lastMonthYear--; + $lastMonth = 12; + } + // 获取上个月的第一天和最后一天 + $firstDayOfLastMonth = date('Y-m-01', strtotime("$lastMonthYear-$lastMonth-01")); + $lastDayOfLastMonth = date('Y-m-t', strtotime("$lastMonthYear-$lastMonth-01")); + return [$firstDayOfLastMonth, $lastDayOfLastMonth]; } diff --git a/app/controller/admin/system/admin/Partner.php b/app/controller/admin/system/admin/Partner.php index 1c0ee3a..24b51ae 100644 --- a/app/controller/admin/system/admin/Partner.php +++ b/app/controller/admin/system/admin/Partner.php @@ -63,8 +63,9 @@ class Partner extends BaseController public function update(PartnerRoleValidate $validate) { + $data = $this->request->params(['name', 'ratio', 'is_area', 'area_level', - 'area_id', ['status', 1], ['type', 1], ['max_role_num', 0], 'brand_id', 'trade_id']); + 'area_id', ['status', 1], ['type', 1], ['max_role_num', 0], 'brand_id', 'trade_id','id']); $validate->check($data); if ($data['is_area'] == 1) {