调整商家端语音播报推送
parent
b9d68c2db6
commit
d2eb0f422a
|
|
@ -41,19 +41,21 @@ class QuotaV1SendCommand extends Command
|
||||||
$walletService = new WalletService();
|
$walletService = new WalletService();
|
||||||
//依次分红
|
//依次分红
|
||||||
foreach ($userInfos as $userInfo) {
|
foreach ($userInfos as $userInfo) {
|
||||||
$log = new QuotaV1SendLog();
|
if ($userInfo->bonusable) {//只针对享受分红的人发放
|
||||||
$log->user_id = $userInfo->user_id;
|
$log = new QuotaV1SendLog();
|
||||||
$log->job_id = $job->id;
|
$log->user_id = $userInfo->user_id;
|
||||||
$log->amount = round(bcmul(bcdiv($job->amount, $totalQuotaV1, 5), $userInfo->quota_v1, 3));
|
$log->job_id = $job->id;
|
||||||
$log->save();
|
$log->amount = round(bcmul(bcdiv($job->amount, $totalQuotaV1, 5), $userInfo->quota_v1, 3));
|
||||||
try {
|
$log->save();
|
||||||
DB::beginTransaction();
|
try {
|
||||||
$log->update(['status'=>1]);
|
DB::beginTransaction();
|
||||||
$walletService->changeBalance($userInfo->user, $log->amount, WalletLog::ACTION_QUOTA_V1, '老配额分红', $log);
|
$log->update(['status'=>1]);
|
||||||
DB::commit();
|
$walletService->changeBalance($userInfo->user, $log->amount, WalletLog::ACTION_QUOTA_V1, '老配额分红', $log);
|
||||||
} catch (Throwable $th) {
|
DB::commit();
|
||||||
DB::rollBack();
|
} catch (Throwable $th) {
|
||||||
report($th);
|
DB::rollBack();
|
||||||
|
report($th);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class MerchantUnipushService extends UniPushService
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pushCid($sn, $message->user->cid->m_cid, $message->title, $message->content, [
|
return $this->pushPayload($sn, $message->user->cid->m_cid, $message->title, $message->content, [
|
||||||
'jump_type' => $message->jump_type == 0 ? 1 : $message->jump_type,
|
'jump_type' => $message->jump_type == 0 ? 1 : $message->jump_type,
|
||||||
'jump_link' => $message->type == 1 || empty($message->jump_link) ? '/pages/news/index' : $message->jump_link,
|
'jump_link' => $message->type == 1 || empty($message->jump_link) ? '/pages/news/index' : $message->jump_link,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,61 @@ class UniPushService
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function createPushPayloadData($title, $body, $params = [])
|
||||||
|
{
|
||||||
|
$payload = json_encode($params);
|
||||||
|
return [
|
||||||
|
'settings'=>[
|
||||||
|
'ttl'=> 3600000,
|
||||||
|
'strategy'=> [
|
||||||
|
'default'=>1,
|
||||||
|
'ios'=>4,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'push_message'=>[
|
||||||
|
'transmission'=> json_encode([
|
||||||
|
// 'title' => $title,
|
||||||
|
// 'content'=> $body,
|
||||||
|
'payload'=> $title,
|
||||||
|
]),
|
||||||
|
// 'notification'=>[
|
||||||
|
// 'title' => $title,
|
||||||
|
// 'body' => $body,
|
||||||
|
// 'click_type'=> 'payload', //默认打开首页
|
||||||
|
// 'payload'=> $payload,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
'push_channel'=>[
|
||||||
|
'android'=>[
|
||||||
|
'ups'=> [
|
||||||
|
'transmission'=> json_encode([
|
||||||
|
// 'title' => $title,
|
||||||
|
// 'content'=> $body,
|
||||||
|
'payload'=> $title,
|
||||||
|
]),
|
||||||
|
// 'notification'=>[
|
||||||
|
// 'title' => $title,
|
||||||
|
// 'body' => $body,
|
||||||
|
// 'click_type'=> 'payload', //默认打开首页
|
||||||
|
// 'payload'=> $payload,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'ios'=>[
|
||||||
|
'type'=>'notify',
|
||||||
|
'payload' => $payload,
|
||||||
|
'aps'=>[
|
||||||
|
'alert'=>[
|
||||||
|
'title'=>$title,
|
||||||
|
'body'=>$body,
|
||||||
|
],
|
||||||
|
'content-available'=> 0,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定cid和user_id
|
* 绑定cid和user_id
|
||||||
*
|
*
|
||||||
|
|
@ -252,6 +307,25 @@ class UniPushService
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function pushPayload(string $sn, string $cid, string $title, string $body, array $params = [])
|
||||||
|
{
|
||||||
|
return $this->formatResStatus(
|
||||||
|
$this->post('push/single/cid', array_merge([
|
||||||
|
'request_id' => $sn,
|
||||||
|
'audience'=>[
|
||||||
|
'cid'=>[
|
||||||
|
$cid,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
], $this->createPushPayloadData($title, $body, $params)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected function formatResStatus($res): bool
|
protected function formatResStatus($res): bool
|
||||||
{
|
{
|
||||||
if (Arr::get($res, 'code', 1) === 0) {
|
if (Arr::get($res, 'code', 1) === 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue