<?php /** * Created by PhpStorm. * User: tandunzhao * Date: 2017/11/20 * Time: 下午4:23 */ namespace App\Http\Controllers\Channel\Finance; use App\Http\Controllers\Manage\Channel\Transformers\CommissionRateTransformer; use App\Modules\Finance\Services\CommissionRateService; use Illuminate\Http\Request; class CommissionRateController extends BaseController { /** * @apiDefine Finance 结算提现模块 */ /** * @apiVersion 1.0.0 * @apiDescription 获取佣金结算比例列表 * @api {GET} commissionRates 佣金结算比例列表 * @apiGroup Finance * @apiName commissionRates * @apiSuccess {Number} begin_amount 起始金额. * @apiSuccess {Number} end_amount 结束金额. * @apiSuccess {Number} rate 比例. * @apiSuccessExample {json} Success-Response: * * { * "code": 0, * "msg": "", * "data": * [ * { * "begin_amount": 0, * "end_amount": 1000, * "rate": "0.10" * } * ] * } */ function get_list(Request $request) { if(self::checkParamValueNumber($request, ['channel_id'])) { return response()->error("PARAM_ERROR"); } $distribution_channel_id = $request->has('channel_id') ? $request->input('channel_id') : ''; $result = CommissionRateService::getCommissionRateList($distribution_channel_id); return response()->collection(new CommissionRateTransformer(), $result); } /** * @apiVersion 1.0.0 * @apiDescription 获取当前渠道当前佣金比例 * @api {GET} getCommissionRate 获取当前渠道当前佣金比例 * @apiGroup Finance * @apiName getCommissionRate * @apiSuccess {Number} rate 当前佣金比例. * @apiSuccessExample {json} Success-Response: * * { * "code": 0, * "msg": "", * "data": * { * "rate": "0.60" * } * } */ function get_commissionRate(Request $request) { $distribution_channel_id = $this->getChannelId(); $distribution_channel_name = $this->getChannelName(); $distribution_channel_name = ''; $rate = CommissionRateService::getRateCommissionRate($distribution_channel_id); return response()->success(compact('rate')); } }