文件描述 * 2019/8/7 11:05 * *  ┏┓  ┏┓+ + * ┏┛┻━━━┛┻┓ + + * ┃       ┃   * ┃   ━   ┃ ++ + + + * * ████━████ ┃+ * ┃       ┃ + * ┃   ┻   ┃ * ┃       ┃ + + * ┗━┓   ┏━┛ *   ┃   ┃            *   ┃   ┃ + + + + *   ┃   ┃ *   ┃   ┃ + 神兽保佑 *   ┃   ┃ 代码无bug   *   ┃   ┃  +          *   ┃    ┗━━━┓ + + *   ┃      ┣┓ *   ┃      ┏┛ *   ┗┓┓┏━┳┓┏┛ + + + + *    ┃┫┫ ┃┫┫ *   ┗┻┛ ┗┻┛+ + + + */ namespace app\api\controller; use app\common\model\AreaModel; use think\Exception; class AreaController extends ApiController { /** * 不需要鉴权方法 * index、save不需要鉴权 * ['index','save'] * 所有方法都不需要鉴权 * [*] */ protected $noAuth = ['index']; /** * @apiVersion 1.0.0 * @api {get} /area/index 地址列表(朱晓伟) * @apiName index * @apiGroup Version * @apiSuccessExample Success-Response: * { * "code": 200, * "message": "成功", * "data": { * "version": 1.0.1, * "url": "http://www.baidu.com", * "describe": "有重大更新啦!!", * "update_method": 0,// 更新方式(0:普通更新;1、强制更新) * } * } * @apiErrorExample Error-Response: * { * "code": 200, * "message": "无更新", * "data": {} * } */ public function index() { $field = 'id, area_name, parent_area_id'; $areaTree = AreaModel::with(['childs','childs.childs']) ->field($field)->where('parent_area_id',0)->all()->toArray(); return self::returnMsg(self::SUCCESS, '无更新',$areaTree); } }