public function actionMonth() { $m = new MonthLogic(); $m->reset(); $m->go(2); return $this->render('test'); }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $modelapp\models\ApiMonthDetail*/ /* @var $form yii\widgets\ActiveForm */ ?> <?php $form = ActiveForm::begin(); ?> <div class="api-month-detail-form box-body"> <?php echo $form->field($model, 'time')->dropDownList(\app\helpers\MonthLogic::getMonth()); ?> </div> <div class="box-footer"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
public function updateTheMonth($id, $tip = true) { if ($this->updating > 0) { if ($tip) { \yii::$app->session->setFlash('success', "还有数据尚未更新完成,请稍后"); } } else { $model = self::findOne($id); $model->setScenario('updating'); $model->status = $model->time; $model->update(); $m = new MonthLogic(); $m->reset(); } }