Ver Fonte

1、用户统计详情;

Lawsun há 1 ano atrás
pai
commit
b7081d95d8

+ 33 - 35
.idea/workspace.xml

@@ -1,14 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
-    <list default="true" id="08cfebb0-a4a4-47ee-a307-566aa06f29bb" name="Default Changelist" comment="1.gte 大于等于 ;">
-      <change afterPath="$PROJECT_DIR$/app/controller/home/statistic.js" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/app/models/mysql/usersEventLogs.js" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/app/models/mysql/usersProductBrowseLogs.js" afterDir="false" />
+    <list default="true" id="08cfebb0-a4a4-47ee-a307-566aa06f29bb" name="Default Changelist" comment="1、统计;">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/routers/home/shop.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/routers/home/shop.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/home/statistic.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/home/statistic.js" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/node_modules/egg-ts-helper/.tmp/eggInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/egg-ts-helper/.tmp/eggInfo.json" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/typings/app/controller/index.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/typings/app/controller/index.d.ts" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -52,27 +48,27 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "SHARE_PROJECT_CONFIGURATION_FILES": "true",
-    "WebServerToolWindowFactoryState": "false",
-    "last_opened_file_path": "D:/ysjjCode/shop-system/app/models/mysql",
-    "node.js.detected.package.eslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "nodejs_package_manager_path": "npm",
-    "settings.editor.selected.configurable": "preferences.keymap",
-    "ts.external.directory.path": "D:\\Program Files (x86)\\WebStorm 2022.2.1\\plugins\\JavaScriptLanguage\\jsLanguageServicesImpl\\external",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;ASKED_MARK_IGNORED_FILES_AS_EXCLUDED&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/ysjjCode/shop-system/app/models/mysql&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;preferences.keymap&quot;,
+    &quot;ts.external.directory.path&quot;: &quot;D:\\Program Files (x86)\\WebStorm 2022.2.1\\plugins\\JavaScriptLanguage\\jsLanguageServicesImpl\\external&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   },
-  "keyToStringList": {
-    "DatabaseDriversLRU": [
-      "mysql"
+  &quot;keyToStringList&quot;: {
+    &quot;DatabaseDriversLRU&quot;: [
+      &quot;mysql&quot;
     ]
   }
-}]]></component>
+}</component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
       <recent name="D:\ysjjCode\shop-system\app\models\mysql" />
@@ -257,14 +253,9 @@
       <workItem from="1689209473126" duration="4787000" />
       <workItem from="1689240225909" duration="2672000" />
       <workItem from="1689384833956" duration="6286000" />
-      <workItem from="1689558398171" duration="36717000" />
-    </task>
-    <task id="LOCAL-00021" summary="1.修复偶现无法提交订单的bug(微信支付下单金额为精确到分的正整数);">
-      <created>1670640071817</created>
-      <option name="number" value="00021" />
-      <option name="presentableId" value="LOCAL-00021" />
-      <option name="project" value="LOCAL" />
-      <updated>1670640071817</updated>
+      <workItem from="1689558398171" duration="37385000" />
+      <workItem from="1690506765249" duration="16389000" />
+      <workItem from="1691058586577" duration="5807000" />
     </task>
     <task id="LOCAL-00022" summary="1.代理申请,短信验证;">
       <created>1670899723089</created>
@@ -602,7 +593,14 @@
       <option name="project" value="LOCAL" />
       <updated>1689240933591</updated>
     </task>
-    <option name="localTasksCounter" value="70" />
+    <task id="LOCAL-00070" summary="1、统计;">
+      <created>1690420695156</created>
+      <option name="number" value="00070" />
+      <option name="presentableId" value="LOCAL-00070" />
+      <option name="project" value="LOCAL" />
+      <updated>1690420695156</updated>
+    </task>
+    <option name="localTasksCounter" value="71" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -648,7 +646,6 @@
     </option>
   </component>
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="1.餐币明细,客源信息;" />
     <MESSAGE value="1.餐币有效期;" />
     <MESSAGE value="1.修复餐币发放数量错误的bug;" />
     <MESSAGE value="1.增加合作餐店列表接口;" />
@@ -673,7 +670,8 @@
     <MESSAGE value="1.邀请分享红包调整;" />
     <MESSAGE value="1.暂存;" />
     <MESSAGE value="1.gte 大于等于 ;" />
-    <option name="LAST_COMMIT_MESSAGE" value="1.gte 大于等于 ;" />
+    <MESSAGE value="1、统计;" />
+    <option name="LAST_COMMIT_MESSAGE" value="1、统计;" />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>

+ 12 - 10
app/controller/home/statistic.js

@@ -24,7 +24,6 @@ module.exports = class StatisticController extends Base {
     try {
       // const dataParse = await that.ctx.postParse();
       const dataParse = await that.ctx.validate(that.loginValidate, await that.ctx.anyParse());
-      console.log(dataParse);
       // 2023/7/25 更新用户行为积分
       const updateBean = await that.app.comoBean.instance({
         intergral: that.app.Sequelize.literal('intergral + ' + 1),
@@ -112,14 +111,18 @@ module.exports = class StatisticController extends Base {
    */
   async statisticLogsList() {
     const that = this;
-    // const transaction = await that.app.model.transaction();
     try {
-      const dataParse = await that.ctx.validate(that.loginValidate, await that.ctx.anyParse());
-      console.log(dataParse);
-      // 2023/7/26 查询
-      // todo : 用户统计记录列表
-
-      return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', {}, false));
+      const dataParse = await that.ctx.anyParse();
+      // 2023/7/26 查询用户统计记录列表
+      const resultBrowse = await that.app.model.UsersProductBrowseLogs.findAll({
+        order: [[ 'browse_count', 'desc' ]],
+        where: { user_id: dataParse.user_id },
+      });
+      const resultEvent = await that.app.model.UsersEventLogs.findAll({
+        order: [[ 'event_count', 'desc' ]],
+        where: { user_id: dataParse.user_id },
+      });
+      return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', { resultBrowse, resultEvent }, false));
     } catch (err) {
       console.log(err);
       return that.ctx.appJson(that.app.szjcomo.appResult(err.message));
@@ -136,8 +139,7 @@ module.exports = class StatisticController extends Base {
     const seq = that.app.Sequelize;
     try {
       // const dataParse = await that.ctx.validate(that.loginValidate, await that.ctx.anyParse());
-      const dataParse = await that.ctx.anyParse();
-      console.log(dataParse);
+      // const dataParse = await that.ctx.anyParse();
       // 2023/7/26 查询
       const users = await that.app.model.Users.findAll({
         attributes: [ 'user_id', 'nickname', 'intergral', 'money', 'commission', 'headimgurl' ],

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
node_modules/egg-ts-helper/.tmp/eggInfo.json


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff