'热门',2=>'趣味', 3=>'情侣', 4=>'挂件']; protected $table = 'fa_vs_gift'; //获取礼物类型 public function get_gift_label() { $giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->order("sort asc,id desc")->select(); foreach ($giftTypeData as $key => $value) { $giftType[$key]['id'] = $value['id']; $giftType[$key]['name'] = $value['name']; } return ['code' => 1, 'msg' => '获取成功', 'data' => $giftType]; } //拉去礼物列表 public function get_gift_list($label=0) { $map['delete_time'] = 0; $where['is_show'] = 1; if ($label && $label !=99) { $map['label'] = $label; } if ($label == 99) { $gift_price = get_system_config_value('room_love_auction_cion'); $where['gift_price'] = ['>',$gift_price]; } $list = $this->field('gid as gift_id,gift_name,base_image,gift_price')->where($map)->where($where)->order('sort asc, gift_price asc')->select(); if($label==2){ foreach ($list as &$v) { //获取盲盒列表 $box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where('activities_id',4)->select(); foreach ($box_list as $key =>$box) { $ext = json_decode($box['ext'],true); if ($ext['gift_id'] == $v['gift_id']) { $v['gift_bag_name'] = $box['name']; $v['rule'] = $ext['description']; $v['rule_url'] = get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$box["id"]; break; } } } } return ['code' => 1, 'msg' => '获取成功', 'data' => $list]; } /* * 盲盒规则链接 */ public function get_gift_box_rule($box_id){ } }