fix(shayegan): register customers as floating detail jobs
Customer accounts are not sub-accounts of moin 12101. Send Job/Put with JobNumber moin plus customer id. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
فرمت هر خط:
|
فرمت هر خط:
|
||||||
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||||
|
|
||||||
- 2026-11-02 | جدول اسناد شایگان | `shayeganTable.vue` + `ShayeganController::table` | مثل پرگار با BaseTable و TableEngine؛ صفحهبندی «مورد یافت شد / ردیف» نه page انگلیسی
|
- 2026-11-02 | جدول اسناد شایگان | `shayeganTable.vue` + `ShayeganController::table` | BaseTable؛ پاسخ بدون `query` را خود فرانت به `{rows,query}` برمیگرداند. ستون عملیات `ops` است تا در RTL هشدار fixed ندهد
|
||||||
- 2026-11-02 | شماره تفصیلی شایگان | `ShayeganSyncService::registerCustomer` | `AccountNumber` = معین + کد کاربری. معین 12101 و مشتری 530 → `12101530`
|
- 2026-11-02 | مشتری تفصیلی شناور | `ShayeganSyncService::registerCustomer` → `Job/Put` | معین 12101 حساب جدا نمیسازد؛ `JobNumber` = معین+کد (`12101530`). گروه: setting `shayegan_job_group`
|
||||||
- 2026-11-02 | دیباگ تبادل شایگان | `ShayeganClient::request` + `registerCustomer` / health / retry | پاسخ ادمین `client_request` و `server_response` دارد؛ رمز DB و Auth برابر `***`
|
- 2026-11-02 | دیباگ تبادل شایگان | `ShayeganClient::request` + `registerCustomer` / health / retry | پاسخ ادمین `client_request` و `server_response` دارد؛ رمز DB و Auth برابر `***`
|
||||||
- 2026-11-02 | سه سطح شایگان | `ShayeganSyncService::registerCustomer` + migration `2026_11_02_000001` | کل 121، معین `12101`، تفصیلی = معین+کد کاربری (`12101530`). `1210101` غلط است
|
- 2026-11-02 | سه سطح شایگان | `ShayeganSyncService::registerCustomer` + migration `2026_11_02_000001` | کل 121، معین `12101`، تفصیلی = معین+کد کاربری (`12101530`). `1210101` غلط است
|
||||||
- 2026-11-01 | پیامک تبدیل | `CopperConvertRequestService::notifyCustomer` | بعد از تأیید یا رد، پیامک جدا به موبایل مشتری؛ خطا پیامک سفارش را برنمیگرداند
|
- 2026-11-01 | پیامک تبدیل | `CopperConvertRequestService::notifyCustomer` | بعد از تأیید یا رد، پیامک جدا به موبایل مشتری؛ خطا پیامک سفارش را برنمیگرداند
|
||||||
|
|||||||
@@ -115,28 +115,29 @@ class ShayeganSyncService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$moinRaw = trim($this->config->getString('shayegan_moin_customer', ''));
|
$moinRaw = trim($this->config->getString('shayegan_moin_customer', ''));
|
||||||
$moinNumber = is_numeric($moinRaw) ? (int) $moinRaw : $moinRaw;
|
|
||||||
$name = trim((string) ($customer->name ?? ''));
|
$name = trim((string) ($customer->name ?? ''));
|
||||||
if ($name === '') {
|
if ($name === '') {
|
||||||
$name = 'مشتری ' . $customer->id;
|
$name = 'مشتری ' . $customer->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// تفصیلی = معین + کد کاربری. مثال: معین 12101 و مشتری 530 → 12101530
|
// مشتری تفصیلی شناور است (Job/Put)، نه حساب زیر معین. شماره = معین + کد کاربری.
|
||||||
$requestedAccountNumber = $moinRaw . ((string) (int) $customer->id);
|
$requestedAccountNumber = $moinRaw . ((string) (int) $customer->id);
|
||||||
|
|
||||||
$guid = (string) Str::uuid();
|
$guid = (string) Str::uuid();
|
||||||
$put = [[
|
$put = [[
|
||||||
'MoinNumber' => $moinNumber,
|
'JobNumber' => $requestedAccountNumber,
|
||||||
'AccountNumber' => $requestedAccountNumber,
|
'JobName' => mb_substr($name, 0, 200),
|
||||||
'AccountTypeId' => 1,
|
|
||||||
'AccountName' => mb_substr($name, 0, 200),
|
|
||||||
'Mobile' => trim((string) ($customer->mobile ?? '')) ?: null,
|
'Mobile' => trim((string) ($customer->mobile ?? '')) ?: null,
|
||||||
'mellicode' => trim((string) ($customer->n_code ?? '')) ?: null,
|
'mellicode' => trim((string) ($customer->n_code ?? '')) ?: null,
|
||||||
'GuId' => $guid,
|
'GuId' => $guid,
|
||||||
'UpdateKind' => 0,
|
'UpdateKind' => 0,
|
||||||
]];
|
]];
|
||||||
|
$jobGroup = trim($this->config->getString('shayegan_job_group', ''));
|
||||||
|
if ($jobGroup !== '') {
|
||||||
|
$put[0]['JobGroupNumber'] = $jobGroup;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->client->put('Account/Put', $put);
|
$result = $this->client->put('Job/Put', $put);
|
||||||
$accountNumber = trim((string) ($result['number'] ?? ''));
|
$accountNumber = trim((string) ($result['number'] ?? ''));
|
||||||
$exchange = $this->client->debugExchange($result);
|
$exchange = $this->client->debugExchange($result);
|
||||||
|
|
||||||
@@ -163,10 +164,10 @@ class ShayeganSyncService
|
|||||||
$row->withdraw_id = null;
|
$row->withdraw_id = null;
|
||||||
$row->product_id = null;
|
$row->product_id = null;
|
||||||
$row->amount = null;
|
$row->amount = null;
|
||||||
$row->desc = 'ثبت حساب مشتری';
|
$row->desc = 'ثبت تفصیلی شناور مشتری';
|
||||||
$row->type = self::TYPE_CUSTOMER;
|
$row->type = self::TYPE_CUSTOMER;
|
||||||
$row->date = now();
|
$row->date = now();
|
||||||
$row->endpoint = 'Account/Put';
|
$row->endpoint = 'Job/Put';
|
||||||
$row->request_guid = $guid;
|
$row->request_guid = $guid;
|
||||||
$row->shayegan_number = $accountNumber;
|
$row->shayegan_number = $accountNumber;
|
||||||
$row->shayegan_guid = $result['guid'] ?? null;
|
$row->shayegan_guid = $result['guid'] ?? null;
|
||||||
@@ -180,7 +181,7 @@ class ShayeganSyncService
|
|||||||
|
|
||||||
return array_merge([
|
return array_merge([
|
||||||
'ok' => true,
|
'ok' => true,
|
||||||
'message' => 'حساب تفصیلی مشتری در شایگان ایجاد شد',
|
'message' => 'تفصیلی شناور مشتری در شایگان ایجاد شد',
|
||||||
'moshtari_code' => $accountNumber,
|
'moshtari_code' => $accountNumber,
|
||||||
], $exchange);
|
], $exchange);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user