diff --git a/home/controllers/h5/market/Draw.php b/home/controllers/h5/market/Draw.php index dcd932ba..e1d7507c 100644 --- a/home/controllers/h5/market/Draw.php +++ b/home/controllers/h5/market/Draw.php @@ -8,7 +8,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class Draw extends CI_Controller { - private $activityId = 4; public function __construct() { @@ -27,19 +26,37 @@ class Draw extends CI_Controller */ public function index() { - $winNumAry = [['title' => '请选择...', 'value' => 0], ['title' => '1人', 'value' => 1], ['title' => '2人', 'value' => 2], - ['title' => '5人', 'value' => 5], ['title' => '50人', 'value' => 50]]; - $winTypeAry = []; - $winTypeAryGet = $this->mdSyliveOrder->winTypeAry($this->activityId); - foreach ($winTypeAryGet as $k => $v) { - $winTypeAry[] = ['title' => $v['tag'] . ' ' . $v['title'], 'value' => $k]; + $this->load->view('/h5/market/draw/index'); + } + + /** + * Notes:验证登录码 + * Created on: 2022/11/10 18:04 + * Created by: dengbw + */ + public function post_code() + { + $params = $this->input->post(); + $drawCode = $params['drawCode']; + if (!$drawCode) { + $this->show_json(400, '请输入抽奖码'); + } + $re = $this->mdSyliveActivity->get(['drawCode' => $drawCode, 'status' => 0], 'title,activityId'); + if ($re['activityId']) { + $activityId = intval($re['activityId']); + $winNumAry = [['title' => '请选择...', 'value' => 0], ['title' => '1人', 'value' => 1], ['title' => '2人', 'value' => 2], + ['title' => '5人', 'value' => 5], ['title' => '50人', 'value' => 50]]; + $winTypeAry = []; + $winTypeAryGet = $this->mdSyliveOrder->winTypeAry($activityId); + foreach ($winTypeAryGet as $k => $v) { + $winTypeAry[] = ['title' => $v['tag'] . ' ' . $v['title'], 'value' => $k]; + } + $title = $re['title'] . '_私域直播抽奖'; + $data = ['winNumAry' => $winNumAry, 'winTypeAry' => $winTypeAry, 'activityId' => $activityId, 'title' => $title]; + $this->show_json(200, '抽奖码验证成功', $data); + } else { + $this->show_json(400, '抽奖码验证失败'); } - $title = '私域直播抽奖'; - $re = $this->mdSyliveActivity->get(['activityId' => $this->activityId], 'title'); - $re['title'] && $title = $re['title'] . '_' . $title; - $data['info'] = ['winNumAry' => $winNumAry, 'winTypeAry' => $winTypeAry]; - $data['title'] = $title; - $this->load->view('/h5/market/draw/index', $data); } /** @@ -50,10 +67,11 @@ class Draw extends CI_Controller public function post_win_num() { $params = $this->input->post(); + $activityId = intval($params['activityId']); $winType = intval($params['winType']); $winNumCount = 0; if ($winType) { - $winNumCount = $this->mdSyliveOrder->count(['activityId' => $this->activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]); + $winNumCount = $this->mdSyliveOrder->count(['activityId' => $activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]); } $data['winMsgTip'] = $winNumCount; $this->show_json(200, '操作成功', $data); @@ -69,17 +87,18 @@ class Draw extends CI_Controller $params = $this->input->post(); $winNum = intval($params['winNum']); $winType = intval($params['winType']); + $activityId = intval($params['activityId']); if (!$winType) { $this->show_json(400, '请选择抽奖类型'); } if (!$winNum) { $this->show_json(400, '请选择中奖人数'); } - $winTypeAry = $this->mdSyliveOrder->winTypeAry($this->activityId); + $winTypeAry = $this->mdSyliveOrder->winTypeAry($activityId); $price = $winTypeAry[$winType]['price']; $limit = $winNum >= 50 ? 100 : 30; //随机数据 - $sql = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$this->activityId} + $sql = "SELECT id,userId,mobile,uname,totalPrice FROM lc_market_sylive_order WHERE activityId={$activityId} AND win=0 AND status=1 AND totalPrice>={$price} ORDER BY RAND() LIMIT {$limit}"; $res = $this->db->query($sql)->result_array(); $list = $result = []; @@ -97,7 +116,7 @@ class Draw extends CI_Controller } } $data['list'] = $list; - //$winNumCount = $this->mdSyliveOrder->count(['activityId' => $this->activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]); + //$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) { @@ -121,11 +140,12 @@ class Draw extends CI_Controller $params = $this->input->post(); $result = $params['result']; $winType = $params['type']; + $activityId = intval($params['activityId']); if (!$result || !$winType) { $this->show_json(400, '参数错误'); } $resultSet = []; - $winTypeAry = $this->mdSyliveOrder->winTypeAry($this->activityId, $winType); + $winTypeAry = $this->mdSyliveOrder->winTypeAry($activityId, $winType); $winTime = date('Y-m-d H:i:s'); $smsTime = date('Y-m-d H:i'); $showMobile = ''; @@ -147,7 +167,7 @@ class Draw extends CI_Controller } } $msg = $showMobile ? $showMobile : "成功抽中{$winNum}人"; - $winNumCount = $this->mdSyliveOrder->count(['activityId' => $this->activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]); + $winNumCount = $this->mdSyliveOrder->count(['activityId' => $activityId, 'win' => 1, 'status' => 1, 'winType' => $winType]); $data['result'] = $resultSet; $data['winMsgTip'] = $winNumCount; $this->show_json(200, $msg ? $msg : '成功抽奖', $data); diff --git a/home/controllers/h5/market/sylive/Tstic.php b/home/controllers/h5/market/sylive/Tstic.php index 5b7c47ec..c080eaa8 100644 --- a/home/controllers/h5/market/sylive/Tstic.php +++ b/home/controllers/h5/market/sylive/Tstic.php @@ -275,8 +275,8 @@ class Tstic extends Admin{ ]; $ty_order_lists = $this->sylive_data_entity->top_team_user_lists($a_id,'order',[], 1, 10,$this->uid); $ty_order = [ - 'title' => '团员观看排行', - 'url' => "/h5/market/sylive/tstic/rank?type=watch&skey={$skey}>ype=ty", + 'title' => '团员订单排行', + 'url' => "/h5/market/sylive/tstic/rank?type=order&skey={$skey}>ype=ty", 'list' => $ty_order_lists['lists'] ]; $data = [ diff --git a/home/views/h5/market/draw/index.php b/home/views/h5/market/draw/index.php index b2d96eb7..e9da5321 100644 --- a/home/views/h5/market/draw/index.php +++ b/home/views/h5/market/draw/index.php @@ -5,22 +5,25 @@ -