123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- <?php
- namespace app\api\controller;
- use app\common\model\DiscountActivity;
- use app\common\model\DiscountGoods;
- use app\common\model\GiftCate;
- use app\common\model\GoodsOrder;
- use app\common\model\GoodsOrderItem;
- use app\common\model\GoodsSellInfo;
- use app\common\model\GroupActivity;
- use app\common\model\GroupLeader;
- use app\common\model\SeckillActivity;
- use app\common\model\SeckillGoods;
- use app\common\model\SeckillGoodsItem;
- use app\common\model\GroupGoods;
- use app\common\model\GroupGoodsItem;
- use app\common\model\GiftGoods;
- /**
- * @title 商城活动&&商品(秒杀&&拼团&&心选商品)
- * @controller MallActivity
- * @package app\api\controller
- */
- class MallActivity extends Base
- {
- public function initialize(){
- parent::initialize();
- parent::setUid();
- }
- /**
- * @title 获取秒杀活动列表
- * @desc 获取秒杀活动列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getSeckillActivityList
- * @header name:Authorization require:1 desc:Token
- * @param name:num type:int default:3 desc:查询条数
- * @return name:title type:string default:-- desc:标题
- * @return name:cover type:string default:-- desc:图片
- * @return name:create_at type:string default:-- desc:开始时间
- * @return name:end_time type:string default:-- desc:结束时间
- * @return name:start_point type:string default:-- desc:开始时间点
- * @return name:end_point type:string default:-- desc:结束时间点
- */
- public function getSeckillActivityList()
- {
- $num = input('num,3');
- $list = SeckillActivity::where([['status','=',1],['end_time','> time',date('Y-m-d H:i:s')],['is_deleted','=',0]])
- ->order('sort desc,id asc')->limit(0,$num)->select()->toArray();
- foreach ($list as &$v){
- $v['start_point'] = date('H:i',strtotime($v['start_time']));
- $v['end_point'] = date('H:i',strtotime($v['end_time']));
- }
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 获取秒杀活动商品列表
- * @desc 获取秒杀活动商品列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getSeckillGoodsList
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:page type:int require:1 default:-- desc:第几页
- * @param name:page_num type:int require:1 default:20 desc:每页数
- * @return name:id type:int default:-- desc:活动商品记录id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:seckill_low type:string default:-- desc:抢购最低价
- * @return name:seckill_num type:int default:-- desc:秒杀订单数量
- */
- public function getSeckillGoodsList()
- {
- $act_id = input('act_id');
- $goods_list = SeckillGoods::field('s.*,g.name,g.cover,g.low_price')->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where(['s.act_id'=>$act_id])
- ->order('s.sort desc , s.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($goods_list,function (&$v,$k)use($act_id){
- $v['seckill_low'] = SeckillGoodsItem::where(['act_id'=>$v['act_id'],'goods_id'=>$v['goods_id']])->min('seckill_price');
- $v['seckill_num'] = GoodsSellInfo::where(['goods_id'=>$v['id'],'act_type'=>2,'act_id'=>$act_id])->count();
- });
- $this->success('ok',['list'=>$goods_list]);
- }
- /**
- * @title 获取秒杀活动商品详情
- * @desc 获取秒杀活动商品详情
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getSeckillGoodsDetail
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:goods_id type:int require:1 default:-- desc:活动id
- * @return name:id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面图
- * @return name:desc type:string default:-- desc:商品简述
- * @return name:goods_price type:float default:-- desc:价格
- * @return name:detail type:int default:-- desc:商品详情
- * @return name:stock type:float default:-- desc:剩余库存
- * @return name:base_stock type:float default:-- desc:初始库存
- * @return name:freight_type type:int default:-- desc:运费类型0固定金额,1运费模板
- * @return name:freight_id type:int default:-- desc:模板id(freight_type=1)
- * @return name:postage type:float default:-- desc:运费(freight_type=0)
- * @return name:goods_param type:array default:-- desc:商品相关参数
- * @return name:goods_param.title type:string default:-- desc:参数名
- * @return name:goods_param.value type:string default:-- desc:参数值
- * @return name:seckill_item type:array default:-- desc:秒杀规格设置
- * @return name:seckill_item.goods_spec type:string default:-- desc:规格
- * @return name:seckill_item.original_price type:float default:-- desc:原价
- * @return name:seckill_item.sell_price type:float default:-- desc:售价
- * @return name:seckill_item.seckill_price type:float default:-- desc:秒杀价
- * @return name:seckill_item.stock type:float default:-- desc:改规格剩余库存
- */
- public function getSeckillGoodsDetail()
- {
- $act_id = input('act_id');
- $goods_id = input('goods_id');
- $goods_info = SeckillGoods::where(['s.goods_id'=>$goods_id,'s.act_id'=>$act_id])
- ->field('g.*,s.id s_id,s.act_id,s.act_id,p.goods_param')
- ->alias('s')
- ->leftJoin('StoreGoods g','s.goods_id = g.id')
- ->leftJoin('GoodsParam p','s.goods_id = p.goods_id')
- ->find()->toArray();
- $goods_info['seckill_item'] = SeckillGoodsItem::field('s.id,s.original_price,s.sell_price,s.seckill_price,i.stock,i.goods_spec')->alias('s')
- ->leftJoin('StoreGoodsItem i','i.id = s.spec_id')
- ->where(['s.act_id'=>$act_id,'s.goods_id'=>$goods_id])
- ->select()->toArray();// 秒杀设置
- $this->success('ok',['detail'=>$goods_info]);
- }
- /**
- * @title 获取拼团活动列表
- * @desc 获取拼团活动列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGroupActivityList
- * @header name:Authorization require:1 desc:Token
- * @param name:num type:int default:3 desc:查询条数
- * @return name:title type:string default:-- desc:标题
- * @return name:cover type:string default:-- desc:图片
- * @return name:full_num type:int default:-- desc:成团人数
- * @return name:create_at type:string default:-- desc:开始时间
- * @return name:end_time type:string default:-- desc:结束时间
- * @return name:start_point type:string default:-- desc:开始时间点
- * @return name:end_point type:string default:-- desc:结束时间点
- */
- public function getGroupActivityList()
- {
- $num = input('num,3');
- $list = GroupActivity::where([['status','=',1],['end_time','> time',date('Y-m-d H:i:s')],['is_deleted','=',0]])
- ->order('sort desc,id asc')->limit(0,$num)->select()->toArray();
- foreach ($list as &$v){
- $v['start_point'] = date('H:i',strtotime($v['start_time']));
- $v['end_point'] = date('H:i',strtotime($v['end_time']));
- }
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 获取拼团活动商品列表
- * @desc 获取拼团活动商品列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGroupGoodsList
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:page type:int require:1 default:-- desc:第几页
- * @param name:page_num type:int require:1 default:20 desc:每页数
- * @return name:id type:int default:-- desc:活动商品记录id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:group_low type:string default:-- desc:拼团最低价
- * @return name:success_num type:int default:-- desc:拼团成功团数量
- * @return name:present_num type:int default:-- desc:进行中的团数量
- */
- public function getGroupGoodsList()
- {
- $act_id = input('act_id');
- $goods_list = GroupGoods::field('s.*,g.name,g.cover,g.low_price')->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where(['s.act_id'=>$act_id])
- ->order('s.sort desc , s.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($goods_list,function (&$v,$k)use($act_id){
- $v['group_low'] = GroupGoodsItem::where(['act_id'=>$v['act_id'],'goods_id'=>$v['goods_id']])->min('group_price');
- $v['success_num'] = GroupLeader::where(['act_id'=>$act_id,'goods_id'=>$v['goods_id'],'status'=>1])->count();
- $v['present_num'] = GroupLeader::where(['act_id'=>$act_id,'goods_id'=>$v['goods_id'],'status'=>0])->count();
- });
- $this->success('ok',['list'=>$goods_list]);
- }
- /**
- * @title 获取拼团活动商品详情
- * @desc 获取拼团活动商品详情
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGroupGoodsDetail
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:goods_id type:int require:1 default:-- desc:活动id
- * @return name:id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面图
- * @return name:desc type:string default:-- desc:商品简述
- * @return name:goods_price type:float default:-- desc:价格
- * @return name:detail type:int default:-- desc:商品详情
- * @return name:stock type:float default:-- desc:剩余库存
- * @return name:base_stock type:float default:-- desc:初始库存
- * @return name:freight_type type:int default:-- desc:运费类型0固定金额,1运费模板
- * @return name:freight_id type:int default:-- desc:模板id(freight_type=1)
- * @return name:postage type:float default:-- desc:运费(freight_type=0)
- * @return name:goods_param type:array default:-- desc:商品相关参数
- * @return name:goods_param.title type:string default:-- desc:参数名
- * @return name:goods_param.value type:string default:-- desc:参数值
- * @return name:group_item type:array default:-- desc:秒杀规格设置
- * @return name:group_item.goods_spec type:string default:-- desc:规格
- * @return name:group_item.original_price type:float default:-- desc:原价
- * @return name:group_item.sell_price type:float default:-- desc:售价
- * @return name:group_item.group_price type:float default:-- desc:秒杀价
- * @return name:group_item.stock type:float default:-- desc:改规格剩余库存
- */
- public function getGroupGoodsDetail()
- {
- $act_id = input('act_id');
- $goods_id = input('goods_id');
- $goods_info = GroupGoods::where(['s.goods_id'=>$goods_id,'s.act_id'=>$act_id])
- ->field('g.*,s.id s_id,s.act_id,s.act_id,p.goods_param')
- ->alias('s')
- ->leftJoin('StoreGoods g','s.goods_id = g.id')
- ->leftJoin('GoodsParam p','s.goods_id = p.goods_id')
- ->find()->toArray();
- $goods_info['group_item'] = GroupGoodsItem::field('s.id,s.original_price,s.sell_price,s.group_price,i.stock, i.goods_spec')->alias('s')
- ->leftJoin('StoreGoodsItem i','i.id = s.spec_id')
- ->where(['s.act_id'=>$act_id,'s.goods_id'=>$goods_id])
- ->select()->toArray();// 秒杀设置
- $this->success('ok',['detail'=>$goods_info]);
- }
- /**
- * @title 获取正在拼团列表
- * @desc 获取正在拼团列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGroupLeaderList
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:goods_id type:int require:1 default:-- desc:活动id
- * @return name:name type:string default:-- desc:名称
- * @return name:headimg type:string default:-- desc:头像
- * @return name:num type:int default:-- desc:数量
- */
- public function getGroupLeaderList()
- {
- $act_id = input('get.act_id');
- $goods_id = input('get.goods_id');
- $list = GroupLeader::field('l.id,l.goods_id,l.spec_id,l.create_at,u.name,u.headimg')
- ->alias('l')
- ->where(['l.act_id'=>$act_id,'l.goods_id'=>$goods_id,'l.status'=>0])
- ->leftJoin('StoreMember u','u.id = l.user_id')
- ->order('l.id asc')
- ->select()->toArray();
- $this->success('ok',['list'=>$list,'num'=>count($list)]);
- }
- /**
- * @title 获取折扣活动列表
- * @desc 获取折扣活动列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getDiscountActivityList
- * @header name:Authorization require:1 desc:Token
- * @param name:num type:int default:3 desc:查询条数
- * @return name:title type:string default:-- desc:标题
- * @return name:cover type:string default:-- desc:图片
- * @return name:create_at type:string default:-- desc:开始时间
- * @return name:end_time type:string default:-- desc:结束时间
- * @return name:start_point type:string default:-- desc:开始时间点
- * @return name:end_point type:string default:-- desc:结束时间点
- */
- public function getDiscountActivityList()
- {
- $num = input('num,3');
- $list = DiscountActivity::where([['status','=',1],['end_time','> time',date('Y-m-d H:i:s')],['is_deleted','=',0]])
- ->order('sort desc,id asc')->limit(0,$num)->select()->toArray();
- foreach ($list as &$v){
- $v['start_point'] = date('H:i',strtotime($v['start_time']));
- $v['end_point'] = date('H:i',strtotime($v['end_time']));
- }
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 获取折扣活动商品列表
- * @desc 获取折扣活动商品列表
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getDiscountGoodsList
- * @header name:Authorization require:1 desc:Token
- * @param name:act_id type:int require:1 default:-- desc:活动id
- * @param name:page type:int require:1 default:-- desc:第几页
- * @param name:page_num type:int require:1 default:20 desc:每页数
- * @return name:id type:int default:-- desc:活动商品记录id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:float default:-- desc:最低价(正常售价)
- * @return name:discount_price type:float default:-- desc:最低价(折扣价)
- * @return name:discount type:float default:-- desc:折扣
- * @return name:line_price type:float default:-- desc:下划线价格
- * @return name:discount_act type:int default:-- desc:折扣活动详情
- * @return name:discount_act.id type:int default:-- desc:活动id
- */
- public function getDiscountGoodsList()
- {
- $act_id = input('act_id');
- $discount_act = DiscountActivity::where('id',$act_id)->find()->toArray();
- $price_discount = bcdiv($discount_act['discount'],100,2);
- $goods_list = DiscountGoods::field('s.*,g.name,g.cover,g.low_price')
- ->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where(['s.act_id'=>$act_id])
- ->order('s.sort desc , s.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($goods_list,function (&$v,$k)use($act_id,$price_discount){
- $v['discount_price'] = bcmul($v['low_price'],$price_discount,2);
- $v['line_price'] = GoodsOrderItem::where(['goods_id'=>$v['id']])->max('sell_price');
- $v['discount'] = $price_discount*10;
- });
- $this->success('ok',['list'=>$goods_list,'discount'=>$price_discount,'discount_act'=>$discount_act]);
- }
- /**
- * @title 获取心选礼物分类
- * @desc 获取心选礼物分类
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGiftCate
- * @header name:Authorization require:1 desc:Token
- * @return name:title type:string default:-- desc:标题
- * @return name:logo type:string default:-- desc:封面
- */
- public function getGiftCate()
- {
- $gift_cate = GiftCate::field('id,title,logo')->where(['is_deleted'=>0])->select()->toArray();
- $this->success('ok',['list'=>$gift_cate]);
- }
- /**
- * @title 获取推荐心选商品
- * @desc 获取推荐心选商品
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGiftHotGoods
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int require:1 default:-- desc:第几页
- * @param name:page_num type:int require:1 default:20 desc:每页数
- * @return name:is_custom type:int default:-- desc:是否允许定制(0否1是)
- * @return name:custom_cover type:string default:-- desc:定制风格(多图|隔开)
- * @return name:custom_color type:string default:-- desc:定制色系图(多图|隔开)
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:line_price type:string default:-- desc:下划线价格
- */
- public function getGiftHotGoods()
- {
- $goods_list = GiftGoods::field('s.*,g.name,g.cover,g.low_price')
- ->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where(['s.status'=>1,'s.is_hot'=>1,'s.is_deleted'=>0,'g.is_deleted'=>0,'g.status'=>1])
- ->order('s.sort desc , s.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($goods_list,function (&$v,$k){
- $v['line_price'] = GoodsOrderItem::where('goods_id',$v['goods_id'])->max('original_price');
- });
- $this->success('ok',['list'=>$goods_list]);
- }
- /**
- * @title 根据分类获取心选商品
- * @desc 根据分类获取心选商品
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGiftGoodsByCate
- * @header name:Authorization require:1 desc:Token
- * @param name:page type:int require:1 default:-- desc:第几页
- * @param name:page_num type:int require:1 default:20 desc:每页数
- * @param name:cate_id type:int require:1 desc:心选礼物分类id
- * @return name:is_custom type:int default:-- desc:是否允许定制(0否1是)
- * @return name:custom_cover type:string default:-- desc:定制风格(多图|隔开)
- * @return name:custom_color type:string default:-- desc:定制色系图(多图|隔开)
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:line_price type:string default:-- desc:下划线价格
- */
- public function getGiftGoodsByCate()
- {
- $goods_list = GiftGoods::field('s.*,g.name,g.cover,g.low_price')
- ->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where(['s.status'=>1,'s.is_deleted'=>0,'g.is_deleted'=>0,'g.status'=>1,'s.cate_id'=>input('get.cate_id')])
- ->order('s.sort desc , s.id desc')
- ->limit($this->off_set,$this->page_num)
- ->select()->toArray();
- array_walk($goods_list,function (&$v,$k){
- $v['line_price'] = GoodsOrderItem::where('goods_id',$v['goods_id'])->max('original_price');
- });
- $this->success('ok',['list'=>$goods_list]);
- }
- /**
- * @title 获取定制商品
- * @desc 获取定制商品
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getCustomGoodsList
- * @header name:Authorization require:1 desc:Token
- * @return name:is_custom type:int default:-- desc:是否允许定制(0否1是)
- * @return name:custom_cover type:string default:-- desc:定制风格(多图|隔开)
- * @return name:custom_color type:string default:-- desc:定制色系图(多图|隔开)
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:item_list type:array default:-- desc:商品多规格列表
- * @return name:item_list.spec_info type:array default:-- desc:规格型号设置;
- * @return name:item_list.goods_no type:string default:-- desc:规格货号
- * @return name:item_list.goods_title type:string default:-- desc:规格标题
- * @return name:item_list.cover type:string default:-- desc:规格封面
- * @return name:item_list.stock type:int default:-- desc:剩余库存
- * @return name:item_list.original_price type:float default:-- desc:原价
- * @return name:item_list.sell_price type:float default:-- desc:售价
- */
- public function getCustomGoodsList()
- {
- $where = [];
- $where[] = ['s.status','=',1];
- $where[] = ['s.is_deleted','=',0];
- $where[] = ['g.is_deleted','=',0];
- $where[] = ['g.status','=',1];
- $where[] = ['s.is_custom','=',1];
- $list = GiftGoods::field('s.*,g.name,g.cover,g.low_price')
- ->with('itemList')
- ->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where($where)
- ->select()->toArray();
- $this->success('ok',['list'=>$list]);
- }
- /**
- * @title 心选商品设置
- * @desc 心选商品设置
- * @author qc
- * @method GET
- * @url /api/Mall_activity/getGiftGoodsDetail
- * @header name:Authorization require:1 desc:Token
- * @param name:id type:int require:1 desc:心选商品记录id(两个不能同时为空)
- * @param name:goods_id type:int require:1 desc:商品id(两个不能同时为空)
- * @return name:is_custom type:int default:-- desc:是否允许定制(0否1是)
- * @return name:custom_cover type:string default:-- desc:定制风格(多图|隔开)
- * @return name:custom_color type:string default:-- desc:定制色系图(多图|隔开)
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:goods_id type:int default:-- desc:商品id
- * @return name:name type:string default:-- desc:商品名称
- * @return name:cover type:string default:-- desc:商品封面
- * @return name:low_price type:string default:-- desc:最低价(正常售价)
- * @return name:item_list type:array default:-- desc:商品多规格列表
- * @return name:item_list.spec_info type:array default:-- desc:规格型号设置;
- * @return name:item_list.goods_no type:string default:-- desc:规格货号
- * @return name:item_list.goods_title type:string default:-- desc:规格标题
- * @return name:item_list.cover type:string default:-- desc:规格封面
- * @return name:item_list.stock type:int default:-- desc:剩余库存
- * @return name:item_list.original_price type:float default:-- desc:原价
- * @return name:item_list.sell_price type:float default:-- desc:售价
- */
- public function getGiftGoodsDetail()
- {
- $where = [];
- $where[] = ['s.status','=',1];
- $where[] = ['s.is_deleted','=',0];
- $where[] = ['g.is_deleted','=',0];
- $where[] = ['g.status','=',1];
- if(input('get.id')) $where[] = ['s.id','=',input('get.id')];
- if(input('get.goods_id')) $where[] = ['s.goods_id','=',input('get.goods_id')];
- $detail = GiftGoods::field('s.*,g.name,g.cover,g.low_price')
- ->with('itemList')
- ->alias('s')->leftJoin('StoreGoods g','g.id = s.goods_id')
- ->where($where)
- ->find();
- if(!$detail) $this->error('商品已下架');
- $this->success('ok',['detail'=>$detail->toArray()]);
- }
- }
|