当前位置:网站首页>Introduction to jiuhongtianxia system development function -- jiuhongtianxia app development source code sharing
Introduction to jiuhongtianxia system development function -- jiuhongtianxia app development source code sharing
2022-06-25 12:27:00 【Procedure 15528175269】
Nine red world system source code sharing :
// Get the order requiring lottery .
$spell_order_model = StoreOrderSpell::where('goods_id',$data['id'])->where('is_pay',1)->where('status',0)->order('edit_time asc');
if( intval($data['num']) > 0 )
{
$spell_order_model = $spell_order_model->limit(intval($data['num']));
}
$spell_order_info = $spell_order_model->select()->toArray();
if( ! $spell_order_info )
return Json::fail(' The commodity group has no participants for the time being ');
// Access to product information
$goods_info = StoreProduct::where('id',$data['id'])->find()->toArray();
$sum_people = count($spell_order_info);
$sum_win = $sum_lose = $level0_win = $level0_lose = $level1_win = $level1_lose = $level2_win = $level2_lose = $level3_win = $level3_lose = $level4_win = $level4_lose = 0;
User::beginTrans();
try {
foreach ($spell_order_info as $value) {
$order_info = \app\admin\model\order\StoreOrder::where('id', $value['oid'])->find()->toArray();
$user_log_info = StoreOrderSpellUserLog::where('uid', $value['uid'])->where('goods_id', $value['goods_id'])->find()->toArray();
$is_pick = false;
// If you don't choose the winner or loser , You need to draw the prize at random according to the grade
if ($value['win_flag'] != 1 && $value['lose_flag'] != 1) {
$is_pick = self::randPick($user_log_info['level'], $goods_info);
}
// If you win the prize
if ($is_pick || $value['win_flag'] == 1) {
// Handling winning operations
self::userWin($value, $user_log_info, $order_info['pay_price'], $goods_info['lose_reward_rate']);
$sum_win++;
${'level' . $user_log_info['level'] . '_win'}++;
} else {
// Handle non winning operations
$sum_lose++;
${'level' . $user_log_info['level'] . '_lose'}++;
self::userLose($value, $user_log_info, $order_info['pay_price'], $order_info['pay_type'], $goods_info['lose_reward_rate'],$goods_info['user_level_no']);
}
}
// Add lottery record
$open_log_data = compact('sum_people', 'sum_win', 'sum_lose', 'level0_win', 'level0_lose', 'level1_win', 'level1_lose', 'level2_win', 'level2_lose', 'level3_win', 'level3_lose', 'level4_win', 'level4_lose');
$open_log_data['add_time'] = time();
$open_log_data['goods_id'] = $data['id'];
StoreOrderSpellOpenLog::insert($open_log_data);
User::commitTrans();
return Json::success(' Successful lottery ');
} catch (\Exception $e)
{
User::rollbackTrans();
return Json::fail(' Lottery transaction execution failed , Please contact the technical staff to check the reason ');;
}
边栏推荐
- 刷入Magisk通用方法
- What are redis avalanche, penetration and breakdown?
- 黑马畅购商城---3.商品管理
- ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
- The R language cartools package divides data, the scale function scales data, and the NaiveBayes function of e1071 package constructs a naive Bayesian model
- Database Series: MySQL index optimization summary (comprehensive version)
- 2022年首期Techo Day腾讯技术开放日将于6月28日线上举办
- JS monitors the width and height changes of div
- Explain AHP in human language (very detailed principle + simple tool implementation)
- sudo: ulimit: command not found
猜你喜欢

How to use ARIMA model for prediction?

揭秘GaussDB(for Redis):全面對比Codis

Dark horse shopping mall ---8 Microservice gateway and JWT token

2022 meisai topic C idea sharing + translation

ROS notes (06) - definition and use of topic messages

2022年首期Techo Day腾讯技术开放日将于6月28日线上举办

A set of automated paperless office system (oa+ approval process) source code: with data dictionary

confluence7.4. X upgrade record

SDN system method | 9 Access network

What are redis avalanche, penetration and breakdown?
随机推荐
confluence7.4.X升级实录
Dynamic proxy
Dark horse shopping mall ---3 Commodity management
SDN系统方法 | 9. 接入网
Rank sum ratio comprehensive evaluation method for common models in mathematical modeling
R语言caTools包进行数据划分、scale函数进行数据缩放、e1071包的naiveBayes函数构建朴素贝叶斯模型
Image tagging to obtain the coordinates of the image in the ImageView
使用php脚本查看已开启的扩展
confluence7.4. X upgrade record
2022 Baidu collection batch automatic push assistant
Why do we do autocorrelation analysis? Explain application scenarios and specific operations
The source code of the hottest online disk money making system in 2022 imitates Lanzou online disk / Chengtong online disk / sharing money making cloud disk system / online disk VIP Download System
Today, I will explain to you what is DFI and its development prospects
【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
网络上开户买股票是否安全呢?
ARM V7 协处理器
黑马畅购商城---1.项目介绍-环境搭建
ARM V7 连续加载/存储
黑马畅购商城---6.品牌、规格统计、条件筛选、分页排序、高亮显示
PD1.4转HDMI2.0转接线拆解。