🐛 Fix status query condition
This commit is contained in:
parent
17e0fa3b18
commit
9f7205ba14
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@ -4,10 +4,7 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix status validation issue">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix bugs in status" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/statuses.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/statuses.go" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@ -152,7 +149,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":sparkles: Recommend app component" />
|
|
||||||
<MESSAGE value=":bug: Bug fixes" />
|
<MESSAGE value=":bug: Bug fixes" />
|
||||||
<MESSAGE value=":arrow_up: Fix notification listen" />
|
<MESSAGE value=":arrow_up: Fix notification listen" />
|
||||||
<MESSAGE value=":bug: Fix magic token's foreign key" />
|
<MESSAGE value=":bug: Fix magic token's foreign key" />
|
||||||
@ -177,7 +173,8 @@
|
|||||||
<MESSAGE value=":bug: Not supposed to appear to status at the same time" />
|
<MESSAGE value=":bug: Not supposed to appear to status at the same time" />
|
||||||
<MESSAGE value=":ambulance: Fix getting user panic again..." />
|
<MESSAGE value=":ambulance: Fix getting user panic again..." />
|
||||||
<MESSAGE value=":bug: Fix status validation issue" />
|
<MESSAGE value=":bug: Fix status validation issue" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix status validation issue" />
|
<MESSAGE value=":bug: Fix bugs in status" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix bugs in status" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -21,7 +21,7 @@ func GetStatus(uid uint) (models.Status, error) {
|
|||||||
var status models.Status
|
var status models.Status
|
||||||
if err := database.C.
|
if err := database.C.
|
||||||
Where("account_id = ?", uid).
|
Where("account_id = ?", uid).
|
||||||
Where("clear_at < ?", time.Now()).
|
Where("clear_at > ?", time.Now()).
|
||||||
First(&status).Error; err != nil {
|
First(&status).Error; err != nil {
|
||||||
return status, err
|
return status, err
|
||||||
} else {
|
} else {
|
||||||
@ -77,7 +77,7 @@ func EditStatus(user models.Account, status models.Status) (models.Status, error
|
|||||||
func ClearStatus(user models.Account) error {
|
func ClearStatus(user models.Account) error {
|
||||||
if err := database.C.
|
if err := database.C.
|
||||||
Where("account_id = ?", user.ID).
|
Where("account_id = ?", user.ID).
|
||||||
Where("clear_at < ?", time.Now()).
|
Where("clear_at > ?", time.Now()).
|
||||||
Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil {
|
Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user