/new88li/api/gentuan.php
PHP | 63 lines | 55 code | 5 blank | 3 comment | 6 complexity | cbe6392b7eb6e4c6d437e52a2eafcfaa MD5 | raw file
- <?php
- header('Content-Type: application/xml; charset=UTF-8');
- include(dirname(dirname(__FILE__)).'/plugins/loader.php');
- include(dirname(dirname(__FILE__)).'/plugins/functions/output.php');
- $daytime = strtotime(date('Y-m-d'));
- //echo $token=$system->getConf('system.shopname');exit;
-
- /* teams */
- $objTuan = $system->loadModel('goods/tuan');
- $teams = $objTuan->getTuanList(10);
- //var_dump($teams);exit;
- $oa = array();
- $shopinfo = array(
- 'shopname' => $system->getConf('system.shopname'),
- 'shopurl' => $system->getConf('store.shop_url'),
- 'telephone' => $system->getConf('store.quhao').'-'.$system->getConf('store.telephone'),
- 'address' => $system->getConf('store.address'),
- );
-
- foreach($teams AS $team) {
- $item = array();
- $item['loc'] = $system->mkUrl('deal','index',array($team['team_id']));
- $item['data'] = array();
- $item['data']['display'] = array();
-
- $team['begin_time'] = strtotime(date('Y-m-d',$team['begin_time']));
- if($team['begin_time'] > $daytime) continue;
- $team['end_time'] = strtotime(date('Y-m-d',$team['end_time']));
- if(($team['end_time'] == $team['begin_time'])){ //??????
- $team['end_time'] += 86400;
- }
-
- $o = array();
- $o['website'] = $shopinfo['shopname'];
- $o['siteurl'] = $shopinfo['shopurl'];
- $o['city'] = '??';
- $o['title'] = $team['title'];
- if(strstr($team['image'],'http://')){
- $o['image'] = $team['image'];
- }else{
- $image = explode('|',$team['image']);
- $o['image'] = $shopinfo['shopurl'].$image[0];
- }
- $o['startTime'] = $team['begin_time'];
- $o['endTime'] = $team['end_time'];
- $o['value'] = $team['market_price'];
- $o['price'] = $team['team_price'];
- if ( $team['market_price'] > 0 ) {
- $o['rebate'] = round(10*$team['team_price']/$team['market_price'],2);
- } else {
- $o['rebate'] = '0';
- }
- $o['type'] = '??';
- $o['description'] = $team['title'];
- $o['bought'] = $team['real_number'] + $team['pre_number'];
- $o['merchantEndTime'] = $team['end_time'];
- $o['detail'] = $team['intro'];
-
- $item['data']['display'] = $o;
- $oa[] = $item;
- }
- Output::XmlBaidu($oa);
- ?>