255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'source_table' => 'Source Table', 'source_table_id' => 'Source Table ID', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'total_money' => 'Total Money', 'user_id' => 'User ID', 'money' => 'Money', 'rate' => 'Rate', 'is_frozen' => 'Is Frozen', 'agent_user_id' => 'agent_user_id', 'desc' => 'desc', 'unit_goods_price' => 'unit_goods_price', 'num' => 'num', ]; } 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, '')) 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; } } }