陈德本 5 жил өмнө
parent
commit
37e5ec1628

+ 6 - 0
App/Api/Controller/Countries.php

@@ -6,12 +6,18 @@ namespace Heanup\App\Api\Controller;
 
 use Heanup\App\Api\Config\Code;
 use Heanup\App\Api\Controller;
+use Heanup\App\Api\Package\Database\Num;
 
 class Countries extends Controller
 {
     protected function main()
     {
+        $sql="SELECT DISTINCT country FROM `phone_num`";
+        $db_country=Num::getConnection()->read($sql, []);
+        $db_country=array_column($db_country, "country");
+        $db_country=array_fill_keys($db_country, 1);
         $this->countries=Code::getData();
+        $this->countries=array_intersect_key($this->countries, $db_country);
         $this->render();
     }
 }