更新
This commit is contained in:
@@ -19,7 +19,7 @@ class Gift extends Model
|
||||
//获取礼物类型
|
||||
public function get_gift_label()
|
||||
{
|
||||
$giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->order("sort asc,id desc")->select();
|
||||
$giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->where('tid',1)->order("sort asc,id desc")->select();
|
||||
foreach ($giftTypeData as $key => $value) {
|
||||
$giftType[$key]['id'] = $value['id'];
|
||||
$giftType[$key]['name'] = $value['name'];
|
||||
@@ -28,7 +28,7 @@ class Gift extends Model
|
||||
}
|
||||
|
||||
//拉去礼物列表
|
||||
public function get_gift_list($label=0)
|
||||
public function get_gift_list($label=0,$room_id=0)
|
||||
{
|
||||
$map['delete_time'] = 0;
|
||||
$where['is_show'] = 1;
|
||||
@@ -39,30 +39,42 @@ class Gift extends Model
|
||||
$gift_price = get_system_config_value('room_love_auction_cion');
|
||||
$where['gift_price'] = ['>',$gift_price];
|
||||
}
|
||||
$is_open_blind_box_turntable = 0;
|
||||
if($room_id){
|
||||
$is_open_blind_box_turntable = Db::name('vs_room')->where(['id'=>$room_id])->value('is_open_blind_box_turntable');
|
||||
}
|
||||
$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){
|
||||
$list_data = [];
|
||||
foreach ($list as &$v) {
|
||||
//获取盲盒列表
|
||||
$box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where('activities_id',4)->select();
|
||||
$box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where(['activities_id'=>["in",[4,5]]])->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"];
|
||||
$v['activities_id'] = $box['activities_id'];
|
||||
$v['gift_bag'] = $box['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($list as $gift) {
|
||||
if($is_open_blind_box_turntable == 1){
|
||||
$list_data[] = $gift;
|
||||
}else{
|
||||
if(isset($gift['activities_id']) && $gift['activities_id'] == 4){
|
||||
$list_data[] = $gift;
|
||||
}
|
||||
}
|
||||
}
|
||||
usort($list_data, function($a, $b) {
|
||||
return $a['gift_id'] <=> $b['gift_id'];
|
||||
});
|
||||
$list = $list_data;
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
|
||||
/*
|
||||
* 盲盒规则链接
|
||||
*/
|
||||
public function get_gift_box_rule($box_id){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user