예제 #1
0
 /**
  * [addcodeAction 添加云码]
  * @return [type] [description]
  */
 public function addcodeAction()
 {
     if ($this->request->isPost()) {
         if (!$this->validFlag) {
             $error = json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
             $this->view->setVars(array('error' => $error));
         } else {
             for ($i = 0; $i < $this->_sanReq['num']; $i++) {
                 $code = \Mall\Utils\Inputs::createCode();
                 $type = $this->_sanReq['type'];
                 $starTime = strtotime($this->_sanReq['starTime']);
                 $endTime = strtotime($this->_sanReq['endTime']);
                 $goodsId = $this->_sanReq['gid'];
                 $value .= "('" . $code . "', '" . $type . "', '" . $goodsId . "', '" . $starTime . "', '" . $endTime . "', '" . $_SERVER['REQUEST_TIME'] . "'),";
                 $values = "VALUES " . $value;
             }
             $this->code->batchInnserCode(trim($values, ','));
             $this->log('云码添加成功');
             $this->response->redirect("codes/index");
         }
     }
 }
예제 #2
0
 public function addCouponsAction()
 {
     if ($this->request->isPost()) {
         if (!$this->validFlag) {
             $error = json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
         } else {
             for ($i = 0; $i < $this->_sanReq['num']; $i++) {
                 $cpsn = \Mall\Utils\Inputs::createCode('6');
                 $crid = $this->_sanReq['crid'];
                 $starTime = strtotime($this->_sanReq['starTime']);
                 $endTime = strtotime($this->_sanReq['endTime']);
                 $status = $this->_sanReq['status'];
                 $value .= "('" . $crid . "', '" . $cpsn . "', '" . $starTime . "', '" . $endTime . "', '" . $status . "', '" . $_SERVER['REQUEST_TIME'] . "'),";
                 $values = "VALUES " . $value;
             }
             $this->coupons->batchAddCoupons(trim($values, ','));
             $this->log('添加优惠期成功');
             $this->response->redirect("coupons/listCoupons");
         }
     }
     $rule = $this->coupons->showCouponsRule();
     $this->view->setVars(array('rule' => $rule, 'error' => isset($error) ? $error : ''));
 }