getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); } }); } public function getStatusList() { return ['1' => __('Status 1'), '2' => __('Status 2')]; } public function getTopList() { return ['0' => __('Top 0'), '1' => __('Top 1')]; } public function getEvaluateTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['evaluate_time']) ? $data['evaluate_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setEvaluateTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getTopTextAttr($value, $data) { $value = $value ? $value : (isset($data['top']) ? $data['top'] : ''); $list = $this->getTopList(); return isset($list[$value]) ? $list[$value] : ''; } public function user() { return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function lib() { return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function classesorder() { return $this->belongsTo(\app\common\model\school\classes\order\Order::class, 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function manystore() { return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function shop() { return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function teacher() { return $this->belongsTo(Teacher::class, 'teacher_id', 'id', [], 'LEFT')->setEagerlyType(0); } }