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) {