Browse Source

发送短信

master
weigang 5 years ago
parent
commit
62bf1cf7d3
  1. 16
      app/Service/v3/Implementations/FinancialRecordService.php
  2. 19
      app/Service/v3/Implementations/SeparateAccountsService.php

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

@ -6,18 +6,11 @@ use App\Constants\v3\UserType;
use App\Model\v3\FinancialRecord;
use App\Model\v3\UserBalance;
use App\Service\v3\Interfaces\FinancialRecordServiceInterface;
use App\Service\v3\Interfaces\SmsSendServiceInterface;
use Hyperf\Di\Annotation\Inject;
class FinancialRecordService implements FinancialRecordServiceInterface
{
/**
* @Inject
* @var SmsSendServiceInterface
*/
protected $smsAliSendService;
public function ledgerAccounts($source_id, $money, $source_type, $money_type, $desc, $comment='')
{
return $this->record(
@ -85,9 +78,6 @@ class FinancialRecordService implements FinancialRecordServiceInterface
$balance->balance = bcadd($balance->balance, $money, 2);
$balance->save();
// 发送短信
$this->smsAliSendService->doCommunityFinancial($user_id, $money);
}
/**
@ -112,9 +102,6 @@ class FinancialRecordService implements FinancialRecordServiceInterface
]);
$balance->balance = bcadd($balance->balance, $money, 2);
$balance->save();
// 发送短信
$this->smsAliSendService->doCommunityFinancial($user_id, $money);
}
/**
@ -139,9 +126,6 @@ class FinancialRecordService implements FinancialRecordServiceInterface
]);
$balance->balance = bcadd($balance->balance, $money,2);
$balance->save();
// 发送短信
$this->smsAliSendService->doCommunityFinancial($user_id, $money);
}

19
app/Service/v3/Implementations/SeparateAccountsService.php

@ -20,6 +20,7 @@ use App\Service\v3\Interfaces\FinancialRecordServiceInterface;
use App\Service\v3\Interfaces\MiniprogramServiceInterface;
use App\Service\v3\Interfaces\OrderOnlineServiceInterface;
use App\Service\v3\Interfaces\SeparateAccountsServiceInterface;
use App\Service\v3\Interfaces\SmsSendServiceInterface;
use App\Service\v3\Interfaces\UserServiceInterface;
use App\TaskWorker\SSDBTask;
use Hyperf\DbConnection\Db;
@ -58,6 +59,12 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface
*/
protected $orderOnlineService;
/**
* @Inject
* @var SmsSendServiceInterface
*/
protected $smsAliSendService;
/**
* @inheritDoc
*/
@ -137,15 +144,27 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface
$orderMain->global_order_id,
$award['new_user_reward']
);
// 发送短信
co(function () use ($orderMain, $award) {
$this->smsAliSendService->doCommunityFinancial($orderMain->user_id, $award['new_user_reward']);
});
$this->financialRecordService->communityAwardByPlatNewUserFirstOLOrder(
$communityBind->source_id,
$orderMain->global_order_id,
$award['first_reward']
);
// 发送短信
co(function () use ($orderMain, $award) {
$this->smsAliSendService->doCommunityFinancial($orderMain->user_id, $award['first_reward']);
});
}
// 账单分成
$money = bcmul($orderMain->money, bcdiv($award['flow_reward'], 100, 6), 2);
$this->financialRecordService->communitySeparateAccountsByOrderComp($communityBind->source_id, $orderMain->global_order_id, $money);
// 发送短信
co(function () use ($orderMain, $money) {
$this->smsAliSendService->doCommunityFinancial($orderMain->user_id, $money);
});
}
// =======社区服务点分账 / End=======

Loading…
Cancel
Save