| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Heanup\App\Api\Controller;
- use Heanup\App\Api\Config\Code;
- use Heanup\App\Api\Controller;
- use Heanup\App\Api\Package\Database\Num;
- use Heanup\Library\Sms\SmsFree;
- class Api extends Controller
- {
- protected function main()
- {
- $do = $this->getRequest()->string("do", "Country");
- $lib = new SmsFree();
- if ($do == "Country") {
- $data = $lib->getCountry();
- $data = array_map(function ($a) {
- $a['flag'] = "http://sms.x.97admin.com/flag/" . $a['flag'] . ".png";
- return $a;
- }, $data);
- $this->showSuccess($data);
- }
- if ($do = "List") {
- $country = $this->getQuery()->string("Country");
- if ($country) {
- $where = ['country' => $country];
- } else {
- $where = [];
- }
- $page = $this->getQuery()->intval("page", 1);
- $pgSize = 20;
- $data = Num::getPageList($where, "", $page, $pgSize, ['id' => true]);
- $data = array_map(function ($a) {
- $a['flag'] = "http://sms.x.97admin.com" . Code::getData($a['country'])['flag'];
- return $a;
- }, $data['data']);
- $this->showSuccess($data);
- }
- }
- }
|