123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\api;
- use think\facade\Db;
- /**
- * Description of LocationApi
- *
- * @author sgq
- */
- class LocationApi {
- public static function findProvinceSelect() {
- $where = [];
- $where[] = ["code", "like", "%0000"];
- return Db::table("un_common_location")->where($where)->select()->toArray();
- }
- /**
- * 通过地区代码获取地区名
- * @param type $code
- * @param type $isfull
- * @return type
- */
- public static function getNameByCode($code, $isfull = false) {
- $where = [];
- $where[] = ["code", "=", $code];
- $field = $isfull ? "fullName" : "name";
- return Db::table("un_common_location")->where($where)->find()[$field];
- }
- }
|