Browse Source

提现流水

master
weigang 5 years ago
parent
commit
2b77a4c158
  1. 10
      app/Controller/v3/WithdrawController.php
  2. 10
      app/Model/v3/FinancialRecord.php
  3. 18
      app/Service/v3/Implementations/FinancialRecordService.php
  4. 25
      app/Service/v3/Interfaces/FinancialRecordServiceInterface.php

10
app/Controller/v3/WithdrawController.php

@ -157,7 +157,7 @@ class WithdrawController extends BaseController
$withdraw->apply_cash = $money;
$withdraw->save();
// 扣除余额
// 扣除余额
$balance->balance = bcsub($balance->balance, $money, 2);
$balance->save();
@ -172,6 +172,14 @@ class WithdrawController extends BaseController
'商户提现打款'
);
// 更新打款金额,审核时间等
$withdraw->check_time = time();
$withdraw->real_cash = $money;
$withdraw->save();
// 打款成功,写流水
if ($res === true) {
$this->financialService->storeWithdrawByWx($store->user_id, 0, $withdraw->real_cash);
}
}
Db::commit();

10
app/Model/v3/FinancialRecord.php

@ -47,6 +47,7 @@ class FinancialRecord extends Model
* 订单
* SOURCE_TYPE_ORDER / 1
*/
const SOURCE_TYPE_NONE = 0;
const SOURCE_TYPE_ORDER = 1;
/**
@ -60,9 +61,18 @@ class FinancialRecord extends Model
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_MM_PLAT_NEW_USER = 9; // 市场经理发展新用户
const MONEY_TYPE_MM_PLAT_NEW_STORE = 10; // 市场经理发展新商户
const MONEY_TYPE_MP_PLAT_NEW_USER = 11; // 服务商发展新用户
const MONEY_TYPE_MP_PLAT_NEW_STORE = 12; // 服务商发展新商户
const MONEY_TYPE_MP_OL_ORDER = 13; // 服务商线上订单分账(线上订单完成)
const MONEY_TYPE_USER_OFL_ORDER = 100; // 用户线下支付订单
const MONEY_TYPE_USER_OL_ORDER = 101; // 用户线上支付订单
const MONEY_TYPE_MP_WITHDRAW = 102; // 服务商提现类型
const MONEY_TYPE_MM_WITHDRAW = 103; // 市场经理提现类型
const MONEY_TYPE_CS_WITHDRAW = 104; // 社区提现类型
const MONEY_TYPE_STORE_WITHDRAW = 105; // 商户提现类型
/**
* 状态

18
app/Service/v3/Implementations/FinancialRecordService.php

@ -333,4 +333,22 @@ class FinancialRecordService implements FinancialRecordServiceInterface
return bcadd($sumAmount, '0', 2);
}
/**
* @inheritDoc
*/
public function storeWithdrawByWx(
$user_id,
$source_id,
$money,
$user_type = UserType::STORE,
$source_type = FinancialRecord::SOURCE_TYPE_NONE,
$money_type = FinancialRecord::MONEY_TYPE_STORE_WITHDRAW,
$desc = '商户提现',
$comment = '商户提现打款'
)
{
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment);
}
}

25
app/Service/v3/Interfaces/FinancialRecordServiceInterface.php

@ -3,7 +3,7 @@
namespace App\Service\v3\Interfaces;
use App\Constants\v3\UserType;
use App\Model\FinancialRecord;
use App\Model\v3\FinancialRecord;
interface FinancialRecordServiceInterface
{
@ -263,4 +263,27 @@ interface FinancialRecordServiceInterface
$money_type = []
);
/**
* 商户微信提现流水
* @param $user_id
* @param $source_id
* @param $money
* @param int $user_type
* @param int $source_type
* @param int $money_type
* @param string $desc
* @param string $comment
* @return mixed
*/
public function storeWithdrawByWx(
$user_id,
$source_id,
$money,
$user_type = UserType::STORE,
$source_type = FinancialRecord::SOURCE_TYPE_NONE,
$money_type = FinancialRecord::MONEY_TYPE_STORE_WITHDRAW,
$desc='商户提现',
$comment=''
);
}
Loading…
Cancel
Save