我有问题。我不明白错误的来源。抱歉,我是Yii2开发人员。
这在我的控制器代码中:
max_out = Lambda(lambda x: K_BACKEND.max(x))([out,inputs[:,:,0]])
这是视图中的/索引:
public function getIcons($status_id)
{
$model = Orders::findOne($status_id);
$days = getWorkingDays($model->update_at,date());
$alert = 0; //spunta
if (($model->status_id == 2) && ($days >= 2)) $alert=1; //giallo
if (($model->status_id == 3) && ($days >= 2)) $alert=1;
if (($model->status_id == 4) && ($days >= 10)) $alert=1;
if (($model->status_id == 5) && ($days >= 7)) $alert=1;
if (($model->status_id == 5) && ($days >= 12)) $alert=2; //teschio
if (($model->status_id == 6) && ($days >= 10)) $alert=1;
if (($model->status_id == 7) && ($days >= 8)) $alert=1;
if (($model->status_id == 9) && ($days >= 5)) $alert=1;
if (($model->status_id == 9) && ($days >= 10)) $alert=2;
if($alert = 0) $icons='check'; //spunta
if($alert = 1) $icons='fa fa-exclamation'; //esclamativo
if($alert = 2) $icons='bs-skull info-button-black';
if($model->blocked = 1 && $model->paused = 1) $icons="dollar-sign"; //dollaro
if($model->blocked = 1 && $model->paused = 0) $icons="dollar-sign";
if($model->blocked = 0 && $model->paused = 1) $icons="dollar-sign";
if ($model->save()) Helper::add_history(null, null, $obj_id, '', 'Update', 'Done', 0, 0, 'Order', 1, 0, '');
return $this->redirect(['index']);
}
在视图中,我必须更新状态,并且更新会更改图标。
这是我得到的错误:
调用未定义的方法backend \ models \ Orders :: getIcons()
答案 0 :(得分:-1)
您正在尝试调用静态函数!! 将静态关键字添加到函数getIcons()
的定义中