|
|
@@ -3,6 +3,7 @@
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
use biz\admin\classes\AdminRoleClass;
|
|
|
+use biz\product\classes\XjClass;
|
|
|
use biz\shop\classes\ShopExtClass;
|
|
|
use common\components\printUtil;
|
|
|
use common\components\util;
|
|
|
@@ -63,28 +64,18 @@ class ShopExtController extends BaseController
|
|
|
util::success($ext);
|
|
|
}
|
|
|
|
|
|
- //添加修改小菊颜色 shish 20210906
|
|
|
+ //小菊启用和停用 shish 20211210
|
|
|
public function actionReplaceXj()
|
|
|
{
|
|
|
- $act = Yii::$app->request->get('act', 'add');
|
|
|
+ $act = Yii::$app->request->get('act', 'start');
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
- $xj = $this->shopExt->xj;
|
|
|
- $hasIds = [];
|
|
|
- if (!empty($xj)) {
|
|
|
- $hasIds = json_decode($xj, true);
|
|
|
- }
|
|
|
- if ($act == 'add') {
|
|
|
- if(in_array($id,$hasIds) == false){
|
|
|
- $hasIds[] = $id;
|
|
|
- $this->shopExt->xj = json_encode($hasIds);
|
|
|
- $this->shopExt->save();
|
|
|
- }
|
|
|
- } else {
|
|
|
- $key = array_search($id,$hasIds);
|
|
|
- unset($hasIds[$key]);
|
|
|
- $this->shopExt->xj = json_encode($hasIds);
|
|
|
- $this->shopExt->save();
|
|
|
+ $xj = XjClass::getById($id, true);
|
|
|
+ if (empty($xj)) {
|
|
|
+ util::fail('没有找到小菊');
|
|
|
}
|
|
|
+ $status = $act == 'start' ? 1 : 2;
|
|
|
+ $xj->status = $status;
|
|
|
+ $xj->save();
|
|
|
util::complete();
|
|
|
}
|
|
|
|