<?php
/**
 * api/admin/???
 */

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

// 小程序动作统计
Route::post('/minigram/action', 'Admin\MiniprogramController@actiondata');
// 邀请记录统计
Route::get('/pair/enrollinvite/{stage_id}', 'Admin\PairController@enrollInvite')->where('stage_id', '[0-9]+');
// 匹配查询记录统计
Route::get('/pair/pairquery/{stage_id}', 'Admin\PairController@pairQuery')->where('stage_id', '[0-9]+');
// 查询公众号发款记录
Route::get('/media/feeLogs', 'Admin\MediaFeeController@getFeeLogs');
// 公众号发款
Route::post('createFeeLog', 'Admin\MediaFeeController@createFee');

// 添加审核日志
Route::post('/partner/addlog/{parnter_id}', "Admin\PartnerController@addCheckLog")->where('partner_id', '[0-9]+');

// uid查询交友卡片及报名历史信息
Route::get('/pair/history/{uid}', "Admin\PairController@getHistoryPair")->where('uid', '[0-9]+');

// 问题列表
Route::group(['prefix' => 'question'], function () {
    // 获取问题列表
    Route::get("/list", "Admin\QuestionController@index");
    // 获取问题详情
    Route::get("/{question_id}", "Admin\QuestionController@show")->where('question_id', '[0-9]+');
    // 删除问题
    Route::get("/{question_id}/delete", "Admin\QuestionController@delete")->where('question_id', '[0-9]+');
    // 创建问题
    Route::post("/create", "Admin\QuestionController@create");
    // 更新问题
    Route::post("/{question_id}/update", "Admin\QuestionController@update")->where('question_id', '[0-9]+');
});


//  举报后台
Route::group(['prefix' => 'complains'], function () {
    // 举报列表
    Route::get('/', "Admin\ComplainController@index");
    // 回复并处理
    Route::put('/{id}/reply', "Admin\ComplainController@reply")->where('id', '[0-9]+');
    // 删除卡片的某个字段
    Route::put('/{id}/erasing', "Admin\ComplainController@erasing")->where('id', '[0-9]+');
    // 拉入黑名单
    Route::put('/{id}/defriend', "Admin\ComplainController@defriend")->where('id', '[0-9]+');
});

// 反馈后台
Route::group([], function () {

    Route::get('/feedbacks', "Admin\FeedbackController@index");
    Route::get('feedbacks/{id}', "Admin\FeedbackController@show")->where('id', '[0-9]+');
    // 反馈回复
    Route::put('/feedback', "Admin\FeedbackController@reply");
    // 反馈忽略
    Route::put('/feedbacks/{id}', 'Admin\FeedbackController@ignore')->where('id', '[0-9]+');
});

Route::group(['prefix' => 'logouts'], function () {
    Route::get('', 'Admin\LogoutController@index');
    Route::put('{id}', 'Admin\LogoutController@handle')->where('id', '[0-9]+');
    Route::post('', 'Admin\LogoutController@store');
});


// 【分配对象】公众号关键词管理
Route::group(['prefix' => 'fpdx'], function () {
    // 获取忽略关键词
    Route::get('hidekeys', "Fpdx\RoomController@getHideKey");
    // 添加忽略关键词
    Route::get('addkeys/{key}', "Fpdx\RoomController@addHideKey");
    // 删除忽略关键词
    Route::get('delkeys/{key}', "Fpdx\RoomController@delHideKey");
});

// 晚安话题设置
Route::group(['prefix' => 'goodnight'], function () {
    Route::get('topics', 'Admin\GnightController@topics');
    Route::post('topics', 'Admin\GnightController@createTopic');
    Route::put('topics/{id}', 'Admin\GnightController@updateTopic')->where('id', '[0-9]+');
    Route::post('examples', 'Admin\GnightController@createTopicExample');
    Route::put('examples/{id}', 'Admin\GnightController@updateTopicExample')->where('id', '[0-9]+');
});

// 正在审核的语音
Route::get("/gnight/voices/checking", "Admin\GnightController@getCheckings");

/** 卡片管理 */
// 获取待精选的卡片
Route::get("partner/list/wait_select", "Admin\PartnerController@waitSelects");
// 精选卡片
Route::post("partner/select", "Admin\PartnerController@selects");
// 取消/推荐卡片
Route::put("partner/{partner_id}/commitpartner", "Admin\PartnerController@commitPartner")->where('partner_id',
    '[0-9]+');
// 取消/推荐卡片语音
Route::put("partner/{partner_id}/commitvoice", "Admin\PartnerController@commitVoice")->where('partner_id', '[0-9]+');

// 修改语音状态
Route::get("/gnight/voices/changestate/{uid}", "Admin\GnightController@changeState")->where('uid', '[0-9]+');

// 删除报名
Route::get('fpdx/pair/{uid}', 'Admin\PairController@delPair')->where('uid', '[0-9]+');
// 修改为不满意状态
Route::post('fpdx/pair/state', 'Admin\PairController@upStateToRefund');

// 审核卡片
Route::post('/partner/{partner_id}/check', 'Admin\PartnerController@checkPartner')->where('partner_id', '[0-9]+');
// 上/下榜卡片
Route::put('/partner/{partner_id}/xhxcrank', 'Admin\PartnerController@xhxcrank')->where('partner_id', '[0-9]+');
// 切换是否推送到信息流
Route::put('/partner/{partner_id}/pushfeed', 'Admin\PartnerController@pushFeed')->where('partner_id', '[0-9]+');
// 审核卡片列表
Route::post('/partner/list', 'Admin\PartnerController@checkList');
// 「list」活动审核卡片
Route::post('/feedcheck/list', 'Admin\PartnerController@feedcheckList');

// 上架不推流的卡片list
Route::get("/partner/unpush/list", "Admin\PartnerController@unpushList");
// 推流卡片
Route::post("/parnter/{partner_id}/push", "Admin\PartnerController@push");
// 通过|不通过某卡片
Route::post("/partner/{partner_id}/pass", "Admin\PartnerController@passPartner");
// 审核排行榜
Route::get('/feedcheck/rank', "Admin\PartnerController@passRank");

// 获取美图过的照片
Route::get('partner/beautys', 'Admin\PartnerController@getBeautyList');


// 某人上传的卡片列表
Route::get('/partner/userlist', 'Admin\PartnerController@userList');

Route::group([], function () {
    // 获取调试用户反射列表
    Route::get('/debug/reflec', 'Admin\Debug@get');
    // 添加/更新调试反射
    Route::put('debug/reflection', 'Admin\Debug@store');
    // 删除调试用户反射
    Route::delete('debug/reflection', 'Admin\Debug@delete');
});

// 用户-获取用户信息
Route::get('/user/{uid}/get', "Admin\UserController@show")->where('uid', '[0-9]+');

// 用户-修改用户信息
Route::put('/user/{uid}/update', 'Admin\UserController@update')->where('uid', '[0-9]+');

// 黑名单列表
Route::get('user/blacks', 'Admin\UserController@blackList');
// 拉入黑名单
Route::post('user/blacks', 'Admin\UserController@createBlack');
Route::delete('user/blacks/{id}', 'Admin\UserController@deleteBlack');

// 搜索-卡片
Route::post('/partner/search', 'Admin\PartnerController@search');

// 搜索-用户
Route::post('/user/search', 'Admin\UserController@search');

// 用户-认证微信
Route::post('/user/wxverify', 'Admin\UserController@wxverify');


// 客服账号
Route::group(['prefix' => 'kfaccount'], function () {
    Route::get('', 'Admin\KfaccountController@index');
    Route::put('{id}', 'Admin\KfaccountController@update')->where('id', '[0-9]+');
});

// 时遇记相关
Route::group(['prefix' => 'syj', 'namespace' => 'Admin\Syj'], function () {

    // 群组
    Route::get('groups', 'GroupController@index');
    Route::post('groups', 'GroupController@store');
    Route::put('groups/{id}', 'GroupController@update');
});

// 发现页文章
Route::group(['prefix' => 'articles'], function () {
    Route::get('', 'Admin\ArticleController@index');
    Route::post('', 'Admin\ArticleController@store');
    Route::put('{id}', 'Admin\ArticleController@update')->where('id', '[0-9]+');
    Route::delete('{id}', 'Admin\ArticleController@destroy')->where('id', '[0-9]+');
});


// 邀请的问题列表
Route::group(['prefix' => 'invite/questions'], function () {

    Route::get('', 'Admin\Invite\QuestionController@index');
    Route::put('{id}/recommend', 'Admin\Invite\QuestionController@recommend');

    Route::post('', 'Admin\Invite\QuestionTemplateController@store');
    Route::put('{id}', 'Admin\Invite\QuestionTemplateController@update')->where('id', '[0-9]+');
    Route::get('tags', 'Admin\Invite\QuestionTemplateController@index');
    Route::post('tags', 'Admin\Invite\QuestionTemplateController@createTag');
    Route::put('tags/{id}', 'Admin\Invite\QuestionTemplateController@updateTag')->where('id', '[0-9]+');
});


//
Route::group(['prefix' => 'invite/paints'], function ($route) {
    $route->get('/', 'Admin\Invite\PaintController@index');
});


//福利中心
Route::group(['prefix' => 'welfare'], function () {

    Route::get('lotterys', 'Admin\WelfareController@lotterys');
    Route::post('lottery', 'Admin\WelfareController@createLottery');
    Route::put('lottery', 'Admin\WelfareController@updateLottery');

    Route::get('stores', 'Admin\WelfareController@stores');
    Route::post('store', 'Admin\WelfareController@createStore');
    Route::put('store', 'Admin\WelfareController@updateStore');

    Route::get('prizes', 'Admin\WelfareController@prizes');
    Route::put('prize', 'Admin\WelfareController@updatePrize');

    Route::get('tickets', 'Admin\WelfareController@tickets');
    Route::put('ticket', 'Admin\WelfareController@updateTicket');
});


// 72小时活动
Route::group(['prefix' => 'pair', 'namespace' => 'Admin\Pair'], function ($router) {
    /** @var Route $router */
    // 群组
    $router->group(['prefix' => 'groups'], function ($router) {
        /** @var Route $router */
        // 群组列表
        $router->get("/", "GroupController@index");
        // 创建群组
        $router->post("/", "GroupController@store");
        // 修改群组
        $router->put("/{group_id}", "GroupController@update")->where('group_id', '[0-9]+');
        // 群组信息
        $router->get("/{group_id}", "GroupController@show")->where('group_id', '[0-9]+');
    });


    // 表单
    /** @var Route $router */
    $router->group(['prefix' => 'forms'], function ($router) {
        /** @var Route $router */
        // 表单列表
        $router->get('/', 'FormController@index');
        // 创建表单
        $router->post('/', 'FormController@store');
        // 导出表单
        $router->get('{form_id}/export', 'FormController@export');
        // 表单信息
        $router->get('{form_id}', 'FormController@show')->where('form_id', '[0-9]+');
        // 修改表单
        $router->put('{form_id}', 'FormController@update')->where('form_id', '[0-9]+');
        // 创建问题
        $router->post('{form_id}/questions', 'FormController@createQuestion')->where('form_id', '[0-9]+');
        // 修改问题
        $router->put('{form_id}/questions/{question_id}', 'FormController@updateQuestion')
            ->where('form_id', '[0-9]+')
            ->where('question_id', '[0-9]+');


    });


});


// 校花校草
Route::group(['prefix' => 'appearances', 'namespace' => 'Admin'], function ($router) {
    /** @var Route $router */
    $router->get('rank/province', 'AppearanceController@province');
    $router->get('rank/school', 'AppearanceController@school');
    $router->put('school/increment', 'AppearanceController@incrementSchool');
    $router->put('partner/increment', 'AppearanceController@incrementPartner');
    $router->get('school/increment', 'AppearanceController@incrementSchool');
    $router->get('partner/increment', 'AppearanceController@incrementPartner');

});


// 游戏玩法组
Route::group(['prefix' => 'game', 'namespace' => 'Admin\Game'], function () {
    // 测一测玩法
    Route::group(['prefix' => 'cyc'], function ($router) {
        /** @var Route $router */
        // 问题
        $router->get('questions', 'CycController@index');
        $router->post('questions', 'CycController@store');
        $router->get('questions/{id}', 'CycController@show');
        $router->put('questions/{id}', 'CycController@update');
        // 答案
        $router->get('questions/{id}/answers', 'CycController@answers');
        $router->post('questions/{id}/answers', 'CycController@createAnswer');
    });
});


// 每日订阅通知
Route::group(['prefix' => 'daily', 'namespace' => 'Admin'], function ($router) {
    /** @var Route $router */
    $router->get('/', 'DailyController@index');

    $router->post('/', 'DailyController@store');

    $router->put('{id}', 'DailyController@update')->where('id', '[0-9]+');

    $router->delete('{id}', 'DailyController@destroy')->where('id', '[0-9]+');

    $router->post('{id}/preview', 'DailyController@preview')->where('id', '[0-9]+');
});

// 风险名单
Route::get('risks', 'Admin\BlackListController@riskList');


/** 素材审核 */
Route::get("/auditmedia/image/list", "Admin\AuditMedia\AuditMediaController@listImage");
Route::get("/auditmedia/text/list", "Admin\AuditMedia\AuditMediaController@listText");
Route::get("/auditmedia/voice/list", "Admin\AuditMedia\AuditMediaController@listVoice");
Route::post("/auditmedia/audit", "Admin\AuditMedia\AuditMediaController@audit");

Route::get("/secure/text", function (\Illuminate\Http\Request $request) {
    $s = new App\Services\Vendor\Tencent\SecureService();
    $s->text($request->get('c'));
});

Route::get("/secure/image", function (\Illuminate\Http\Request $request) {
    $s = new App\Services\Vendor\Tencent\SecureService();
    $s->image($request->get('c'));
});











