]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix(BC-248): actionGetStores — вернуть UUID из Products1c вместо числового ID из...
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 1 Apr 2026 14:41:26 +0000 (17:41 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 1 Apr 2026 14:41:26 +0000 (17:41 +0300)
Max-бот ожидает UUID магазинов (Products1c.id), а не числовой ID из CityStore.
Удалён закомментированный дубликат метода.

erp24/api2/controllers/ClientController.php

index 9a9dbe9352a93db32236ec809e68e0f46420028d..55174ca44a277dea0dbb987548c13aee5c13fd21 100644 (file)
@@ -1141,23 +1141,13 @@ class ClientController extends BaseController
         return $this->asJson(['response' => $mess]);
     }
 
-//    public function actionGetStores() {
-//        $stores = Products1c::find()->with('store')->where(['tip' => 'city_store'])->andWhere(['view' => '1'])->all();
-//        $result = [];
-//        foreach ($stores as $store) {
-//            if (!empty($store->store->name ?? null)) {
-//                $result [] = ['guid' => $store->id ?? null, 'id' => $store->store->id ?? null, 'name' => $store->store->name ?? null];
-//            }
-//        }
-//        return $this->asJson(['response' => $result]);
-//    }
     public function actionGetStores()
     {
-        $stores = CityStore::find()->all();
+        $stores = Products1c::find()->with('store')->where(['tip' => 'city_store'])->andWhere(['view' => '1'])->all();
         $result = [];
         foreach ($stores as $store) {
-            if (!empty($store->name ?? null)) {
-                $result [] = ['id' => $store->id, 'name' => $store->name];
+            if (!empty($store->store->name ?? null)) {
+                $result[] = ['id' => $store->id, 'name' => $store->store->name];
             }
         }
         return $this->asJson(['response' => $result]);