phanquocdat123 commited on
Commit
981976f
·
verified ·
1 Parent(s): 6235346

Update services/facebookService.js

Browse files
Files changed (1) hide show
  1. services/facebookService.js +5 -1
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 = currentBlock.match(/\*\*Mã:\s*([^*]+)\*\*/i) || currentBlock.match(/Mã:\s*([^\n[-]+)/i);
 
 
 
 
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);