getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getModuleList() { // return ['open' => __('Module open'), 'page' => __('Module page'), 'category' => __('Module category'), 'first' => __('Module first'), 'other' => __('Module other'), 'gys' => __('Module gys')]; return ['gys' => __('Module gys')]; } public function getTypeList() { return ['banner' => __('Type banner'), 'image' => __('Type image'), 'video' => __('Type video')]; } public function getStatusList() { return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; } public function getModuleTextAttr($value, $data) { $value = $value ? $value : (isset($data['module']) ? $data['module'] : ''); $list = $this->getModuleList(); return isset($list[$value]) ? $list[$value] : ''; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getUserNameAttr($value, $data) { $return = ""; if($data['gys']){ $userinfo = User::get($data['gys']); $return = empty($userinfo)?'':$userinfo->username; } return $return; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function category() { return $this->belongsTo('app\admin\model\wanlshop\Category', 'category_id', 'id', [], 'LEFT')->setEagerlyType(0); } }