|
|
@@ -11,21 +11,6 @@ use Yii;
|
|
|
class XjController extends BaseController
|
|
|
{
|
|
|
|
|
|
- //删除选项 ssh 20230728
|
|
|
- public function actionDelItem()
|
|
|
- {
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $id = $get['id'] ?? 0;
|
|
|
- $xj = XjClass::getById($id, true);
|
|
|
- if (empty($xj) || $xj->mainId != $this->mainId) {
|
|
|
- util::fail('删除失败');
|
|
|
- }
|
|
|
- $xj->delStatus = 1;
|
|
|
- $xj->status = 2;
|
|
|
- $xj->save();
|
|
|
- util::complete();
|
|
|
- }
|
|
|
-
|
|
|
//修改多颜色名称 ssh 20220107
|
|
|
public function actionChangeXjName()
|
|
|
{
|
|
|
@@ -133,19 +118,6 @@ class XjController extends BaseController
|
|
|
util::complete('保存成功');
|
|
|
}
|
|
|
|
|
|
- //清除全部小菊 lqh 2021.12.8
|
|
|
- public function actionClearAll()
|
|
|
- {
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $itemId = $get['itemId'] ?? 0;
|
|
|
- $product = ItemClass::getById($itemId, true);
|
|
|
- if ($product->mainId != $this->mainId) {
|
|
|
- util::fail('不是您的花材');
|
|
|
- }
|
|
|
- XjClass::clearAll($itemId);
|
|
|
- util::complete('已删除');
|
|
|
- }
|
|
|
-
|
|
|
//新增小菊 lqh 2021.12.8
|
|
|
public function actionBatchAdd()
|
|
|
{
|
|
|
@@ -167,4 +139,61 @@ class XjController extends BaseController
|
|
|
util::complete('添加成功');
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+ //删除选项 ssh 20230728
|
|
|
+ public function actionDelItem()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $xj = XjClass::getById($id, true);
|
|
|
+ if (empty($xj) || $xj->mainId != $this->mainId) {
|
|
|
+ util::fail('删除失败');
|
|
|
+ }
|
|
|
+ $xj->delStatus = 1;
|
|
|
+ $xj->status = 2;
|
|
|
+ $xj->save();
|
|
|
+
|
|
|
+ $itemId = $xj->itemId ?? 0;
|
|
|
+ $delList = XjClass::getAllByCondition(['itemId' => $itemId, 'delStatus' => 1], null, '*', null, true);
|
|
|
+ //超过2个月,多颜色订单就不能售后,超过3个月多颜色的花材就要删除掉,多处要同步修改,关键词 xj_global_change ssh 20251230
|
|
|
+ if(!empty($delList)){
|
|
|
+ $threeMonthsAgo = time() - (90 * 24 * 60 * 60); // 3个月前的时间戳
|
|
|
+ foreach ($delList as $item) {
|
|
|
+ $updateTime = strtotime($item->updateTime); // 将时间转换为时间戳
|
|
|
+ // 判断 updateTime 是否超过 3 个月
|
|
|
+ if ($updateTime < $threeMonthsAgo) {
|
|
|
+ $item->delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
+ //清除全部小菊 lqh 2021.12.8
|
|
|
+ public function actionClearAll()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $itemId = $get['itemId'] ?? 0;
|
|
|
+ $product = ItemClass::getById($itemId, true);
|
|
|
+ if ($product->mainId != $this->mainId) {
|
|
|
+ util::fail('不是您的花材');
|
|
|
+ }
|
|
|
+ XjClass::updateByCondition(['itemId' => $itemId], ['status' => 2, 'delStatus' => 1]);
|
|
|
+
|
|
|
+ $delList = XjClass::getAllByCondition(['itemId' => $itemId, 'delStatus' => 1], null, '*', null, true);
|
|
|
+ //超过2个月,多颜色订单就不能售后,超过3个月多颜色的花材就要删除掉,多处要同步修改,关键词 xj_global_change ssh 20251230
|
|
|
+ if(!empty($delList)){
|
|
|
+ $threeMonthsAgo = time() - (90 * 24 * 60 * 60); // 3个月前的时间戳
|
|
|
+ foreach ($delList as $item) {
|
|
|
+ $updateTime = strtotime($item->updateTime); // 将时间转换为时间戳
|
|
|
+ // 判断 updateTime 是否超过 3 个月
|
|
|
+ if ($updateTime < $threeMonthsAgo) {
|
|
|
+ $item->delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ util::complete('已删除');
|
|
|
+ }
|
|
|
+
|
|
|
+}
|