123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const handle = require("../until/handle");
- const db_area = require("../database/d_area");
- const code = require('../maps/rcodeMap');
- async function addCity(cityType,cityName){
- let [err,result] = await handle(db_area.addArea(cityType,cityName));
- if(err){throw err}
- return result;
- }
- async function searchCity(cityType){
- let [err,result] = await handle(db_area.searchAreas(cityType));
- if(err){throw err}
- return result;
- }
- async function updateCity(cityId,cityName,cityType){
- if(!cityName&&!cityType){
- throw {rcode:code.notParam,msg:'至少需要一个参数'}
- }
- let [err,result] = await handle(db_area.updateCity(cityId,cityName,cityType));
- if(err){throw err}
- return result;
- }
- module.exports = {
- addCity,
- searchCity,
- updateCity
- }
|