'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'amount' => 'Amount', 'withdraw_log_id' => 'Withdraw Log ID', 'from' => 'From', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'type' => 'Type', ]; } /** * 保存数据 * @param array $params * @return bool|UserWallet */ public static function setData(array $params) { try { if (!empty($params['id'])) { $model = self::findOne(['id' => $params['id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if (empty($model)) throw new Exception('数据异常'); } if (empty($model)) { $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; } } }