255], [['trade_type'], 'string', 'max' => 100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'status' => 'Status', 'payment_type' => 'Payment Type', 'payment_identifier' => 'Payment Identifier', 'trade_type' => 'Trade Type', 'is_pay_group' => 'Is Pay Group', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * @param array $data * * @return self */ public static function setData(array $data): self { $model = self::findOne(['payment_identifier' => $data['payment_identifier'], 'status' => StatusEnum::ENABLED, 'mall_id' => $data['mall_id']]); if (!$model) { $model = new self(); $model->loadDefaultValues(); $model->load($data, ''); if (!$model->save()) { throw new \RuntimeException('数据写入失败'); } } return $model; } }