<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\Route;


// 注册路由到index模块的News控制器的read操作
/*Route::get(['/', '/:d'], 'index/index');
Route::get(['/well', '/w'], 'index/wellCome');
Route::get('/s', 'index/wellCome');*/


//推荐这种风格 注明控制器
/*IndexController*/
/*Route::rule([
    '/' => 'index/index',
    '/well' => 'index/wellCome',
    '/re' => 'index/read'
], '', 'GET|POST');
// 检测路由规则仅GET请求有效
Route::any('new/:id','News/read',['method'=>'get']);
// 检测路由规则仅GET和POST请求有效
Route::any('new/:id','News/read',['method'=>'get|post']);

Route::get('/he/:id', 'index/hello');

/*StoreController
Route::rule([
    '/saveStore' => 'store/save'
], '', 'GET');


/*Error
Route::rule(['/city/:name' => 'error/index'] , '' ,'GET');*/

Route::group('app', [
    'index' => [ 'app/index/index', [ 'method' => 'get' ] ],
    'agent_detail' => [ 'app/index/agent_detail', [ 'method' => 'get' ] ],
    'share_detail' => [ 'app/index/share_detail', [ 'method' => 'get' ] ],
    'getShopDetails' => [ 'app/index/getShopDetail', [ 'method' => 'get | post' ] ],
]);


Route::group('index', [
    'member' => [ 'index/member.index/member', [ 'method' => 'get' ] ],
    'preview_list' => [ 'index/member.index/preview_list', [ 'method' => 'get' ] ],
    'consumer_list' => [ 'index/member.index/consumer_list', [ 'method' => 'get' ] ],
    'diagram_list' => [ 'index/member.index/diagram_list', [ 'method' => 'get' ] ],
    'entrust_list' => [ 'index/member.index/entrust_list', [ 'method' => 'get' ] ]
]);


Route::group('api', [
    //get
    'sendSms/:phone' => [ 'api/member/sendSms', [ 'method' => 'get' ] ],   //发送短信
    'index' => [ 'api/member/index', [ 'method' => 'get' ] ],


    //get broker
    'getBroker' => [ 'api/broker/index', [ 'method' => 'get' ] ],        //获取当前商铺或街铺的经纪人
    'commentAndDeal' => [ 'api/broker/commentAndDeal', [ 'method' => 'get' ] ],        //获取当前经纪人的评价和交易列表
    'brokerDetail/:id' => [ 'api/broker/brokerDetail', [ 'method' => 'get' ] ],   //经纪人详情
    //post broker
    'appraiser' => [ 'api/broker/appraiser', [ 'method' => 'post' ] ],    //评价经纪人

    //get member
    'logout' => ['api/member/logout',['method' => 'get']],
    'inviteList/:id' => ['api/member/inviteList', ['method' => 'get']], //邀请记录
    'qrCode' => ['api/member/qrCode', ['method' => 'get']], //邀请二维码
    
    
    //post member
    'login' => [ 'api/member/login', [ 'method' => 'post' ] ],           //c端登陆
    'register' => [ 'api/member/register', [ 'method' => 'post' ] ],  //注册|邀请注册|编辑

    // shop
    'shopList' => [ 'api/shop/getShopList', [ 'method' => 'post' ] ],
    'filtrateCondition' => [ 'api/shop/filtrateCondition', [ 'method' => 'get | post' ] ],
    'shopDetail' => [ 'api/shop/getShopDetail', [ 'method' => 'get' ] ],

    //get banner
    'bannerList' => [ 'api/banner/getBannerList', [ 'method' => 'get' ] ],

    //get index
    'averagePriceAndTurnover' => [ 'api/index/averagePriceAndTurnover', [ 'method' => 'get' ] ],


    //post AppointmentTime
    'getAppointmentSeeShopList' => [ 'api/appointmentTime/getAppointmentSeeShopList', [ 'method' => 'post' ] ],


    //tradeLog
    'getTradeList' => [ 'api/TradeLog/getTradeList', [ 'method' => 'get' ] ],

    //AttentionShop
    'addOrUpdateAttention' => [ 'api/AttentionShop/addOrUpdateAttention', [ 'method' => 'post' ] ],
    'attentionList' => [ 'api/AttentionShop/attentionList', [ 'method' => 'post | get' ] ],


]);

Route::miss('api/index/miss');//处理错误的url