陈德本 5 năm trước cách đây
mục cha
commit
37e5ec1628
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      App/Api/Controller/Countries.php

+ 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();
     }
 }