'ID', 'mall_id' => 'Mall ID', 'discount' => 'Discount', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'child_num' => 'Child Num', 'user_id' => 'user id', 'parent_card_id' => 'parent card id', 'expired_at' => 'expired at', 'card_id' => 'card id', 'is_recycle' => 'is recycle', 'recycle_at' => 'recycle at', 'receive_at' => 'receive at', 'child_discount' => 'child discount', 'child_expired_days' => 'child expired days', 'card_no' => 'card no', ]; } 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; } } }