PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/new88li/api/gentuan.php

http://phpfor.googlecode.com/
PHP | 63 lines | 55 code | 5 blank | 3 comment | 6 complexity | cbe6392b7eb6e4c6d437e52a2eafcfaa MD5 | raw file
  1. <?php
  2. header('Content-Type: application/xml; charset=UTF-8');
  3. include(dirname(dirname(__FILE__)).'/plugins/loader.php');
  4. include(dirname(dirname(__FILE__)).'/plugins/functions/output.php');
  5. $daytime = strtotime(date('Y-m-d'));
  6. //echo $token=$system->getConf('system.shopname');exit;
  7. /* teams */
  8. $objTuan = $system->loadModel('goods/tuan');
  9. $teams = $objTuan->getTuanList(10);
  10. //var_dump($teams);exit;
  11. $oa = array();
  12. $shopinfo = array(
  13. 'shopname' => $system->getConf('system.shopname'),
  14. 'shopurl' => $system->getConf('store.shop_url'),
  15. 'telephone' => $system->getConf('store.quhao').'-'.$system->getConf('store.telephone'),
  16. 'address' => $system->getConf('store.address'),
  17. );
  18. foreach($teams AS $team) {
  19. $item = array();
  20. $item['loc'] = $system->mkUrl('deal','index',array($team['team_id']));
  21. $item['data'] = array();
  22. $item['data']['display'] = array();
  23. $team['begin_time'] = strtotime(date('Y-m-d',$team['begin_time']));
  24. if($team['begin_time'] > $daytime) continue;
  25. $team['end_time'] = strtotime(date('Y-m-d',$team['end_time']));
  26. if(($team['end_time'] == $team['begin_time'])){ //??????
  27. $team['end_time'] += 86400;
  28. }
  29. $o = array();
  30. $o['website'] = $shopinfo['shopname'];
  31. $o['siteurl'] = $shopinfo['shopurl'];
  32. $o['city'] = '??';
  33. $o['title'] = $team['title'];
  34. if(strstr($team['image'],'http://')){
  35. $o['image'] = $team['image'];
  36. }else{
  37. $image = explode('|',$team['image']);
  38. $o['image'] = $shopinfo['shopurl'].$image[0];
  39. }
  40. $o['startTime'] = $team['begin_time'];
  41. $o['endTime'] = $team['end_time'];
  42. $o['value'] = $team['market_price'];
  43. $o['price'] = $team['team_price'];
  44. if ( $team['market_price'] > 0 ) {
  45. $o['rebate'] = round(10*$team['team_price']/$team['market_price'],2);
  46. } else {
  47. $o['rebate'] = '0';
  48. }
  49. $o['type'] = '??';
  50. $o['description'] = $team['title'];
  51. $o['bought'] = $team['real_number'] + $team['pre_number'];
  52. $o['merchantEndTime'] = $team['end_time'];
  53. $o['detail'] = $team['intro'];
  54. $item['data']['display'] = $o;
  55. $oa[] = $item;
  56. }
  57. Output::XmlBaidu($oa);
  58. ?>