AccountController.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Admin;
  12. use App\Http\Validator\AccountValidator;
  13. use App\Services\Common\AccountService;
  14. use App\Services\Common\FinanceService;
  15. /**
  16. * 账户明细管理-控制器
  17. * @author laravel开发员
  18. * @since 2020/11/11
  19. * Class AccountController
  20. * @package App\Http\Controllers
  21. */
  22. class AccountController extends Backend
  23. {
  24. /**
  25. * 构造函数
  26. * @author laravel开发员
  27. * @since 2020/11/11
  28. * AccountController constructor.
  29. */
  30. public function __construct()
  31. {
  32. parent::__construct();
  33. $this->service = new AccountService();
  34. }
  35. // 记录
  36. public function index()
  37. {
  38. $pageSize = request()->get('limit', 15);
  39. $list = $this->service->getDataList(request()->all(), $pageSize);
  40. $message = array(
  41. "msg" => '操作成功',
  42. "code" => 0,
  43. "data" => isset($list['list'])? $list['list']:[],
  44. "count" => isset($list['total'])? $list['total']:0,
  45. );
  46. return $message;
  47. }
  48. /**
  49. * 调整佣金
  50. * @param AccountValidator $validator
  51. * @return array
  52. */
  53. public function changeBonus(AccountValidator $validator)
  54. {
  55. // 获取参数
  56. $params = $validator->check(request()->all(), 'change');
  57. if(!is_array($params)){
  58. return message($params, false);
  59. }
  60. if(AccountService::make()->changeBonus($params)){
  61. return message(AccountService::make()->getError(), true);
  62. }else{
  63. return message(AccountService::make()->getError(), false);
  64. }
  65. }
  66. // 调整积分
  67. public function changeScore(AccountValidator $validator)
  68. {
  69. // 获取参数
  70. $params = $validator->check(request()->all(), 'change');
  71. if(!is_array($params)){
  72. return message($params, false);
  73. }
  74. if(AccountService::make()->changeScore($params)){
  75. return message(AccountService::make()->getError(), true);
  76. }else{
  77. return message(AccountService::make()->getError(), false);
  78. }
  79. }
  80. }