This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"><acl><resources><resource id="Magento_Backend::admin"><resource id="Magento_Customer::customer"><resource id="Esun_CustomerMessage::messages" title="Customer Messages" sortOrder="90"/></resource></resource></resources></acl></config>
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Adminhtml\Order\View">
<plugin name="esun_customer_message_order_button" type="Esun\CustomerMessage\Plugin\Adminhtml\OrderViewMessagesButton" sortOrder="50"/>
</type>
</config>
@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"><menu><add id="Esun_CustomerMessage::messages" title="Customer Messages" module="Esun_CustomerMessage" sortOrder="90" parent="Magento_Customer::customer" action="esun_customer_message/message/index" resource="Esun_CustomerMessage::messages"/></menu></config>
@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"><router id="admin"><route id="esun_customer_message" frontName="esun_customer_message"><module name="Esun_CustomerMessage" before="Magento_Backend"/></route></router></config>
@@ -0,0 +1,71 @@
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="esun_customer_message" resource="default" engine="innodb" comment="Customer Messages">
<column xsi:type="int" name="message_id" unsigned="true" nullable="false" identity="true" comment="Message ID"/>
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
<column xsi:type="text" name="content" nullable="false" comment="Content"/>
<column xsi:type="varchar" name="message_type" nullable="false" length="32" default="notice" comment="Message Type"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="false" default="0" comment="Store ID"/>
<column xsi:type="smallint" name="is_active" unsigned="true" nullable="false" default="1" comment="Is Active"/>
<column xsi:type="timestamp" name="expires_at" nullable="true" on_update="false" comment="Expires At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="message_id"/></constraint>
<index referenceId="ESUN_CUSTOMER_MESSAGE_ACTIVE_STORE" indexType="btree"><column name="is_active"/><column name="store_id"/><column name="created_at"/></index>
</table>
<table name="esun_customer_message_recipient" resource="default" engine="innodb" comment="Customer Message Recipients">
<column xsi:type="int" name="recipient_id" unsigned="true" nullable="false" identity="true" comment="Recipient ID"/>
<column xsi:type="int" name="message_id" unsigned="true" nullable="false" comment="Message ID"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="false" comment="Customer ID"/>
<column xsi:type="smallint" name="is_read" unsigned="true" nullable="false" default="0" comment="Is Read"/>
<column xsi:type="timestamp" name="read_at" nullable="true" on_update="false" comment="Read At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="recipient_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_CUSTOMER_MESSAGE_RECIPIENT_UNQ"><column name="message_id"/><column name="customer_id"/></constraint>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_RECIPIENT_MESSAGE_FK" table="esun_customer_message_recipient" column="message_id" referenceTable="esun_customer_message" referenceColumn="message_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_RECIPIENT_CUSTOMER_FK" table="esun_customer_message_recipient" column="customer_id" referenceTable="customer_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
<index referenceId="ESUN_CUSTOMER_MESSAGE_RECIPIENT_CUSTOMER_READ" indexType="btree"><column name="customer_id"/><column name="is_read"/></index>
</table>
<table name="esun_customer_message_thread" resource="default" engine="innodb" comment="Customer Message Conversations">
<column xsi:type="int" name="thread_id" unsigned="true" nullable="false" identity="true" comment="Thread ID"/>
<column xsi:type="varchar" name="thread_type" nullable="false" length="16" default="general" comment="Thread Type"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="false" comment="Customer ID"/>
<column xsi:type="int" name="order_id" unsigned="true" nullable="true" comment="Order ID"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="false" default="0" comment="Store ID"/>
<column xsi:type="varchar" name="subject" nullable="false" length="255" comment="Subject"/>
<column xsi:type="varchar" name="status" nullable="false" length="24" default="awaiting_admin" comment="Conversation Status"/>
<column xsi:type="int" name="last_message_id" unsigned="true" nullable="true" comment="Last Message ID"/>
<column xsi:type="int" name="customer_unread_count" unsigned="true" nullable="false" default="0" comment="Customer Unread Count"/>
<column xsi:type="int" name="admin_unread_count" unsigned="true" nullable="false" default="0" comment="Admin Unread Count"/>
<column xsi:type="timestamp" name="last_message_at" nullable="true" on_update="false" comment="Last Message At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="thread_id"/></constraint>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_THREAD_CUSTOMER_FK" table="esun_customer_message_thread" column="customer_id" referenceTable="customer_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_THREAD_ORDER_FK" table="esun_customer_message_thread" column="order_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="unique" referenceId="ESUN_CUSTOMER_MESSAGE_THREAD_ORDER_UNQ"><column name="order_id"/></constraint>
<index referenceId="ESUN_CUSTOMER_MESSAGE_THREAD_CUSTOMER_ACTIVITY" indexType="btree"><column name="customer_id"/><column name="last_message_at"/></index>
<index referenceId="ESUN_CUSTOMER_MESSAGE_THREAD_ADMIN_QUEUE" indexType="btree"><column name="admin_unread_count"/><column name="last_message_at"/></index>
</table>
<table name="esun_customer_message_entry" resource="default" engine="innodb" comment="Customer Conversation Messages">
<column xsi:type="int" name="entry_id" unsigned="true" nullable="false" identity="true" comment="Entry ID"/>
<column xsi:type="int" name="thread_id" unsigned="true" nullable="false" comment="Thread ID"/>
<column xsi:type="varchar" name="sender_type" nullable="false" length="16" comment="Sender Type"/>
<column xsi:type="int" name="sender_id" unsigned="true" nullable="false" default="0" comment="Sender ID"/>
<column xsi:type="text" name="content" nullable="false" comment="Message Content"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entry_id"/></constraint>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_ENTRY_THREAD_FK" table="esun_customer_message_entry" column="thread_id" referenceTable="esun_customer_message_thread" referenceColumn="thread_id" onDelete="CASCADE"/>
<index referenceId="ESUN_CUSTOMER_MESSAGE_ENTRY_THREAD_CREATED" indexType="btree"><column name="thread_id"/><column name="created_at"/></index>
</table>
<table name="esun_customer_message_attachment" resource="default" engine="innodb" comment="Customer Message Attachments">
<column xsi:type="int" name="attachment_id" unsigned="true" nullable="false" identity="true" comment="Attachment ID"/>
<column xsi:type="int" name="entry_id" unsigned="true" nullable="false" comment="Entry ID"/>
<column xsi:type="varchar" name="original_name" nullable="false" length="255" comment="Original File Name"/>
<column xsi:type="varchar" name="storage_path" nullable="false" length="512" comment="Private Storage Path"/>
<column xsi:type="varchar" name="mime_type" nullable="false" length="64" comment="MIME Type"/>
<column xsi:type="int" name="file_size" unsigned="true" nullable="false" comment="File Size"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="attachment_id"/></constraint>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_MESSAGE_ATTACHMENT_ENTRY_FK" table="esun_customer_message_attachment" column="entry_id" referenceTable="esun_customer_message_entry" referenceColumn="entry_id" onDelete="CASCADE"/>
<index referenceId="ESUN_CUSTOMER_MESSAGE_ATTACHMENT_ENTRY" indexType="btree"><column name="entry_id"/></index>
</table>
</schema>
@@ -0,0 +1,100 @@
{
"esun_customer_message": {
"column": {
"message_id": true,
"title": true,
"content": true,
"message_type": true,
"store_id": true,
"is_active": true,
"expires_at": true,
"created_at": true
},
"index": {
"ESUN_CUSTOMER_MESSAGE_IS_ACTIVE_STORE_ID_CREATED_AT": true
},
"constraint": {
"PRIMARY": true
}
},
"esun_customer_message_recipient": {
"column": {
"recipient_id": true,
"message_id": true,
"customer_id": true,
"is_read": true,
"read_at": true
},
"index": {
"ESUN_CUSTOMER_MESSAGE_RECIPIENT_CUSTOMER_ID_IS_READ": true
},
"constraint": {
"PRIMARY": true,
"ESUN_CUSTOMER_MESSAGE_RECIPIENT_MESSAGE_ID_CUSTOMER_ID": true,
"FK_FA1F9D6D6857DA4089E6B19102455BC3": true,
"ESUN_CSTR_MESSAGE_RECIPIENT_CSTR_ID_CSTR_ENTT_ENTT_ID": true
}
},
"esun_customer_message_thread": {
"column": {
"thread_id": true,
"thread_type": true,
"customer_id": true,
"order_id": true,
"store_id": true,
"subject": true,
"status": true,
"last_message_id": true,
"customer_unread_count": true,
"admin_unread_count": true,
"last_message_at": true,
"created_at": true,
"updated_at": true
},
"index": {
"ESUN_CUSTOMER_MESSAGE_THREAD_CUSTOMER_ID_LAST_MESSAGE_AT": true,
"ESUN_CUSTOMER_MESSAGE_THREAD_ADMIN_UNREAD_COUNT_LAST_MESSAGE_AT": true
},
"constraint": {
"PRIMARY": true,
"ESUN_CSTR_MESSAGE_THREAD_CSTR_ID_CSTR_ENTT_ENTT_ID": true,
"ESUN_CUSTOMER_MESSAGE_THREAD_ORDER_ID_SALES_ORDER_ENTITY_ID": true,
"ESUN_CUSTOMER_MESSAGE_THREAD_ORDER_ID": true
}
},
"esun_customer_message_entry": {
"column": {
"entry_id": true,
"thread_id": true,
"sender_type": true,
"sender_id": true,
"content": true,
"created_at": true
},
"index": {
"ESUN_CUSTOMER_MESSAGE_ENTRY_THREAD_ID_CREATED_AT": true
},
"constraint": {
"PRIMARY": true,
"FK_07689EF6ABC3F370CA3CEF592CBAAFE2": true
}
},
"esun_customer_message_attachment": {
"column": {
"attachment_id": true,
"entry_id": true,
"original_name": true,
"storage_path": true,
"mime_type": true,
"file_size": true,
"created_at": true
},
"index": {
"ESUN_CUSTOMER_MESSAGE_ATTACHMENT_ENTRY_ID": true
},
"constraint": {
"PRIMARY": true,
"FK_89AAD325176E4D6C941006B549BD21FA": true
}
}
}
@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"><router id="standard"><route id="customer_message" frontName="customer-message"><module name="Esun_CustomerMessage"/></route></router></config>
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Esun_CustomerMessage"><sequence><module name="Magento_Customer"/><module name="Esun_Customer"/></sequence></module>
</config>