巡乐会抽奖接口提交.-代码优化
This commit is contained in:
@@ -240,10 +240,19 @@ class BlindBox extends adminApi
|
|||||||
*/
|
*/
|
||||||
public function reset_set(){
|
public function reset_set(){
|
||||||
$gift_bag_id = input('gift_bag_id', 0);
|
$gift_bag_id = input('gift_bag_id', 0);
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
if(empty($gift_bag_id)){
|
if(empty($gift_bag_id)){
|
||||||
return V(0,"请选择盲盒类型");
|
return V(0,"请选择盲盒类型");
|
||||||
}
|
}
|
||||||
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
|
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
|
||||||
|
if(in_array($gift_bag_id,[10,11,12,13])){
|
||||||
|
if(empty($room_id)){
|
||||||
|
return V(0,"请选择房间");
|
||||||
|
}
|
||||||
|
foreach ($gift_bag_detail as $k=>$v){
|
||||||
|
$bag_data = db::name('vs_room_pan')->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($gift_bag_detail as $k=>$v){
|
foreach ($gift_bag_detail as $k=>$v){
|
||||||
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user