SpikeModel.class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. * ==========================================================================
  6. * @link https://www.nanodreamtech.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.nanodreamtech.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Admin\Model;
  15. use Think\Model;
  16. class SpikeModel extends Model{
  17. public function show_spike_page( $where = '' ){
  18. $sql='SELECT * FROM '.C('DB_PREFIX').'spike ';
  19. if(!empty($where))
  20. {
  21. $sql .= $where;
  22. }
  23. $count=count(M()->query($sql));
  24. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  25. $show = $Page->show();// 分页显示输出
  26. $sql.=' order by add_time desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  27. $list=M()->query($sql);
  28. return array(
  29. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  30. 'list'=>$list,
  31. 'page'=>$show
  32. );
  33. }
  34. public function show_spikegoods_page( $super_id =0){
  35. //goods_id
  36. $sql='SELECT g.name,g.image,g.quantity,g.type,g.lock_type,g.danprice,g.pinprice,g.seller_count,g.store_id,sg.id,sg.goods_id, sg.state,sg.addtime FROM '.C('DB_PREFIX').'spike_goods as sg,
  37. '.C('DB_PREFIX').'goods as g where sg.goods_id = g.goods_id and sg.spike_id = '.$super_id;
  38. $count=count(M()->query($sql));
  39. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  40. $show = $Page->show();// 分页显示输出
  41. $sql.=' order by sg.addtime desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  42. $list=M()->query($sql);
  43. foreach ($list as $key => $value) {
  44. $list[$key]['image']=resize($value['image'], 100, 100);
  45. }
  46. return array(
  47. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  48. 'list'=>$list,
  49. 'page'=>$show
  50. );
  51. }
  52. }
  53. ?>