39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\common\service;
|
|
|
|
use app\common\model\TimeZone;
|
|
use app\constant\ResponseCode;
|
|
use think\Exception;
|
|
|
|
class TimeZoneService
|
|
{
|
|
|
|
public function getTimeZone($request)
|
|
{
|
|
try {
|
|
$time_zone = TimeZone::order('sort desc, id asc')->where(['status'=>1]);
|
|
$page = isset($request['page']) ? $request['page'] : 1;
|
|
$limit = isset($request['limit']) ? $request['limit'] : 10;
|
|
$total = $time_zone->count();
|
|
|
|
$list = $time_zone->page($page, $limit)->field('id,name,abbr,text,offset')->select();
|
|
|
|
return [
|
|
'code' => ResponseCode::SUCCESS,
|
|
'data' => [
|
|
'list' => $list,
|
|
'total' => $total,
|
|
'page' => $page,
|
|
],
|
|
'msg' => 'success'
|
|
];
|
|
}catch (Exception $e){
|
|
return [
|
|
'code' => ResponseCode::FAIL,
|
|
'msg' => $e->getMessage()
|
|
];
|
|
}
|
|
}
|
|
|
|
} |