|
@@ -140,9 +140,23 @@ class BatchApi {
|
|
|
$data["id"] = $id;
|
|
|
$data["active"] = $active ?: 2;
|
|
|
Batch::update($data);
|
|
|
+ if ($active == 1) {
|
|
|
+ self::setOtherNoActive($id);
|
|
|
+ }
|
|
|
return ["code" => 200, "msg" => "成功"];
|
|
|
}
|
|
|
|
|
|
+ public static function setOtherNoActive($except_id) {
|
|
|
+ $open = self::getOne($except_id);
|
|
|
+ if ($open) {
|
|
|
+ $type = $open["type"];
|
|
|
+ $where[] = ["type", "=", $type];
|
|
|
+ $where[] = ["id", "<>", $except_id];
|
|
|
+ $data["active"] = 2;
|
|
|
+ Batch::where($where)->update($data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param type $type 申报类别
|