100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'trade_id' => 'Trade ID', 'trade_no' => 'Trade No', 'full_order_info' => 'Full Order Info', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function setData(array $params) { try { if(!empty($params['id'])){ $model = self::findOne(['mall_id' => $params['mall_id'], 'id' => $params['id'], 'status' => [StatusEnum::ENABLED,StatusEnum::DISABLED]]); if (!$model) { throw new RuntimeException('数据不存在或已删除'); } }else{ $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '')) throw new Exception($model->getErrorMessage()); if (!$model->save()) throw new Exception($model->getErrorMessage()); return $model; } catch (Exception $e) { self::$static_error = $e->getMessage(); return false; } } public function getFillOrders() { return $this->hasMany(CloudStockFillOrder::class, ['batch_fill_order_id' => 'id']); } public function getPaymentTrade() { return $this->hasOne(PaymentTrade::class, ['id' => 'trade_id']); } }