|
- <?php
- /**
- * Created by PhpStorm.
- * User: Steven
- * Date: 2016/8/25
- * Time: 16:18
- * 根据线路ID获取线路信息 (线路暂时固定)
- */
- require_once __DIR__.'/common.php';
- class lineInfo extends virtifyUsers
- {
- public function getLineInfo($prodId)
- {
- $pdo = conn();
- $sql = "SELECT prod_id,prod_name FROM opera_product WHERE prod_id='{$prodId}' AND prod_type = 81 AND is_onsale = 1 AND cancel_flag = 0";
- if (is_object($pdo)) {
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
- $result->closeCursor();
- foreach ($rowset as $v) {
- $prod_id = $v['prod_id'];
- $prod_name = $v['prod_name'];
- }
- $area = explode('-', $prod_name);
- $arr = array('prod_id' => $prod_id, 'startArea' => $area[0], 'endArea' => $area[1]);
- return json_encode($arr);
- }
- }
- }
- $prodId = "153052";
- $lineInfo=new lineInfo();
- $lineInfo->getLineInfo($prodId);
|