10 changed files with 196 additions and 0 deletions
-
21app/Controller/v3/BalanceStatementController.php
-
7app/Controller/v3/CollectStoreController.php
-
101app/Model/v3/FinancialRecord.php
-
5app/Model/v3/Market.php
-
15app/Service/v3/Implementations/CollectStoreService.php
-
28app/Service/v3/Implementations/RevenueListService.php
-
2app/Service/v3/Interfaces/CollectStoreServiceInterface.php
-
14app/Service/v3/Interfaces/RevenueListServiceInterface.php
-
1config/autoload/dependencies.php
-
2config/routes.php
@ -0,0 +1,21 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Controller\v3; |
|||
use App\Controller\BaseController; |
|||
use Hyperf\Di\Annotation\Inject; |
|||
use App\Service\v3\Interfaces\RevenueListServiceInterface; |
|||
|
|||
class BalanceStatementController extends BaseController |
|||
{ |
|||
/** |
|||
* @Inject |
|||
* @var RevenueListServiceInterface |
|||
*/ |
|||
protected $revenueListService; |
|||
public function getRevenueListByUser() |
|||
{ |
|||
$params = $this->request->all(); |
|||
return $this->success($this->revenueListService->check(46)); |
|||
} |
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
<?php |
|||
|
|||
declare (strict_types=1); |
|||
namespace App\Model\v3; |
|||
use App\Model\Model; |
|||
/** |
|||
*/ |
|||
class FinancialRecord extends Model |
|||
{ |
|||
/** |
|||
* 当面付商户首单奖励限制的订单金额 |
|||
*/ |
|||
const OFL_FIRST_AWARD_LIMIT_AMOUNT = 3; |
|||
|
|||
/** |
|||
* 虚拟账户 |
|||
*/ |
|||
const ACCOUNT_LEDGER = -1; |
|||
|
|||
/** |
|||
* 账户类型 |
|||
* |
|||
* 总账 |
|||
* USER_TYPE_LEDGER / -1 |
|||
* |
|||
* 用户 |
|||
* USER_TYPE_USER / 1 |
|||
* |
|||
* MP用户账户,服务商、市场经理、服务站点等 |
|||
* USER_TYPE_MP / 2 |
|||
* USER_TYPE_MM / 3 |
|||
* USER_TYPE_CS / 4 |
|||
* |
|||
* 商户账户 |
|||
* USER_TYPE_STORE / 5 |
|||
*/ |
|||
const USER_TYPE_LEDGER = -1; |
|||
const USER_TYPE_USER = 1; |
|||
const USER_TYPE_MP = 2; |
|||
const USER_TYPE_MM = 3; |
|||
const USER_TYPE_CS = 4; |
|||
const USER_TYPE_STORE = 5; |
|||
|
|||
/** |
|||
* 关联类型 |
|||
* |
|||
* 订单 |
|||
* SOURCE_TYPE_ORDER / 1 |
|||
*/ |
|||
const SOURCE_TYPE_ORDER = 1; |
|||
|
|||
/** |
|||
* 流水类型,大的分类,<100是奖励分账等收入项 >=100是提现消费等支出项 |
|||
*/ |
|||
const MONEY_TYPE_CS_PLAT_NEW_USER = 1; // 社区服务点新用户奖励(线上订单完成)
|
|||
const MONEY_TYPE_CS_FIRST_ORDER = 2; // 社区服务点新用户线上首单奖励(线上订单完成)
|
|||
const MONEY_TYPE_CS_OL_ORDER = 3; // 社区服务点用户线上订单分账(线上订单完成)
|
|||
const MONEY_TYPE_STORE_PLAT_NEW_USER = 4; // 商户平台新用户奖励
|
|||
const MONEY_TYPE_STORE_FIRST_ORDER = 5; // 商户当日首单奖励
|
|||
const MONEY_TYPE_STORE_OL_ORDER_COMP = 6; // 商户线上订单完成收入
|
|||
const MONEY_TYPE_STORE_OFL_ORDER_COMP = 7; // 商户线下订单完成收入
|
|||
const MONEY_TYPE_USER_OL_ORDER_REFUND = 8; // 用户线上订单退款
|
|||
|
|||
const MONEY_TYPE_USER_OFL_ORDER = 100; // 用户线下支付订单
|
|||
const MONEY_TYPE_USER_OL_ORDER = 101; // 用户线上支付订单
|
|||
|
|||
/** |
|||
* 状态 |
|||
*/ |
|||
const STATUS_NORMAL = 1; |
|||
const STATUS_ABNORMAL = 2; |
|||
|
|||
/** |
|||
* The table associated with the model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $table = 'lanzu_financial_record'; |
|||
/** |
|||
* The attributes that are mass assignable. |
|||
* |
|||
* @var array |
|||
*/ |
|||
protected $fillable = [ |
|||
'user_id', |
|||
'user_type', |
|||
'money', |
|||
'money_type', |
|||
'source_id', |
|||
'source_type', |
|||
'desc', |
|||
'comment', |
|||
'status', |
|||
]; |
|||
/** |
|||
* The attributes that should be cast to native types. |
|||
* |
|||
* @var array |
|||
*/ |
|||
protected $casts = []; |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Service\v3\Implementations; |
|||
use App\Model\v3\FinancialRecord; |
|||
use App\Service\v3\Interfaces\RevenueListServiceInterface; |
|||
|
|||
class RevenueListService implements RevenueListServiceInterface |
|||
{ |
|||
|
|||
public function do() |
|||
{ |
|||
// TODO: Implement do() method.
|
|||
} |
|||
|
|||
public function check($userId) |
|||
{ |
|||
$financialRecord = new FinancialRecord(); |
|||
$mod = bcmod((string)$userId, '5', 0); |
|||
$financialRecord->suffix($mod); |
|||
return $financialRecord::query()->get(); |
|||
} |
|||
|
|||
public function undo() |
|||
{ |
|||
// TODO: Implement undo() method.
|
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Service\v3\Interfaces; |
|||
|
|||
|
|||
interface RevenueListServiceInterface |
|||
{ |
|||
public function do(); |
|||
|
|||
public function check($userId); |
|||
|
|||
public function undo(); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue