'ID', 'goods_id' => 'Goods ID', 'move_id' => 'Move ID', 'attr_id' => 'Attr ID', 'num' => 'Num', 'total_price' => 'Total Price', 'mall_id' => 'Mall ID', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => 'Status', ]; } public function getAttr() { return $this->hasOne(GoodsAttr::class, ['id' => 'attr_id']); } public function getGoods() { return $this->hasOne(Goods::class, ['id' => 'goods_id']); } public static function setData($params) { try { if(isset($params['id']) && !empty($params['id'])) $model = self::findOne($params['id']); else { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '') || !$model->save()) { throw new \Exception($model->getErrorMessage()); } return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }