// +---------------------------------------------------------------------- namespace App\Http\Controllers\Admin; use App\Http\Validator\AccountValidator; use App\Services\Common\AccountService; use App\Services\Common\FinanceService; /** * 账户明细管理-控制器 * @author laravel开发员 * @since 2020/11/11 * Class AccountController * @package App\Http\Controllers */ class AccountController extends Backend { /** * 构造函数 * @author laravel开发员 * @since 2020/11/11 * AccountController constructor. */ public function __construct() { parent::__construct(); $this->service = new AccountService(); } // 记录 public function index() { $pageSize = request()->get('limit', 15); $list = $this->service->getDataList(request()->all(), $pageSize); $message = array( "msg" => '操作成功', "code" => 0, "data" => isset($list['list'])? $list['list']:[], "count" => isset($list['total'])? $list['total']:0, ); return $message; } /** * 调整佣金 * @param AccountValidator $validator * @return array */ public function changeBonus(AccountValidator $validator) { // 获取参数 $params = $validator->check(request()->all(), 'change'); if(!is_array($params)){ return message($params, false); } if(!AccountService::make()->changeBonus($params)){ return message(AccountService::make()->getError(), true); }else{ return message(AccountService::make()->getError(), false); } } // 调整积分 public function changeScore(AccountValidator $validator) { // 获取参数 $params = $validator->check(request()->all(), 'change'); if(!is_array($params)){ return message($params, false); } if(!AccountService::make()->changeScore($params)){ return message(AccountService::make()->getError(), true); }else{ return message(AccountService::make()->getError(), false); } } }