Przeglądaj źródła

mchsrv act=merchant_refillop=goods update

xiaoyu 3 lat temu
rodzic
commit
6c6385aa0b
1 zmienionych plików z 5 dodań i 20 usunięć
  1. 5 20
      mchsrv/control/merchant_refill.php

+ 5 - 20
mchsrv/control/merchant_refill.php

@@ -13,27 +13,12 @@ class merchant_refillControl extends mbMerchantControl
 
     public function goodsOp()
     {
-        $goods = refill\RefillFactory::instance()->goods();
+        global $config;
+        $oil_amount = $config['refill_oil_specs'];
+        $phone_amount = $config['refill_phone_specs'];
+        $phone_small_amount = $config['refill_phone_small_specs'];
 
-        $result['oil_amount'] = [];
-        $result['phone_amount'] = [];
-        foreach ($goods as $type => $specs)
-        {
-            if($type == mtopcard\SinopecCard || $type == mtopcard\PetroChinaCard) {
-                foreach ($specs as $spec) {
-                    $result['oil_amount'][] = $spec;
-                }
-            }
-            else {
-                foreach ($specs as $spec) {
-                    $result['phone_amount'][] = $spec;
-                }
-            }
-        }
-
-        $oil_amount = array_unique($result['oil_amount']);
-        sort($oil_amount);
-        $phone_amount = array_unique($result['phone_amount']);
+        $phone_amount = array_merge($phone_amount, $phone_small_amount);
         sort($phone_amount);
 
         return self::outsuccess(['oil_amount' => $oil_amount,'phone_amount' => $phone_amount]);