Update services/facebookService.js
Browse files
services/facebookService.js
CHANGED
|
@@ -109,7 +109,11 @@ async function sendResponse(senderPsid, responseText) {
|
|
| 109 |
const currentUrl = imageUrls[i];
|
| 110 |
const currentBlock = blocks[i] || "";
|
| 111 |
|
| 112 |
-
const codeMatch =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
const itemCode = codeMatch ? codeMatch[1].trim() : `Mẫu ${i + 1}`;
|
| 114 |
|
| 115 |
const nameMatch = currentBlock.match(/(?:👕|👚|👕|🌱|👉|^)\s*([^\n$*|]+)/m);
|
|
|
|
| 109 |
const currentUrl = imageUrls[i];
|
| 110 |
const currentBlock = blocks[i] || "";
|
| 111 |
|
| 112 |
+
const codeMatch =
|
| 113 |
+
currentBlock.match(/\*\*Mã:\s*([^*\[\n]+)\*\*/i) ||
|
| 114 |
+
currentBlock.match(/Mã\s*(?:sản phẩm)?:\s*([^\n\[|-]+)/i) ||
|
| 115 |
+
currentBlock.match(/(?:🔹|👉|^)\s*([A-Z0-9]{2,5})\b/i); // Quét quét trực tiếp mã chữ+số dạng G01, BB02...
|
| 116 |
+
|
| 117 |
const itemCode = codeMatch ? codeMatch[1].trim() : `Mẫu ${i + 1}`;
|
| 118 |
|
| 119 |
const nameMatch = currentBlock.match(/(?:👕|👚|👕|🌱|👉|^)\s*([^\n$*|]+)/m);
|