[ 'type' => 1, 'desc' => '消费卡片', ], 2 => [ 'type' => 2, 'desc' => '任务', ], 3 => [ 'type' => 3, 'desc' => '充值', ], 4 => [ 'type' => 4, 'desc' => '系统扣除', ], 5 => [ 'type' => 5, 'desc' => '系统补偿', ], 6 => [ 'type' => 6, 'desc' => '收获', ], 7 => [ 'type' => 7, 'desc' => '签到', ], 8 => [ 'type' => 8, 'desc' => '赠送', ], 9 => [ 'type' => 9, 'desc' => '获赠', ], 10 => [ 'type' => 10, 'desc' => '分享奖励', ], 11 => [ 'type' => 11, 'desc' => '消费退回一张', ], 12 => [ 'type' => 12, 'desc' => '红包', ], 13 => [ 'type' => 13, 'desc' => '72小时提升匹配成功率' ], 14 => [ 'type' => 14, 'desc' => '心动邀请' ], 15 => [ 'type' => 15, 'desc' => '会员每日小花礼包' ] ); /** * 获取奖励红包 1.小花|2.小花红包|3.现金红包 * @param int $uid * @return bool|string * @throws Exception */ public function redpack(int $uid) { $feed_limit = Redis::hget("session_msy_{$uid}", "feed_limit") ?? 1; switch ($feed_limit) { case 5: // 小花红包 case 15: // 小花 $red_flower = sprintf("%.2f", 0.5 + mt_rand() / mt_getrandmax() * (0.8 - 0.5)); break; case 30: case 50: case 70: case 90: $red_flower = sprintf("%.2f", 0.3 + mt_rand() / mt_getrandmax() * (0.5 - 0.3)); break; default: return false; } DB::beginTransaction(); try { DB::table('kdgx_partner_charge_user')->where('uid', $uid)->increment('red_flower', $red_flower); $data = array( 'uid' => $uid, 'create_at' => time(), 'type' => 12, 'gold_flower' => 0, 'red_flower' => $red_flower, 'jsk' => 0, 'remark' => "划卡片红包" ); $flowerLog = self::create($data); dispatch_now(new SignFlowerReportJob($flowerLog, UserModel::find($uid))); DB::commit(); return array( 'fee' => $red_flower, 'type' => 1 ); } catch (Exception $e) { DB::rollBack(); return false; } } }