getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getStatusList() { return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } /** * 获取品牌商名称 */ public function getBrandNameAttr($value,$data){ $model = new \app\admin\model\xilufitness\brand\Index; $brand_id = $value ? $value : ($data['brand_id'] ?? 0); return $model->where('id',$brand_id)->value('brand_name'); } }