feat : refund

This commit is contained in:
2025-03-27 11:23:36 +08:00
parent c4bc83f9e2
commit fb8fb12c7f
3 changed files with 19 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ use Hyperf\DbConnection\Model\Model;
* @property int $sort * @property int $sort
* @property int $is_del * @property int $is_del
* @property int $code_number * @property int $code_number
* @property int $occupied
* @property int $is_add_staple_food * @property int $is_add_staple_food
* @property string $create_time * @property string $create_time
* @property string $update_time * @property string $update_time
@@ -48,7 +49,21 @@ class Sku extends Model
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*/ */
protected array $casts = ['id' => 'integer', 'spu_id' => 'integer', 'total_stock' => 'integer', 'surplus_stock' => 'integer', 'sales_num' => 'integer', 'order_num' => 'integer', 'cancel_num' => 'integer', 'refund_num' => 'integer', 'saleable' => 'integer','sort' => 'integer','is_add_staple_food' => 'integer','code_number' => 'integer']; protected array $casts = [
'id' => 'integer',
'spu_id' => 'integer',
'total_stock' => 'integer',
'surplus_stock' => 'integer',
'sales_num' => 'integer',
'order_num' => 'integer',
'cancel_num' => 'integer',
'refund_num' => 'integer',
'saleable' => 'integer',
'sort' => 'integer',
'is_add_staple_food' => 'integer',
'code_number' => 'integer',
'occupied' => 'integer',
];
const string CREATED_AT = 'create_time'; const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time'; const string UPDATED_AT = 'update_time';

View File

@@ -84,7 +84,7 @@ class Spu extends Model
->where('type',$type) ->where('type',$type)
->where('saleable',GoodCode::LISTING) ->where('saleable',GoodCode::LISTING)
->orderBy('sort') ->orderBy('sort')
->select(['id','cycle_id','chef_id','title','title','sub_title','category_id']) ->select(['id','cycle_id','chef_id','title','title','sub_title','category_id','occupied'])
->get(); ->get();
} }

View File

@@ -102,6 +102,7 @@ class SkuService extends BaseService
$insertModel->order_num = 0; $insertModel->order_num = 0;
$insertModel->cancel_num = 0; $insertModel->cancel_num = 0;
$insertModel->refund_num = 0; $insertModel->refund_num = 0;
$insertModel->occupied = $this->request->input('occupied',1);
// $insertModel->behind_refund_num = 0; // $insertModel->behind_refund_num = 0;
$insertModel->saleable = $this->request->input('saleable'); $insertModel->saleable = $this->request->input('saleable');
$insertModel->is_add_staple_food = $this->request->input('is_add_staple_food'); $insertModel->is_add_staple_food = $this->request->input('is_add_staple_food');
@@ -169,6 +170,7 @@ class SkuService extends BaseService
$skuInfo->sort = $this->request->input('sort'); $skuInfo->sort = $this->request->input('sort');
$skuInfo->is_add_staple_food = $this->request->input('is_add_staple_food'); $skuInfo->is_add_staple_food = $this->request->input('is_add_staple_food');
$skuInfo->code_number = $this->request->input('code_number'); $skuInfo->code_number = $this->request->input('code_number');
$skuInfo->occupied = $this->request->input('occupied',1);
if (!$skuInfo->save()) throw new ErrException('修改失败'); if (!$skuInfo->save()) throw new ErrException('修改失败');