/** * 获取店铺消费数据 */ public function actionGetconsume() { $request = \Yii::$app->request; $storeId = intval($request->get('storeId', 0)); $year = intval($request->get('year', 0)); if (!$storeId || !$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); $store_user = Store::findOne(['storeId' => $storeId]); $clickData = \master\models\ProductClick::getClick('', $store_user['userId'], $year, $month, $day); $extData = \master\models\StoreStorage::getStoreStorageData($storeId, $year, $month, $day); $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' => '没有消费记录']; } }