Example #1
0
 public function actionSalestore()
 {
     $request = \Yii::$app->request;
     $identity = Identity::checkIdentity('salestore', '/app-backend/backend/store/salestore');
     if (is_array($identity)) {
         return $identity;
     }
     $saleId = intval($request->get('saleId', ''));
     if (!$saleId) {
         return ['code' => 1, 'msg' => '数据非法', 'data' => []];
     }
     $data = StoreSale::getSaleStore($saleId);
     if ($data !== false) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => ['store' => $data]];
     } else {
         return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []];
     }
 }
Example #2
0
 /**
  * 店铺详情
  * @return type
  */
 public function actionInfo()
 {
     $view = \Yii::$app->view;
     $view->params['moduleName'] = '商家信息';
     $storeId = intval(\Yii::$app->request->get('storeId', 0));
     $store = Store::findOne(['storeId' => $storeId]);
     if (!$store) {
         return $this->redirect('/store/index');
     }
     \Yii::$app->language = 'zh-CN';
     $token = Token::getToken();
     $user = \Yii::$app->user->id;
     $changestatusIdentity = EasyHelpers::dataEncrypt('changestatus,' . $user);
     $saleIdentity = EasyHelpers::dataEncrypt('sale,' . $user);
     $salestoreIdentity = EasyHelpers::dataEncrypt('salestore,' . $user);
     //销售
     $total = StoreSale::getSaleTotal();
     $pagination = new \yii\data\Pagination(['totalCount' => $total, 'defaultPageSize' => \Yii::$app->params['pageSize']]);
     $sales = StoreSale::getSale($storeId, $pagination->offset, $pagination->limit);
     return $this->render('storeinfo', ['store' => $store, 'token' => $token, 'changestatusIdentity' => $changestatusIdentity, 'salestoreIdentity' => $salestoreIdentity, 'saleIdentity' => $saleIdentity, 'sales' => $sales, 'pagination' => $pagination]);
 }
Example #3
0
 /**
  * 获取店铺详情
  */
 private static function getStoreBrief()
 {
     $brief = ['userMobile', 'storeId', 'logo', 'storeName', 'enterpriseType', 'createTime', 'address'];
     $sql = 'SELECT ' . implode(',', $brief) . ' FROM store AS s INNER JOIN user as u ON(s.userId=u.userId)';
     if (static::$storeId) {
         $sql .= ' WHERE s.storeId=' . static::$storeId;
     } else {
         $total = static::getDb()->createCommand($sql)->query()->count();
         $data['pagination'] = $pagination = new Pagination(['totalCount' => $total, 'pageSize' => static::$pageSize]);
         $sql .= ' LIMIT ' . $pagination->getOffset() . ',' . $pagination->getLimit();
     }
     $data['data'] = static::getDb()->createCommand($sql)->queryAll();
     $sale = StoreSale::getStoreSale();
     foreach ($data['data'] as &$v) {
         foreach ($sale as $vs) {
             if ($v['storeId'] == $vs['storeId']) {
                 $v['username'] = $vs['username'];
             }
         }
     }
     return $data;
 }