Silent 6 éve
szülő
commit
bc9114cb53

+ 1 - 1
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -216,7 +216,7 @@ class ApiController extends Controller
         $now = Carbon::today()->toDateTimeString();
         $checkCard = CheckCard::where([
             ['begin_date_time', '>', $now]
-        ])->whereNotNull('end_date_time')->orderBy('begin_date_time', 'desc')->first();
+        ])->whereNull('end_date_time')->orderBy('begin_date_time', 'desc')->first();
         return response()->json(['status' => 'success', 'result' => $result, 'checkCard' => $checkCard]);
     }
 

+ 31 - 29
wechat/pages/index/index.js

xqd xqd xqd
@@ -50,34 +50,6 @@ Page({
       app.globalData.ptStudent = pt_student;
     }
 
-    wx.request({
-      url: api.getShareInfoUrl,
-      method: 'GET',
-      data: {
-        'student_id': pt_student.id
-      },
-      success: res => {
-        if(res.data.status == 'success') {
-          this.setData({
-            shareCanvasWidth: res.data.width,
-            shareCanvasHeight: res.data.height,
-            shareImage: res.data.shareImage,
-            shareText: res.data.shareText,
-            shareTextPosX: res.data.shareTextPosX,
-            shareTextPosY: res.data.shareTextPosY,
-          })
-          wx.downloadFile({
-            url: res.data.shareImage,
-            success: res => {
-              this.setData({
-                shareImage: res.tempFilePath
-              })
-            }
-          })
-        }
-      }
-    })
-
     wx.getLocation({
       success: (res) => {
         // let validLocation = this.validLocation(res.latitude, res.longitude)
@@ -86,9 +58,11 @@ Page({
           method: 'GET',
           data: {
             latitude: res.latitude,
-            longitude: res.longitude
+            longitude: res.longitude,
+            student_id: pt_student.id
           },
           success: res => {
+            console.log(res)
             if (res.data.status == 'success' && res.data.result == 'ok') {
               let validLocation = api.isTest ? true : false;
               this.setData({
@@ -105,6 +79,34 @@ Page({
 
       }
     })
+
+    wx.request({
+      url: api.getShareInfoUrl,
+      method: 'GET',
+      data: {
+        'student_id': pt_student.id
+      },
+      success: res => {
+        if (res.data.status == 'success') {
+          this.setData({
+            shareCanvasWidth: res.data.width,
+            shareCanvasHeight: res.data.height,
+            shareImage: res.data.shareImage,
+            shareText: res.data.shareText,
+            shareTextPosX: res.data.shareTextPosX,
+            shareTextPosY: res.data.shareTextPosY,
+          })
+          wx.downloadFile({
+            url: res.data.shareImage,
+            success: res => {
+              this.setData({
+                shareImage: res.tempFilePath
+              })
+            }
+          })
+        }
+      }
+    })
   },
   validLocation(latitude, longitude) {
     let res = api.isTest ? true : false;