<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Tracking\Api\Controller; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Session; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Util\EncodeUtil; use ModStart\Core\Util\RandomUtil; use Module\Tracking\Type\CodeVerifyCodeStatus; class TrackingController extends Controller { public function getSessionKey() { goto OrNLb; OrNLb: $VKrDJ = Session::get('Tracking_QueryKey'); goto IxEBv; UL8cs: return $VKrDJ; goto TNMcn; IxEBv: if (empty($VKrDJ)) { $VKrDJ = RandomUtil::string(32); Session::put('Tracking_QueryKey', $VKrDJ); } goto UL8cs; TNMcn: } public function index() { goto bwi1r; y0ga1: $wCJen = array(); goto dI4zC; spP2Z: $Do_6A = $OPo_x->getPageSize(); goto y0ga1; l5V99: if ($GfdAM) { $wCJen['where']['categoryId'] = $GfdAM; } goto J1etZ; J1etZ: $GVu1o = ModelUtil::paginate('tracking', $DNh5u, $Do_6A, $wCJen); goto BJ1sA; dI4zC: $wCJen['where'] = array(); goto M7GGx; xVNMA: $GfdAM = $OPo_x->getInteger('categoryId'); goto l5V99; bwi1r: $OPo_x = InputPackage::buildFromInput(); goto NQMZw; NQMZw: $DNh5u = $OPo_x->getPage(); goto spP2Z; M7GGx: $wCJen['order'] = array('id', 'desc'); goto xVNMA; BJ1sA: return Response::generateSuccessData(array('page' => $DNh5u, 'pageSize' => $Do_6A, 'total' => $GVu1o['total'], 'records' => $GVu1o['records'])); goto VKMKp; VKMKp: } public function get() { goto Fdcm4; ZYwdO: $D4D3g = $OPo_x->getInteger('id'); goto IxETd; IxETd: $gH1Sv = ModelUtil::get('tracking', $D4D3g); goto gXN9x; Fdcm4: $OPo_x = InputPackage::buildFromInput(); goto ZYwdO; gXN9x: return Response::generateSuccessData($gH1Sv); goto XP2zh; XP2zh: } public function verify() { goto gaMEc; Ri68y: $KjXDx = $OPo_x->getTrimString('codeSecret'); goto rNrBT; Uho4B: return Response::generate(0, '验证成功', null, '[reload]'); goto EJDic; hhIM5: BizException::throwsIfEmpty('数据不存在', $gH1Sv); goto PRrxW; rNrBT: $MipNh = EncodeUtil::expiredDataDecode($KjXDx, $this->getSessionKey()); goto WLIZ6; WLIZ6: BizException::throwsIfEmpty('数据不存在', $MipNh); goto dJini; PRrxW: if ($A5RWe != $gH1Sv['verifyCode']) { return Response::generateError('验证码错误'); } goto NZW8h; gaMEc: $OPo_x = InputPackage::buildFromInput(); goto v5FN9; v5FN9: $A5RWe = $OPo_x->getTrimString('verifyCode'); goto nwR0S; nwR0S: BizException::throwsIfEmpty('请输入验证码', $A5RWe); goto Ri68y; NZW8h: ModelUtil::update('tracking_code', array('id' => $gH1Sv['id']), array('verifyStatus' => CodeVerifyCodeStatus::VERIFY_SUCCESS, 'verifyTime' => date('Y-m-d H:i:s'))); goto Uho4B; dJini: $gH1Sv = ModelUtil::get('tracking_code', array('code' => $MipNh)); goto hhIM5; EJDic: } }