예제 #1
0
 public function actionUpdate()
 {
     $pictures = array();
     $lid = Yii::app()->request->getParam('lid');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $criteria = new CDbCriteria();
     $criteria->with = 'productImg';
     $criteria->addCondition('t.lid=:lid and t.dpid=:dpid and t.delete_flag=0 ');
     $criteria->order = ' t.lid desc ';
     $criteria->params[':lid'] = $lid;
     $criteria->params[':dpid'] = $this->companyId;
     $model = Product::model()->find($criteria);
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('productImg');
         if (ProductPicture::saveImg($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productImg/index', 'companyId' => $this->companyId));
         }
     }
     if (!empty($model->productImg)) {
         foreach ($model->productImg as $pic) {
             array_push($pictures, $pic->pic_path);
         }
     }
     $this->render('updateProductImg', array('model' => $model, 'pictures' => $pictures));
 }
예제 #2
0
 public function actionDelete()
 {
     $ids = Yii::app()->request->getPost('companyIds');
     Until::isUpdateValid(array(0), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         Yii::app()->db->createCommand('update nb_company set delete_flag=1,update_at="' . date('Y-m-d H:i:s', time()) . '" where dpid in (' . implode(',', $ids) . ')')->execute();
     }
     $this->redirect(array('company/index', 'companyId' => $this->companyId));
 }
예제 #3
0
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $id = Yii::app()->request->getParam('id');
     Until::isUpdateValid(array($id), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($id)) {
         $model = MemberCard::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
         if ($model) {
             $model->saveAttributes(array('delete_flag' => 1, 'update_at' => date('Y-m-d H:i:s', time())));
         }
         $this->redirect(array('member/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('member/index', 'companyId' => $companyId));
     }
 }
예제 #4
0
 public function actionDelete()
 {
     //$ids = $_POST['type_id'] ;
     $ids = Yii::app()->request->getPost('type_id');
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。
     //var_dump(implode(',' , $ids),$this->companyId);exit;
     //$sql='update nb_site_type set delete_flag=1 where lid in ('.implode(',' , $ids).') and dpid = :companyId';
     //$command=Yii::app()->db->createCommand($sql);
     //$command->bindValue(":ids" , implode(',' , $ids));
     //$command->bindValue(":dpid" , $this->companyId);
     //var_dump($command);exit;
     if (!empty($ids)) {
         Yii::app()->db->createCommand('update nb_site_persons set delete_flag=1 where lid in (' . implode(',', $ids) . ') and dpid = :companyId')->execute(array(':companyId' => $this->companyId));
     }
     $this->redirect(array('sitePersons/index', 'companyId' => $this->companyId));
 }
예제 #5
0
 public function actionUpdate()
 {
     $id = Yii::app()->request->getParam('id');
     $model = Department::model()->findByPk($id);
     if (Yii::app()->request->isPostRequest) {
         Until::isUpdateValid(array($id), $this->companyId, $this);
         //0,表示企业任何时候都在云端更新。
         $model->attributes = Yii::app()->request->getPost('Department');
         $model->update_at = date('Y-m-d H:i:s', time());
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('department/index', 'companyId' => $this->companyId));
         }
     }
     $printers = $this->getPrinterList();
     $this->render('update', array('model' => $model, 'printers' => $printers));
 }
예제 #6
0
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('ids');
     Until::isUpdateValid($ids, $this->companyId, $this);
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = CompanyWifi::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->update_at = date('Y-m-d H:i:s');
                 $model->delete();
             }
         }
         $this->redirect(array('companyWifi/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('companyWifi/index', 'companyId' => $companyId));
     }
 }
예제 #7
0
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('ids');
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = PaymentMethod::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->delete();
             }
         }
         $this->redirect(array('payMethod/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('payMethod/index', 'companyId' => $companyId));
     }
 }
 public function actionUpdate()
 {
     $printerway = array();
     $lid = Yii::app()->request->getParam('lid');
     $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId));
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('ProductPrinterway');
         //$model->printer_way_id = $postData;
         if (ProductPrinterway::saveProductPrinterway($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productPrinter/index', 'companyId' => $this->companyId));
         }
     }
     $printerWays = PrinterWay::getPrinterWay($this->companyId);
     $productPrinterway = ProductPrinterway::getProductPrinterWay($lid, $this->companyId);
     foreach ($productPrinterway as $ppw) {
         array_push($printerway, $ppw['printer_way_id']);
     }
     $this->render('updateProductPrinter', array('model' => $model, 'printerWays' => $printerWays, 'printerway' => $printerway));
 }
예제 #9
0
 public function actionCompanyDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('ids');
     $userid = Yii::app()->request->getParam('userid', 0);
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         Yii::app()->db->createCommand('update nb_user_company set delete_flag=1 where lid in (' . implode(',', $ids) . ') and dpid = :companyId')->execute(array(':companyId' => $this->companyId));
         $this->redirect(array('user/companyIndex', 'companyId' => $companyId, 'lid' => $userid));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('user/companyIndex', 'companyId' => $companyId, 'lid' => $userid));
     }
 }
예제 #10
0
 public function actionUpdateProductTaste()
 {
     $tasteArr = array();
     $lid = Yii::app()->request->getParam('lid');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId));
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('Taste');
         if (TasteClass::saveProductTaste($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('taste/productTaste', 'companyId' => $this->companyId));
         }
     }
     $tastes = TasteClass::getAllOrderTasteGroup($this->companyId, 0);
     $productTastes = TasteClass::getProductTasteGroup($lid, $this->companyId);
     foreach ($productTastes as $taste) {
         array_push($tasteArr, $taste['lid']);
     }
     $this->render('updateProductTaste', array('model' => $model, 'tastes' => $tastes, 'productTastes' => $tasteArr));
 }
예제 #11
0
 public function actionRecommend()
 {
     $id = Yii::app()->request->getParam('id');
     $product = Product::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $this->companyId));
     Until::isUpdateValid(array($id), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if ($product) {
         $product->saveAttributes(array('is_discount' => $product->is_discount == 0 ? 1 : 0, 'update_at' => date('Y-m-d H:i:s', time())));
         //$product->update_at = date('Y-m-d H:i:s',time());
     }
     exit;
 }
예제 #12
0
 public function actionOver()
 {
     $lid = Yii::app()->request->getParam('lid', 0);
     $companyId = Yii::app()->request->getParam('companyId', 0);
     $orderId = Yii::app()->request->getParam('orderId', 0);
     $typeId = Yii::app()->request->getParam('typeId', 0);
     Until::isUpdateValid(array($lid), $companyId, $this);
     $sql = 'update nb_order_product set is_waiting=2 where dpid=' . $companyId . ' and lid=' . $lid;
     //var_dump($sql);exit;
     Yii::app()->db->createCommand($sql)->execute();
     $this->redirect(array('defaultOrder/order', 'companyId' => $companyId, 'orderId' => $orderId, 'typeId' => $typeId));
 }
 public function actionDelete()
 {
     $id = Yii::app()->request->getParam('id');
     Until::isUpdateValid(array($id), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $model = ProductCategory::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $this->companyId));
     //var_dump($id,  $this->companyId,$model);exit;
     if ($model) {
         $model->deleteCategory();
         Yii::app()->user->setFlash('success', yii::t('app', '删除成功!'));
     }
     $this->redirect(array('productCategory/index', 'companyId' => $this->companyId, 'id' => $model->pid));
 }
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $printset = Yii::app()->request->getParam('psid');
     $ids = Yii::app()->request->getPost('ids');
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。;
     if (!empty($ids)) {
         Yii::app()->db->createCommand('update nb_product_addition set delete_flag=1 where lid in (' . implode(',', $ids) . ') and dpid = :companyId')->execute(array(':companyId' => $this->companyId));
         $this->redirect(array('productAddition/detail', 'companyId' => $companyId, 'lid' => $printset));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('productAddition/detail', 'companyId' => $companyId, 'lid' => $printset));
     }
 }