|
|
@ -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' => UserBalance::USER_TYPE_STORE, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -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' => UserBalance::USER_TYPE_STORE, |
|
|
|
|
|
'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='') { |
|
|
@ -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' => UserBalance::USER_TYPE_STORE, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -274,6 +298,19 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
$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' => UserBalance::USER_TYPE_STORE, |
|
|
|
|
|
'source_id' => $store->id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -293,4 +330,129 @@ class FinancialRecordService implements FinancialRecordServiceInterface |
|
|
{ |
|
|
{ |
|
|
$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, |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MM, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MM_PLAT_NEW_USER, |
|
|
|
|
|
$desc = '市场经理发展新用户', |
|
|
|
|
|
$comment = '市场经理发展新用户奖励' |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => UserBalance::USER_TYPE_MM, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mmAwardByNewStore( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MM, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MM_PLAT_NEW_STORE, |
|
|
|
|
|
$desc = '市场经理发展新商户', |
|
|
|
|
|
$comment = '市场经理发展新商户奖励' |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => UserBalance::USER_TYPE_MM, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpAwardByPlatNewUser( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_PLAT_NEW_USER, |
|
|
|
|
|
$desc = '服务商发展新用户', |
|
|
|
|
|
$comment = '服务商发展新用户奖励' |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => UserBalance::USER_TYPE_MP, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpAwardByNewStore( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_PLAT_NEW_STORE, |
|
|
|
|
|
$desc = '服务商发展新商户', |
|
|
|
|
|
$comment = '服务商发展新商户奖励' |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => UserBalance::USER_TYPE_MP, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @inheritDoc |
|
|
|
|
|
*/ |
|
|
|
|
|
public function mpSeparateAccountByOLOrderComp( |
|
|
|
|
|
$user_id, |
|
|
|
|
|
$source_id, |
|
|
|
|
|
$money, |
|
|
|
|
|
$user_type = FinancialRecord::USER_TYPE_MP, |
|
|
|
|
|
$source_type = FinancialRecord::SOURCE_TYPE_ORDER, |
|
|
|
|
|
$money_type = FinancialRecord::MONEY_TYPE_MP_OL_ORDER, |
|
|
|
|
|
$desc = '服务商线上订单分账', |
|
|
|
|
|
$comment = '服务商用户线上订单完成后分账' |
|
|
|
|
|
) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->recordAll($user_id, $source_id, $money, $user_type, $source_type, $money_type, $desc, $comment); |
|
|
|
|
|
|
|
|
|
|
|
// 维护余额
|
|
|
|
|
|
$balance = UserBalance::firstOrNew([ |
|
|
|
|
|
'user_type' => UserBalance::USER_TYPE_MP, |
|
|
|
|
|
'source_id' => $user_id |
|
|
|
|
|
]); |
|
|
|
|
|
$balance->balance = bcadd($balance->balance, $money, 2); |
|
|
|
|
|
$balance->save(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |