Browse Source

中奖结果接口返回

master
wanghongjun 3 years ago
parent
commit
702edce0b1
  1. 23
      app/controller/Zone.php
  2. 2
      app/logic/Zone.php

23
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]);
}
}

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

Loading…
Cancel
Save