当前位置:网站首页>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 ');;
}
边栏推荐
- Is it safe to open an account and buy stocks on the Internet?
- ECSHOP quickly purchases goods, simplifies the shopping process, and improves the user experience through one-step shopping
- What is the primordial universe
- If you also want to be we media, you might as well listen to Da Zhou's advice
- ECSHOP whole site custom URL supports directory type
- JS to realize the calculation of discrete aggregation points
- The dist function of R language calculates the distance between two samples in dataframe data, returns the distance matrix between samples, and specifies the distance calculation method through the me
- Mpai data science platform random forest classification \ explanation of regression parameter adjustment
- 2022 meisai topic C idea sharing + translation
- Use PHP script to view the opened extensions
猜你喜欢
Uncover gaussdb (for redis): comprehensive comparison of CODIS
Linear regression of common mathematical modeling models for College Students
How to use SPSS to do grey correlation analysis? Quick grasp of hand-to-hand Teaching
Explain factor analysis in simple terms, with case teaching (full)
揭秘GaussDB(for Redis):全面对比Codis
Rank sum ratio comprehensive evaluation method for common models in mathematical modeling
Flutter common commands and problems
Uncover gaussdb (for redis): comprehensive comparison of CODIS
刷入Magisk通用方法
15. Notes on the button style of WPF
随机推荐
Kotlin Foundation
Explanation of ideas and sharing of pre-processing procedures for 2021 US game D (with pre-processing data code)
Quarkus SaaS dynamic data source switching implementation, simple and perfect
一篇文章讲清楚MySQL的聚簇/联合/覆盖索引、回表、索引下推
What is the primordial universe
What is Flink? What can Flink do?
Today, I will explain to you what is DFI and its development prospects
Arm V7 LDR STR memory access
【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
Explain factor analysis in simple terms, with case teaching (full)
R语言dplyr包filter函数过滤dataframe数据中指定数据列的内容不是(不等于指定向量中的其中一个)指定列表中的数据行
A commonly used statistical modeling method -- difference analysis
刷入Magisk通用方法
The dist function of R language calculates the distance between two samples in dataframe data, returns the distance matrix between samples, and specifies the distance calculation method through the me
Network related encapsulation introduced by webrtc native M96 basic base module
R语言dplyr包summarise_at函数计算dataframe数据中多个数据列(通过向量指定)的计数个数、均值和中位数、在每个函数内部指定na.rm参数、通过list指定函数列表
一套自动化无纸办公系统(OA+审批流)源码:带数据字典
confluence7.4. X upgrade record
Kotlin study notes
Kotlin基础