|
|
@ -67,17 +67,17 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='新用户奖励', |
|
|
|
|
|
$comment='社区服务点', |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_PLAT_NEW_USER, |
|
|
|
|
|
$desc='新用户奖励', |
|
|
|
|
|
$comment='社区服务点' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_PLAT_NEW_USER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
// 维护社区服务点余额
|
|
|
// 维护社区服务点余额
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
$balance = UserBalance::firstOrNew([ |
|
|
'user_type' => UserBalance::USER_TYPE_CS, |
|
|
|
|
|
|
|
|
'user_type' => $user_type, |
|
|
'source_id' => $user_id |
|
|
'source_id' => $user_id |
|
|
]); |
|
|
]); |
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
@ -95,17 +95,17 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='新用户首单奖励', |
|
|
|
|
|
$comment='社区服务点', |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_FIRST_ORDER, |
|
|
|
|
|
$desc='新用户首单奖励', |
|
|
|
|
|
$comment='社区服务点' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_FIRST_ORDER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
// 维护社区服务点余额
|
|
|
// 维护社区服务点余额
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
$balance = UserBalance::firstOrNew([ |
|
|
'user_type' => UserBalance::USER_TYPE_CS, |
|
|
|
|
|
|
|
|
'user_type' => $user_type, |
|
|
'source_id' => $user_id |
|
|
'source_id' => $user_id |
|
|
]); |
|
|
]); |
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
@ -122,17 +122,17 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='用户订单分成', |
|
|
|
|
|
$comment='社区服务点', |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$user_type=FinancialRecord::USER_TYPE_CS, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_OL_ORDER, |
|
|
|
|
|
$desc='用户订单分成', |
|
|
|
|
|
$comment='社区服务点' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_CS_OL_ORDER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
// 维护社区服务点余额
|
|
|
// 维护社区服务点余额
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
$balance = UserBalance::firstOrNew([ |
|
|
'user_type' => UserBalance::USER_TYPE_CS, |
|
|
|
|
|
|
|
|
'user_type' => $user_type, |
|
|
'source_id' => $user_id |
|
|
'source_id' => $user_id |
|
|
]); |
|
|
]); |
|
|
$balance->balance = bcadd($balance->balance, $money,2); |
|
|
$balance->balance = bcadd($balance->balance, $money,2); |
|
|
@ -150,11 +150,11 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='新用户下单奖励', |
|
|
|
|
|
$comment='用户当面付商户奖励', |
|
|
$user_type=FinancialRecord::USER_TYPE_STORE, |
|
|
$user_type=FinancialRecord::USER_TYPE_STORE, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER, |
|
|
|
|
|
$desc='新用户下单奖励', |
|
|
|
|
|
$comment='用户当面付商户奖励' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
@ -162,6 +162,14 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store->award_money = bcadd($store->award_money, $money, 2); |
|
|
$store->award_money = bcadd($store->award_money, $money, 2); |
|
|
$store->save(); |
|
|
$store->save(); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -171,11 +179,11 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='用户店铺首单奖励', |
|
|
|
|
|
$comment='用户当面付商户奖励', |
|
|
$user_type=FinancialRecord::USER_TYPE_STORE, |
|
|
$user_type=FinancialRecord::USER_TYPE_STORE, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_STORE_FIRST_ORDER, |
|
|
|
|
|
$desc='用户店铺首单奖励', |
|
|
|
|
|
$comment='用户当面付商户奖励' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_STORE_FIRST_ORDER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
@ -183,6 +191,14 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store->award_money = bcadd($store->award_money, $money, 2); |
|
|
$store->award_money = bcadd($store->award_money, $money, 2); |
|
|
$store->save(); |
|
|
$store->save(); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function recordAll($user_id, $source_id, $money, $user_type=1, $source_type=0, $money_type=0, $desc='', $comment='') { |
|
|
public function recordAll($user_id, $source_id, $money, $user_type=1, $source_type=0, $money_type=0, $desc='', $comment='') { |
|
|
@ -211,11 +227,11 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='用户下单(线下)', |
|
|
|
|
|
$comment='用户下单', |
|
|
$user_type=FinancialRecord::USER_TYPE_USER, |
|
|
$user_type=FinancialRecord::USER_TYPE_USER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_USER_OFL_ORDER, |
|
|
|
|
|
$desc='用户下单(线下)', |
|
|
|
|
|
$comment='用户下单' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_USER_OFL_ORDER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
@ -228,11 +244,11 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc='用户下单(线上)', |
|
|
|
|
|
$comment='用户下单', |
|
|
$user_type=FinancialRecord::USER_TYPE_USER, |
|
|
$user_type=FinancialRecord::USER_TYPE_USER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type=FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type=FinancialRecord::MONEY_TYPE_USER_OL_ORDER, |
|
|
|
|
|
$desc='用户下单(线上)', |
|
|
|
|
|
$comment='用户下单' |
|
|
|
|
|
|
|
|
$money_type=FinancialRecord::MONEY_TYPE_USER_OL_ORDER |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
@ -245,11 +261,11 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc = '线上外卖订单收入', |
|
|
|
|
|
$comment = '用户订单完成', |
|
|
$user_type = FinancialRecord::USER_TYPE_STORE, |
|
|
$user_type = FinancialRecord::USER_TYPE_STORE, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type = FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP, |
|
|
|
|
|
$desc = '线上外卖订单收入', |
|
|
|
|
|
$comment = '用户订单完成' |
|
|
|
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
@ -257,6 +273,14 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
$store->store_wallet = bcadd($store->store_wallet, $money, 2); |
|
|
$store->store_wallet = bcadd($store->store_wallet, $money, 2); |
|
|
$store->save(); |
|
|
$store->save(); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -266,14 +290,27 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc = '线下当面付订单收入', |
|
|
|
|
|
$comment = '用户订单完成', |
|
|
$user_type = FinancialRecord::USER_TYPE_STORE, |
|
|
$user_type = FinancialRecord::USER_TYPE_STORE, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type = FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP, |
|
|
|
|
|
$desc = '线下当面付订单收入', |
|
|
|
|
|
$comment = '用户订单完成' |
|
|
|
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_STORE_OFL_ORDER_COMP |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 同时维护钱包
|
|
|
|
|
|
$store = Store::query()->where(['user_id' => $user_id])->first(); |
|
|
|
|
|
$store->store_wallet = bcadd($store->store_wallet, $money, 2); |
|
|
|
|
|
$store->save(); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -284,13 +321,138 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
$user_id, |
|
|
$user_id, |
|
|
$source_id, |
|
|
$source_id, |
|
|
$money, |
|
|
$money, |
|
|
|
|
|
$desc = '线上订单退款', |
|
|
|
|
|
$comment = '线上订单退款到微信', |
|
|
$user_type = FinancialRecord::USER_TYPE_USER, |
|
|
$user_type = FinancialRecord::USER_TYPE_USER, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
$money_type = FinancialRecord::MONEY_TYPE_USER_OL_ORDER_REFUND, |
|
|
|
|
|
$desc = '线上订单退款', |
|
|
|
|
|
$comment = '线上订单退款到微信' |
|
|
|
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_USER_OL_ORDER_REFUND |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mmAwardByPlatNewUser( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$desc = '发展新用户', |
|
|
|
|
|
$comment = '市场经理发展新用户奖励', |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MM, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MM_PLAT_NEW_USER |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mmAwardByNewStore( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$desc = '发展新商户', |
|
|
|
|
|
$comment = '市场经理发展新商户奖励', |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MM, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MM_PLAT_NEW_STORE |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpAwardByPlatNewUser( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$desc = '服务商发展新用户', |
|
|
|
|
|
$comment = '服务商发展新用户奖励', |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_PLAT_NEW_USER |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpAwardByNewStore( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$desc = '服务商发展新商户', |
|
|
|
|
|
$comment = '服务商发展新商户奖励', |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_PLAT_NEW_STORE |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpSeparateAccountByOLOrderComp( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$desc = '服务商线上订单分账', |
|
|
|
|
|
$comment = '服务商用户线上订单完成后分账', |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_OL_ORDER |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => $user_type, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |