|
@@ -1109,19 +1109,26 @@ class Goodup extends Base
|
|
|
if (empty($good_basic)) throw new Exception('该记录不存在或已删除');
|
|
|
|
|
|
$good = Db::name('good')
|
|
|
- ->field('id,status')
|
|
|
- ->where(['spuCode' => $supcode, 'is_del' => 0])
|
|
|
- ->whereIn('status', [1, 8])
|
|
|
+ ->alias('g')
|
|
|
+ ->field('gp.id,gp.exam_status')
|
|
|
+ ->leftJoin('good_platform gp', 'gp.spuCode=g.spuCode AND gp.is_del=0')
|
|
|
+ ->where(['g.spuCode' => $supcode, 'g.is_del' => 0])
|
|
|
+ ->whereNotIn('gp.exam_status', [1, 8])
|
|
|
->find();
|
|
|
|
|
|
- if (empty($good)) throw new Exception('该上线商品记录不存在或不允许删除,请检查商品是否下线');
|
|
|
+ if (!empty($good)) throw new Exception('该商品需要下线之后才能删除');
|
|
|
|
|
|
Db::name("good_basic")
|
|
|
->where(['id' => $good_basic['id'], 'is_del' => 0])
|
|
|
->update(['is_del' => 1, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
|
|
|
Db::name("good")
|
|
|
- ->where(['id' => $good['id'], 'is_del' => 0])
|
|
|
+ ->where(['spuCode' => $supcode, 'is_del' => 0])
|
|
|
+ ->update(['is_del' => 1, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
+
|
|
|
+ Db::name("good_platform")
|
|
|
+ ->where(['spuCode' => $supcode, 'is_del' => 0])
|
|
|
+ ->whereIn('exam_status', [1, 8])
|
|
|
->update(['is_del' => 1, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
|
|
|
ProcessOrder::workdel(["order_type" => "CGD", "order_code" => $supcode]);
|
|
@@ -1130,7 +1137,7 @@ class Goodup extends Base
|
|
|
app_show(0, "删除成功");
|
|
|
} catch (Exception $exception) {
|
|
|
Db::rollback();
|
|
|
- return error_show(1005, "删除失败");
|
|
|
+ return error_show(1005, "删除失败," . $exception->getMessage());
|
|
|
}
|
|
|
|
|
|
|