当前位置:网站首页>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 ');;
}
边栏推荐
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用summary函数获取模型汇总统计信息
- 为什么ping不通网站 但是却可以访问该网站?
- The first techo day Tencent technology open day in 2022 will be held online on June 28
- The network traceroute command is used to determine the path through which IP packets access the destination address.
- 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
- plt. GCA () picture frame and label
- Use PHP script to view the opened extensions
- Repair the error that ECSHOP background orders prompt insufficient inventory when adding goods. Please reselect
- How can we make an annual income of onemillion yuan by making our own media video?
- 黑马畅购商城---1.项目介绍-环境搭建
猜你喜欢
一款好用的印章设计工具 --(可转为ofd文件)
Dark horse shopping mall ---6 Brand, specification statistics, condition filtering, paging sorting, highlighting
K8s, docker compose install MySQL 8.0.18
Rank sum ratio comprehensive evaluation method for common models in mathematical modeling
使用php脚本查看已开启的扩展
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
What are redis avalanche, penetration and breakdown?
黑马畅购商城---6.品牌、规格统计、条件筛选、分页排序、高亮显示
[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?
What is Flink? What can Flink do?
随机推荐
15、wpf之button样式小记
Implementing Domain Driven Design - using the ABP framework - Summary of a series of articles
图片打标签之获取图片在ImageView中的坐标
R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验(检验模型效果)
Hook技术
R language uses the scale function to scale the input data of neural network to the minimum and maximum, scale the data to between 0 and 1, and divide the data set into training set and test set
[on]learning dynamic and hierarchical traffic spatiotemporal features with transformer
R language uses GLM function to build Poisson logarithmic linear regression model, processes three-dimensional contingency table data to build saturation model, and poisgof function of epidisplay pack
[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer
Kotlin Foundation
Arm immediate
How to use SPSS to do grey correlation analysis? Quick grasp of hand-to-hand Teaching
Update of complex JSON in MySQL
VIM common commands and shortcut keys
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
Install MySQL client
R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用summary函数获取模型汇总统计信息
20、wpf之MVVM命令绑定
Windows下MySQL的安装和删除
sudo: ulimit: command not found