100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'order_id' => 'Order ID', 'store_id' => 'Store ID', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'order_no' => 'Order No', 'is_settlement' => 'Is Settlement', 'settlement_at' => 'Settlement At', ]; } /** * 保存数据 * @param array $params * @return bool */ 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 (empty($model)) throw new \Exception('数据不存在或已删除'); } 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; } } }