This commit is contained in:
xiaoyu
2023-10-12 15:36:16 +08:00
parent e414d7edb9
commit f8ca91ce60
2 changed files with 51 additions and 49 deletions
+50 -48
View File
@@ -122,11 +122,11 @@ class Draw extends CI_Controller
if (date('Y-m-d H:i:s') > $re['timeEnd']) {
$this->show_json(400, "直播结束时间【{$re['timeEnd']}】,不能抽奖了...");
}
$limit = $winNum >= 50 ? 400 : 200;//随机数据
$prizeUrl = '';
$whereOrder = ['activityId' => $activityId, 'win' => 0, 'status' => 1];
$sqlOrder = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId}
AND win=0 AND winType=0 AND status=1 ORDER BY RAND() LIMIT {$limit}";
$re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $activityId]);
if ($re_draw && $re_draw['winType']) {
$json_winType = json_decode($re_draw['winType'], true);
@@ -134,6 +134,14 @@ class Draw extends CI_Controller
if ($v['id'] == $winType) {
$v['img'] && $prizeUrl = build_qiniu_image_url($v['img']);
if ($v['itemIds']) {
//不中奖奖品
if($activityId == 21 and in_array($winType, array(1,2))){
$activityId = 13;
$whereOrder = ['activityId' => $activityId, 'status' => 1];
$v['itemIds'] = [21];
}
$itemIds = implode(',', $v['itemIds']);
$whereOrder["itemId in({$itemIds})"] = null;
$sqlOrder = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId}
@@ -145,6 +153,7 @@ class Draw extends CI_Controller
}
$time = "在【" . date('Y-m-d H:i:s') . "";
$count = $this->mdSyliveOrder->count($whereOrder);
$list = $result = [];
if ($count) {//判断抽奖名单
//随机数据
@@ -177,29 +186,29 @@ class Draw extends CI_Controller
$data['list'] = $list;
//暗箱
if($activityId == 15 && in_array($winType, array(2,3)))
{
$list = array();
$sqlOrder = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId} AND win=0 AND winType={$winType} AND status=1 ORDER BY RAND() LIMIT {$winNum}";
$res = $this->db->query($sqlOrder)->result_array();
if ($res) {
$str_userIds = implode(',', array_column($res, 'userId'));
$map_user = $this->mdSyliveUser->map('userId', 'headimg', ["userId in({$str_userIds})" => null]);
foreach ($res as $v) {
if ($v['mobile']) {
$tel = mobile_asterisk($v['mobile']);
$name = $v['uname'] ? name_asterisk($v['uname']) : '***';
if ($map_user[$v['userId']]) {
$headimg = $map_user[$v['userId']];
} else {
$headimg = $defaultHead;
}
$list[] = ['headimg' => $headimg, 'name' => $name, 'tel' => $tel, 'id' => intval($v['id']), 'uname' => $v['uname'], 'mobile' => $v['mobile']];
}
}
}
}
// if($activityId == 15 && in_array($winType, array(2,3)))
// {
// $list = array();
// $sqlOrder = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId} AND win=0 AND winType={$winType} AND status=1 ORDER BY RAND() LIMIT {$winNum}";
// $res = $this->db->query($sqlOrder)->result_array();
//
// if ($res) {
// $str_userIds = implode(',', array_column($res, 'userId'));
// $map_user = $this->mdSyliveUser->map('userId', 'headimg', ["userId in({$str_userIds})" => null]);
// foreach ($res as $v) {
// if ($v['mobile']) {
// $tel = mobile_asterisk($v['mobile']);
// $name = $v['uname'] ? name_asterisk($v['uname']) : '***';
// if ($map_user[$v['userId']]) {
// $headimg = $map_user[$v['userId']];
// } else {
// $headimg = $defaultHead;
// }
// $list[] = ['headimg' => $headimg, 'name' => $name, 'tel' => $tel, 'id' => intval($v['id']), 'uname' => $v['uname'], 'mobile' => $v['mobile']];
// }
// }
// }
// }
//选择中奖人结果
shuffle($list);
@@ -247,34 +256,27 @@ class Draw extends CI_Controller
$winNum = $sms = 0;
$dev = false !== strpos($_SERVER['HTTP_HOST'], 'dev') ? 1 : 0;
foreach ($result as $v) {
$ret = $this->mdSyliveOrder->update(['win' => 1, 'winType' => $winType, 'winTime' => $winTime], ["id" => $v['id']]);
if ($ret) {
$winNum++;
if($activityId == 21 and in_array($winType, array(1,2))){
$resultSet[] = $v;
$winNum++;
$sms++;
}else{
//半价车不发短信
if($activityId == 20){
if(in_array(1,2)){
$dev = 1;
$ret = $this->mdSyliveOrder->update(['win' => 1, 'winType' => $winType, 'winTime' => $winTime], ["id" => $v['id']]);
if ($ret) {
$winNum++;
$resultSet[] = $v;
//中奖发短信
if ($v['mobile'] && $dev == 0) {//dev==1不发短信通知
if ($winTime >= $re['timeStart'] && $winSms) {//直播开始时中奖发短信
b2m_send_sms($v['mobile'], $winSms);
$sms++;
}
}
}
//中奖发短信
if ($v['mobile'] && $dev == 0) {//dev==1不发短信通知
if ($winTime >= $re['timeStart'] && $winSms) {//直播开始时中奖发短信
b2m_send_sms($v['mobile'], $winSms);
$sms++;
}
}
// if ($winType == 1 || $winType == 2) {//一等奖、二等奖不发短信
// $showMobile = $showMobile ? $showMobile . "{$v['uname']}({$v['mobile']})" : "{$v['uname']}({$v['mobile']})";
// } else if ($v['mobile'] && $dev == 0) {//dev==1不发短信通知
// if ($smsTime >= "2022-11-11 19:00") {//发短信
// $content = "【好店云】礼品锁定提醒:感谢您参与东风ev新能源双11嗨购日专场活动,恭喜您成功锁定({$winTypeAry['title']})礼品一份,只需您在11月30日晚20点前在当地门店选购东风ev新车型纳米box,即可领取礼品哦!";
// b2m_send_sms($v['mobile'], $content);
// }
// }
}
}
$msg = $showMobile ? $showMobile : "成功抽中{$winNum}";
+1 -1
View File
@@ -15,7 +15,7 @@
<div class="bg-fff" id="app" ref="app">
<div class="container" v-if="info.screenDisplay==1">
<div class="absolute box-center mt50 box-1280-720 bg-no-repeat bg-size-fullwidth bg-pos-top" :style="bgImg">
<div class="absolute box-center pt3 font-50 text-bold color-fff text-italic">
<div class="absolute box-center pt3 font-50 text-bold color-000 text-italic">
{{topTitle}}
</div>
<div class="maincontent ulib-r20 overflowhidden">