コード例 #1
0
 /**
  * 获取产品点击曲线数据
  * @return type
  */
 public function actionGetclick()
 {
     $request = \Yii::$app->request;
     $userId = intval($request->get('userId', 0));
     $productId = intval($request->get('productId', 0));
     $year = intval($request->get('year', 0));
     $usign = $request->_get('usign', '');
     if ($usign != EasyHelpers::encrypty($userId, \Yii::$app->params['key'])) {
         return ['code' => 5, 'msg' => '非法数据'];
     }
     if (!$userId || !$productId || !$year) {
         return ['code' => 2, 'msg' => '非法数据'];
     }
     $product = \master\models\Product::findOne(['productId' => $productId]);
     if ($product && $userId != $product['ownid']) {
         return ['code' => 6, 'msg' => '非法数据'];
     }
     $month = intval($request->get('month', 0));
     $day = intval($request->get('day', 0));
     $data = ProductClick::getClick($productId, $userId, $year, $month, $day);
     $type = 'year';
     if ($month) {
         if ($day) {
             $type = 'day';
         } else {
             $type = 'month';
         }
     }
     if ($data) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => ['data' => $data, 'type' => $type]];
     } else {
         return ['code' => 2, 'msg' => '没有点击记录'];
     }
 }
コード例 #2
0
 /**
  * 获取产品点击曲线数据
  * @return type
  */
 public function actionGetclick()
 {
     $request = \Yii::$app->request;
     $userId = intval($request->get('userId', 0));
     $productId = intval($request->get('productId', 0));
     $year = intval($request->get('year', 0));
     if (!$userId || !$productId || !$year) {
         return ['code' => 2, 'msg' => '非法数据'];
     }
     $month = intval($request->get('month', 0));
     $day = intval($request->get('day', 0));
     $data = ProductClick::getClick($productId, $userId, $year, $month, $day);
     $type = 'year';
     if ($month) {
         if ($day) {
             $type = 'day';
         } else {
             $type = 'month';
         }
     }
     if ($data) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => ['data' => $data, 'type' => $type]];
     } else {
         return ['code' => 2, 'msg' => '没有点击记录'];
     }
 }
コード例 #3
0
 /**
  * 产品详情
  * @return type
  */
 public function actionDetail()
 {
     $pid = \YIi::$app->request->get('pid', 0);
     $product = [];
     if ($pid) {
         $product = \master\models\Product::getProductById($pid);
         $product['fileName'] = \master\models\Product::getFileName($pid);
         $product['clicks'] = ProductClick::getClickNum($pid);
     }
     if (!$product) {
         return $this->redirect('/product/index');
     }
     $data['product'] = $product;
     $data['changestatusdetailIdentity'] = EasyHelpers::dataEncrypt('changestatusdetail,' . \Yii::$app->user->id);
     $data['setmodelnameIdentity'] = EasyHelpers::dataEncrypt('setmodelname,' . \Yii::$app->user->id);
     $data['token'] = Token::getToken();
     return $this->render('detail', $data);
 }
コード例 #4
0
ファイル: StoreController.php プロジェクト: BlackCodes/Mymine
 public function actionGetallconsume()
 {
     $request = \Yii::$app->request;
     $storeId = intval($request->get('storeId', 0));
     $year = intval($request->get('year', 0));
     if (!$year) {
         return ['code' => 2, 'msg' => '非法数据'];
     }
     $month = intval($request->get('month', 0));
     $day = intval($request->get('day', 0));
     $rechargeData = \master\models\Recharge::getRechargeData($storeId, $year, $month, $day) ?: ['data' => [], 'total' => 0];
     $clickData = \master\models\ProductClick::getClick('', 'all', $year, $month, $day) ?: ['data' => [], 'total' => 0];
     $extData = \master\models\StoreStorage::getStoreStorageData($storeId, $year, $month, $day) ?: ['data' => [], 'total' => 0];
     $type = 'year';
     if ($month) {
         if ($day) {
             $type = 'day';
         } else {
             $type = 'month';
         }
     }
     if ($rechargeData || $clickData || $extData) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => ['rechargeData' => $rechargeData, 'clickData' => $clickData, 'extData' => $extData, 'type' => $type]];
     } else {
         return ['code' => 2, 'msg' => '没有消费记录'];
     }
 }
コード例 #5
0
 /**
  * 查看产品点击详情
  * @return type
  */
 public function actionClickdetail()
 {
     $view = \Yii::$app->view;
     $view->params['moduleName'] = '模型点击';
     $pid = \YIi::$app->request->get('pid', 0);
     $product = [];
     if ($pid) {
         $product = Product::getProductById($pid);
         $product['fileName'] = Product::getFileName($pid);
         $product['clicks'] = \master\models\ProductClick::getClickNum($pid);
         $product['lastClick'] = \master\models\ProductClick::getLastClick($pid);
     }
     if (!$product) {
         return $this->redirect('/finance/modenclick');
     }
     $data['product'] = $product;
     $data['token'] = Token::getToken();
     return $this->render('clickdetail', $data);
 }