1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\api\controller\h5;
- use app\hander\HelpHander;
- use think\Db;
- class GGoods extends Base
- {
- //普通商品列表
- public function goodsList(){
- $cateId=input('cate_id/d',0);
- $title=input('title','','trim');
- $page = input('page/d',1);
- $size = input('size/d',20);
- $ret = model('GGoods')->lists($cateId,$title,$page,$size,$this->orgId);
- HelpHander::success($ret);
- }
- //商品详情
- public function goodsDetails(){
- $id=input('id/d',0);
- $ret = model('GGoods')->details($id);
- HelpHander::success($ret);
- }
- //首页特价商品列表
- public function saleGoodsList(){
- $ret = model('GGoods')->saleList($this->orgId);
- HelpHander::success($ret);
- }
- public function cartGoods(){
- $id = input('id');
- $ids = explode(',',$id);
- $goods = [];
- $list = Db::name('g_cart')
- ->where('id','in',$ids)
- ->select();
- foreach ($list as $k=>$v){
- $s = model('GGoods')->details($v['goods_id']);
- $s['nums'] = $v['nums'];
- $goods[] = $s;
- }
- HelpHander::success($goods);
- }
- }
|