From 702edce0b1c7cc4ab83b8ee2ac2178f07d6faae1 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 1 Sep 2023 10:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=A5=96=E7=BB=93=E6=9E=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Zone.php | 23 +++++++++++++++++++++++ app/logic/Zone.php | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/controller/Zone.php b/app/controller/Zone.php index ebacbcf..6d56dfe 100644 --- a/app/controller/Zone.php +++ b/app/controller/Zone.php @@ -3,6 +3,7 @@ namespace app\controller; use app\BaseController; +use app\model\ConsumptionRecords; use app\model\Zone as ZoneModel; use app\model\ZoneGoods; use app\logic\Zone as ZoneLogic; @@ -82,6 +83,28 @@ class Zone extends BaseController ); } + /** + * 查看中奖结果 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function queryAwardsResult() + { + $param = Request::param(); + $c_r_id = $param['c_r_id']; + $userData = Session::get('login_user_data'); + + $queryWhere = ['status' => 1, 'user_id' => $userData['id'], 'id' => $c_r_id]; + $ConsumptionRecords = new ConsumptionRecords(); + $query = $ConsumptionRecords->where($queryWhere)->field('text_data,zone_goods_id')->find(); + if (!$query['text_data']) return $this->renderError('中奖结果数据不存在'); + $returnData = ZoneLogic::handleTextData(unserialize($query['text_data'])); + + return $this->renderSuccess('数据返回成功', ['list' => $returnData]); + } + } \ No newline at end of file diff --git a/app/logic/Zone.php b/app/logic/Zone.php index 04b9cc5..543319d 100644 --- a/app/logic/Zone.php +++ b/app/logic/Zone.php @@ -139,7 +139,7 @@ class Zone * @param $data * @return mixed */ - protected static function handleTextData($data) + public static function handleTextData($data) { foreach ($data as $key => $value) {