当前位置:网站首页>Yunfan mall -- Yunfan mall system development source code sharing
Yunfan mall -- Yunfan mall system development source code sharing
2022-06-25 12:27:00 【Procedure 15528175269】
Yunfan mall system development source code :
// 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 ');;
}
边栏推荐
- High imitation blue playing network disk file sharing to make money network disk PHP system source code
- R language dplyr package summary_ The at function calculates the count number, mean and median of multiple data columns (specified by vectors) in the dataframe data, and specifies na RM parameter, spe
- 网络上开户买股票是否安全呢?
- Does sklearex make your sklearn machine learning model training fly fast?
- RecyclerView滚动到指定位置
- sklearnex 让你的 sklearn 机器学习模型训练快得飞起?
- 黑马畅购商城---6.品牌、规格统计、条件筛选、分页排序、高亮显示
- The cloud native data lake has passed the evaluation and certification of the ICT Institute with its storage, computing, data management and other capabilities
- R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用stress.type参数指定强调线的id子集的线条的类型(type)
- What is principal component analysis? Dimension reduction of classical case analysis variables
猜你喜欢

黑马畅购商城---1.项目介绍-环境搭建

黑馬暢購商城---3.商品管理

黑马畅购商城---6.品牌、规格统计、条件筛选、分页排序、高亮显示

Installation and removal of MySQL under Windows

SDN system method | 9 Access network

How do super rookies get started with data analysis?

What is Flink? What can Flink do?

What are redis avalanche, penetration and breakdown?

devsecops与devops的理解与建设

黑马畅购商城---2.分布式文件存储FastDFS
随机推荐
The first techo day Tencent technology open day in 2022 will be held online on June 28
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the lrtest function of epidisplay package to perform multiple model
The R language uses the follow up The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The type parameter specifies the line type of
An article clearly explains MySQL's clustering / Federation / coverage index, back to table, and index push down
Explain AHP in human language (very detailed principle + simple tool implementation)
一篇文章讲清楚MySQL的聚簇/联合/覆盖索引、回表、索引下推
Recyclerview scrolls to the specified location
R语言使用构建有序多分类逻辑回归模型、epiDisplay包的ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the summary function to obtain the summary statistical information
Hook technology
[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?
Why can't you Ping the website but you can access it?
The network traceroute command is used to determine the path through which IP packets access the destination address.
【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
2022 meisai topic C idea sharing + translation
一套自动化无纸办公系统(OA+审批流)源码:带数据字典
Kotlin学习笔记
动态代理
Dark horse shopping mall ---3 Commodity management
confluence7.4.X升级实录