新需求: 盲盒转盘开发

This commit is contained in:
2025-08-16 19:10:54 +08:00
parent 36366416d3
commit a145ed5592
5 changed files with 70 additions and 9 deletions

View File

@@ -131,6 +131,7 @@ class BlindBox extends adminApi
$gift_id = input('gift_id', '');
$gift_bag_id = input('gift_bag_id', '');
$quantity = input('quantity', 0);
$weight = input('weight', 0);
if(empty($gift_id)){
return V(0,"请选择礼物");
}
@@ -153,6 +154,8 @@ class BlindBox extends adminApi
$data['quantity'] = $quantity;
$data['remaining_number'] = $quantity;
$data['createtime'] = time();
$data['weight'] = $weight;
$res = db::name($this->table)->insert($data);
if($res){
return V(1,"成功");
@@ -184,6 +187,7 @@ class BlindBox extends adminApi
if(empty($id)){
return V(0,"参数错误");
}
$weight = input('weight', 0);
$gift_bag = db::name($this->table)->where('id',$id)->find();
// if($gift_bag['remaining_number']>0){
// return V(0,"该礼包已开售");
@@ -191,6 +195,9 @@ class BlindBox extends adminApi
$data = [];
$data['quantity'] = $quantity;
$data['remaining_number'] = $quantity;
if($weight){
$data['weight'] = $weight;
}
$res = db::name($this->table)->where(['id'=>$id])->update($data);
if($res){
return V(1,"成功");