0
0

GGoods.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\hander\HelpHander;
  4. use think\Db;
  5. class GGoods extends Base
  6. {
  7. //普通商品列表
  8. public function goodsList(){
  9. $cateId=input('cate_id/d',0);
  10. $title=input('title','','trim');
  11. $page = input('page/d',1);
  12. $size = input('size/d',20);
  13. $ret = model('GGoods')->lists($cateId,$title,$page,$size,$this->orgId);
  14. HelpHander::success($ret);
  15. }
  16. //商品详情
  17. public function goodsDetails(){
  18. $id=input('id/d',0);
  19. $ret = model('GGoods')->details($id);
  20. HelpHander::success($ret);
  21. }
  22. //首页特价商品列表
  23. public function saleGoodsList(){
  24. $ret = model('GGoods')->saleList($this->orgId);
  25. HelpHander::success($ret);
  26. }
  27. public function cartGoods(){
  28. $id = input('id');
  29. $ids = explode(',',$id);
  30. $goods = [];
  31. $list = Db::name('g_cart')
  32. ->where('id','in',$ids)
  33. ->select();
  34. foreach ($list as $k=>$v){
  35. $s = model('GGoods')->details($v['goods_id']);
  36. $s['nums'] = $v['nums'];
  37. $goods[] = $s;
  38. }
  39. HelpHander::success($goods);
  40. }
  41. }