Skip to content

admin_role Send gift error handle #98

@iach526526

Description

@iach526526

在 admin_role,__read_db 應該要有當資料庫沒有搜尋到(ret得到空清單)按鈕 ID 時的錯誤應對,應該顯示錯誤訊息、提示有異議請開客服單並disable 按鈕

        def __read_db(self, btn_id: int):
            connection, cursor = link_sql()
            cursor.execute(f"SELECT type, count FROM `gift` WHERE `btnID`={btn_id}")
            ret = cursor.fetchall()
            cursor.execute(f"DELETE FROM `gift` WHERE `btnID`={btn_id}")
            end(connection, cursor)
            return ret[0][0], ret[0][1] # type, count

如果資料庫資料因為非預期原因遺失了,有例外處理是個比較好的做法

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions