Browse Source

提现明细mock

master
Lemon 5 years ago
parent
commit
d8e637786e
  1. 28
      app/Constants/v3/Withdrawal.php
  2. 15
      app/Controller/v3/BalanceStatementController.php
  3. 19
      app/Model/v3/StoreWithdrawal.php
  4. 13
      app/Service/v3/Implementations/RevenueListService.php
  5. 29
      app/Service/v3/Implementations/WithdrawalListService.php
  6. 2
      app/Service/v3/Interfaces/RevenueListServiceInterface.php
  7. 13
      app/Service/v3/Interfaces/WithdrawalListServiceInterface.php
  8. 1
      config/autoload/dependencies.php
  9. 1
      config/routes.php

28
app/Constants/v3/Withdrawal.php

@ -0,0 +1,28 @@
<?php
namespace App\Constants\v3;
use Hyperf\Constants\AbstractConstants;
use Hyperf\Constants\Annotation\Constants;
/**
* @Constants
*/
class Withdrawal extends AbstractConstants
{
/**
* @Message("待审核")
*/
const EXAMINE = 1;
/**
* @Message("已通过")
*/
const ACCEPT = 2;
/**
* @Message("已拒绝")
*/
const REFUSE = 3;
}

15
app/Controller/v3/BalanceStatementController.php

@ -5,6 +5,7 @@ namespace App\Controller\v3;
use App\Controller\BaseController; use App\Controller\BaseController;
use Hyperf\Di\Annotation\Inject; use Hyperf\Di\Annotation\Inject;
use App\Service\v3\Interfaces\RevenueListServiceInterface; use App\Service\v3\Interfaces\RevenueListServiceInterface;
use App\Service\v3\Interfaces\WithdrawalListServiceInterface;
class BalanceStatementController extends BaseController class BalanceStatementController extends BaseController
{ {
@ -13,9 +14,21 @@ class BalanceStatementController extends BaseController
* @var RevenueListServiceInterface * @var RevenueListServiceInterface
*/ */
protected $revenueListService; protected $revenueListService;
/**
* @Inject
* @var WithdrawalListServiceInterface
*/
protected $withdrawalListService;
public function getRevenueListByUser() public function getRevenueListByUser()
{ {
$params = $this->request->all(); $params = $this->request->all();
return $this->success($this->revenueListService->check(46));
return $this->success($this->revenueListService->getListByUser(46));
}
public function getWithdrawalListByStore()
{
$params = $this->request->all();
return $this->success($this->withdrawalListService->getListByStore(7));
} }
} }

19
app/Model/v3/StoreWithdrawal.php

@ -0,0 +1,19 @@
<?php
namespace App\Model\v3;
use App\Model\Model;
use App\Constants\v3\Withdrawal;
class StoreWithdrawal extends Model
{
protected $table = 'lanzu_store_withdrawal';
protected $appends = [
'state_text',
];
public function getStateTextAttribute()
{
return Withdrawal::getMessage($this->attributes['state']);
}
}

13
app/Service/v3/Implementations/RevenueListService.php

@ -15,14 +15,19 @@ class RevenueListService implements RevenueListServiceInterface
public function check($userId) public function check($userId)
{ {
$financialRecord = new FinancialRecord();
$mod = bcmod((string)$userId, '5', 0);
$financialRecord->suffix($mod);
return $financialRecord::query()->get();
} }
public function undo() public function undo()
{ {
// TODO: Implement undo() method. // TODO: Implement undo() method.
} }
public function getListByUser($userId)
{
$financialRecord = new FinancialRecord();
$mod = bcmod((string)$userId, '5', 0);
$financialRecord->suffix($mod);
return $financialRecord::query()->get();
}
} }

29
app/Service/v3/Implementations/WithdrawalListService.php

@ -0,0 +1,29 @@
<?php
namespace App\Service\v3\Implementations;
use App\Service\v3\Interfaces\WithdrawalListServiceInterface;
use App\Model\v3\StoreWithdrawal;
class WithdrawalListService implements WithdrawalListServiceInterface
{
public function do()
{
// TODO: Implement do() method.
}
public function check()
{
// TODO: Implement check() method.
}
public function undo()
{
// TODO: Implement undo() method.
}
public function getListByStore($storeId)
{
$res = StoreWithdrawal::query()->where('store_id',$storeId)->get();
return $res;
}
}

2
app/Service/v3/Interfaces/RevenueListServiceInterface.php

@ -11,4 +11,6 @@ interface RevenueListServiceInterface
public function check($userId); public function check($userId);
public function undo(); public function undo();
public function getListByUser($userId);
} }

13
app/Service/v3/Interfaces/WithdrawalListServiceInterface.php

@ -0,0 +1,13 @@
<?php
namespace App\Service\v3\Interfaces;
interface WithdrawalListServiceInterface
{
public function do();
public function check();
public function undo();
public function getListByStore($storeId);
}

1
config/autoload/dependencies.php

@ -63,4 +63,5 @@ return [
\App\Service\v3\Interfaces\GoodsActivityServiceInterface::class => \App\Service\v3\Implementations\GoodsActivityService::class, \App\Service\v3\Interfaces\GoodsActivityServiceInterface::class => \App\Service\v3\Implementations\GoodsActivityService::class,
\App\Service\v3\Interfaces\DeliveryMoneyServiceInterface::class => \App\Service\v3\Implementations\DeliveryMoneyService::class, \App\Service\v3\Interfaces\DeliveryMoneyServiceInterface::class => \App\Service\v3\Implementations\DeliveryMoneyService::class,
\App\Service\v3\Interfaces\RevenueListServiceInterface::class => \App\Service\v3\Implementations\RevenueListService::class, \App\Service\v3\Interfaces\RevenueListServiceInterface::class => \App\Service\v3\Implementations\RevenueListService::class,
\App\Service\v3\Interfaces\WithdrawalListServiceInterface::class => \App\Service\v3\Implementations\WithdrawalListService::class,
]; ];

1
config/routes.php

@ -115,4 +115,5 @@ Router::addGroup('/v3/', function () {
Router::post('collectStore/getListByUser', 'App\Controller\v3\CollectStoreController@getListByUser'); Router::post('collectStore/getListByUser', 'App\Controller\v3\CollectStoreController@getListByUser');
Router::post('balanceStatement/getRevenueListByUser', 'App\Controller\v3\BalanceStatementController@getRevenueListByUser'); Router::post('balanceStatement/getRevenueListByUser', 'App\Controller\v3\BalanceStatementController@getRevenueListByUser');
Router::post('orderOnline/add', 'App\Controller\v3\OrderOnlineController@add'); Router::post('orderOnline/add', 'App\Controller\v3\OrderOnlineController@add');
Router::post('store/storeWithdrawalList', 'App\Controller\v3\BalanceStatementController@getWithdrawalListByStore');
},['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]);
Loading…
Cancel
Save