50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\queue\redis;
|
|
|
|
use app\api\model\UserMoney;
|
|
use app\common\library\DatabaseRoute;
|
|
use think\facade\Log;
|
|
use think\queue\Job;
|
|
|
|
/**
|
|
* 奖项领取
|
|
*/
|
|
class DiscReceiveQueue extends BaseQueue
|
|
{
|
|
public function run( $data)
|
|
{
|
|
$drawsInfo = $data['draws'];
|
|
if ($drawsInfo['type'] != 2) {
|
|
return;
|
|
}
|
|
|
|
$user = DatabaseRoute::getDb('tb_user', $drawsInfo['user_id'])->find();
|
|
if ($user['status'] != 1) {
|
|
return;
|
|
}
|
|
|
|
$id = DatabaseRoute::getDb('user_money_details', $drawsInfo['user_id'], true)->insert([
|
|
'user_id' => $drawsInfo['user_id'],
|
|
'title' => '现金大转盘',
|
|
'classify' => 5,
|
|
'type' => 1,
|
|
'state' => 2,
|
|
'money' => $drawsInfo['number'],
|
|
'content' => "现金红包奖励{$drawsInfo['number']}元",
|
|
'money_type' => 1,
|
|
'create_time' => getNormalDate(),
|
|
'source_id' => $drawsInfo['id']
|
|
]);
|
|
|
|
DatabaseRoute::getDb('disc_spinning_record', $drawsInfo['user_id'], true, true, false)->where([
|
|
'id' => $drawsInfo['id']
|
|
])->update([
|
|
'target' => 2,
|
|
'target_id' => $id
|
|
]);
|
|
|
|
UserMoney::updateAmount($drawsInfo['user_id'], $drawsInfo['number']);
|
|
|
|
}
|
|
} |