|
|
@@ -13,6 +13,26 @@ class LiveOrderClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizGhs\live\models\LiveOrder';
|
|
|
|
|
|
+ public static function delCustom($custom, $live)
|
|
|
+ {
|
|
|
+ $customId = $custom->id ?? 0;
|
|
|
+ $orderSn = $live->orderSn ?? '';
|
|
|
+ $customList = LiveOrderCustomClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
|
|
|
+ $num = 0;
|
|
|
+ if (!empty($customList)) {
|
|
|
+ foreach ($customList as $it) {
|
|
|
+ $currentCustomId = $it->customId ?? 0;
|
|
|
+ if ($currentCustomId == $customId) {
|
|
|
+ $num = $it->num ?? 0;
|
|
|
+ $it->delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $live->customNum = bcsub($live->customNum, 1);
|
|
|
+ $live->itemNum = bcsub($live->itemNum, $num);
|
|
|
+ $live->save();
|
|
|
+ }
|
|
|
+
|
|
|
public static function addCustom($params, $custom, $live)
|
|
|
{
|
|
|
$customId = $custom->id ?? 0;
|