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' => '没有消费记录']; } }
/** * 查看最后一条充值记录是否成功 * @Param int $userId 用户ID * @Method GET * @Return JOSN 返回执行json结果 ,message=0表示成功 */ public function actionGetrecharge() { $request = \Yii::$app->request; $userId = intval($request->get('userId', 0)); if (EasyHelpers::encrypty($userId, \Yii::$app->params['key']) != $request->get('usign', 0)) { return ['code' => 5, 'msg' => '非法数据']; } $recharge = \master\models\Recharge::getRechargeInfo($userId); if ($recharge && $recharge['status'] == 'success') { return ['code' => 0, 'msg' => '充值成功']; } else { return ['code' => 1, 'msg' => '充值未完成']; } }