<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Tracking\Web\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Core\Util\AgentUtil; use ModStart\Core\Util\EncodeUtil; use ModStart\Module\ModuleBaseController; use Module\Tracking\Api\Controller\TrackingController; use Module\Tracking\Util\CodeUtil; use Module\Tracking\Util\TrackingCodeProcessUtil; class IndexController extends ModuleBaseController { private $api; public function __construct(TrackingController $EKog2) { $this->api = $EKog2; } public function index() { return $this->view('tracking.index'); } public function submit() { goto bgGLU; JmnUb: $JPXsz = modstart_web_url('tracking/show/' . $YP7B1); goto pu_f9; uPFdm: $MipNh = $OPo_x->getTrimString('code'); goto OmptY; pu_f9: return Response::redirect($JPXsz); goto KqdqC; OmptY: BizException::throwsIfEmpty('请输入防伪码', $MipNh); goto XTuxI; bgGLU: $OPo_x = InputPackage::buildFromInput(); goto uPFdm; XTuxI: $YP7B1 = EncodeUtil::expiredData($MipNh, $this->api->getSessionKey()); goto JmnUb; KqdqC: } public function show($YP7B1) { goto Y5skI; ks4xD: $KjXDx = null; goto kixOt; kixOt: if ($gH1Sv) { goto phRUZ; YkpUW: if (empty($gH1Sv['firstQueryTime'])) { $umZPe['firstQueryTime'] = date('Y-m-d H:i:s'); $gH1Sv['firstQueryTime'] = $umZPe['firstQueryTime']; } goto m744K; xL0G1: $gH1Sv['_processes'] = TrackingCodeProcessUtil::all(); goto j_ivR; m744K: ModelUtil::update('tracking_code', $gH1Sv['id'], $umZPe); goto LCWVC; j_ivR: $umZPe = array('hits' => $gH1Sv['hits']); goto T98Qq; T98Qq: ModelUtil::insert('tracking_code_query', array('codeId' => $gH1Sv['id'], 'ua' => AgentUtil::getUserAgent(), 'ip' => Request::ip())); goto YkpUW; aEm7s: $gH1Sv['hits'] = intval($gH1Sv['hits']) + 1; goto HPm9b; phRUZ: $KjXDx = EncodeUtil::expiredData($gH1Sv['code'], $this->api->getSessionKey()); goto aEm7s; WCx73: $gH1Sv['_agent'] = ModelUtil::get('tracking_agent', intval($gH1Sv['agentId'])); goto hqLvo; hqLvo: $gH1Sv['_processItems'] = ModelUtil::all('tracking_code_process_item', array('codeId' => $gH1Sv['id']), array('*'), array('operateTime', 'asc')); goto xL0G1; HPm9b: $gH1Sv['_product'] = ModelUtil::get('tracking_product', intval($gH1Sv['productId'])); goto AXsSY; ZmXLt: if (!empty($gH1Sv['_product'])) { goto A__rw; EEqTA: foreach ($gH1Sv['_product']['_sections'] as $QBy8K => $cG5OI) { $gH1Sv['_product']['_sections'][$QBy8K]['content'] = CodeUtil::replaceCodeParam($cG5OI['content'], $gH1Sv); } goto Vif3E; GRH3d: $gH1Sv['_product']['_sections'] = ModelUtil::all('tracking_product_section', array('productId' => $gH1Sv['_product']['id']), array('*'), array('sort', 'asc')); goto EEqTA; AXPf2: $gH1Sv['_product']['_images'] = array_filter($kE4Cx); goto GRH3d; A__rw: $kE4Cx = array_merge(array($gH1Sv['_product']['cover']), $gH1Sv['_product']['images']); goto AXPf2; Vif3E: } goto WCx73; AXsSY: ModelUtil::decodeRecordJson($gH1Sv['_product'], array('images')); goto ZmXLt; LCWVC: } goto N8kCU; WRWwr: $gH1Sv = ModelUtil::get('tracking_code', array('code' => $MipNh, 'enable' => true)); goto ks4xD; lhFKX: BizException::throwsIfEmpty('数据不存在', $MipNh); goto WRWwr; N8kCU: return $this->view('tracking.show', array('code' => $MipNh, 'codeSecret' => $KjXDx, 'record' => $gH1Sv)); goto eM0Ml; Y5skI: if (starts_with($YP7B1, 'code_')) { $MipNh = substr($YP7B1, strlen('code_')); } else { $MipNh = EncodeUtil::expiredDataDecode($YP7B1, $this->api->getSessionKey()); } goto lhFKX; eM0Ml: } }