market_draw_1111

This commit is contained in:
dengbw
2022-11-11 10:30:03 +08:00
committed by lccsw
parent 1e2148c3ea
commit cbead42b24
2 changed files with 26 additions and 24 deletions
+13 -5
View File
@@ -115,15 +115,23 @@ class Draw extends CI_Controller
'uname' => $v['uname'], 'mobile' => $v['mobile']];
}
}
$count = count($list);
$time = "在【" . date('Y-m-d H:i:s') . "";
if (!$count) {
$this->show_json(400, "{$time}暂无获取到抽奖人,不能开始抽奖");
}
if ($count < $winNum) {
$this->show_json(400, "{$time}获取到抽奖人数{$count}人,不够选择中奖人数{$winNum}人,不能开始抽奖");
}
$data['list'] = $list;
//$winNumCount = $this->mdSyliveOrder->count(['activityId' => $activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]);
//$num = $winTypeAry[$winType]['num'];
//$winNum = ($winNum + $winNumCount) > $num ? $num - $winNumCount : $winNum;
if ($winNum > 0) {
shuffle($list);
$result = array_slice($list, 0, $winNum);
}
$msg = "在【" . date('Y-m-d H:i:s') . "获取到信息";
//选择中奖人结果
shuffle($list);
$result = array_slice($list, 0, $winNum);
$msg = "{$time}获取到信息,可开始抽奖";
$data['result'] = $result;
$data['type'] = $winType;
$data['prizeUrl'] = $winTypeAry[$winType]['img'];
+13 -19
View File
@@ -208,25 +208,19 @@
},
success: function (re) {
if (re.code == 200) {
if (re.data.list.length == 0) {
that.msgTip = '无抽奖人...';
} else if (re.data.list.result == 0) {
that.msgTip = '无中抽奖人...';
} else {
that.msgTip = re.msg;
that.topTitle = $("#win_type_id").find("option:selected").text();
that.draw = {
list: re.data.list,
result: re.data.result,
type: re.data.type,
prizeUrl: re.data.prizeUrl
};
// let arr = that.draw.list.slice(0);
// arr.sort(function () {
// return Math.random() - 0.5;
// });
// that.list = arr;
}
that.msgTip = re.msg;
that.topTitle = $("#win_type_id").find("option:selected").text();
that.draw = {
list: re.data.list,
result: re.data.result,
type: re.data.type,
prizeUrl: re.data.prizeUrl
};
// let arr = that.draw.list.slice(0);
// arr.sort(function () {
// return Math.random() - 0.5;
// });
// that.list = arr;
} else {
that.msgTip = re.msg;
}