李浩杰 пре 4 година
родитељ
комит
ce309a3a27

+ 1 - 1
app/Http/Controllers/Admin/TestController.php

xqd
@@ -13,7 +13,7 @@ class TestController extends Controller
 {
     public function index(Request $request)
     {
-//        dd(User::where('phone', '13438082119')->first());
+        dd(User::where('phone', '13438082119')->first());
         $app = app('wechat.mini_program');
         $res = $app->template_message->send([
             'touser' => 'oi4-45JF9_U6EuttPyvDjpV_yuC0',

+ 3 - 2
app/Http/Controllers/Api/mini/AuthController.php

xqd xqd
@@ -33,7 +33,6 @@ class AuthController extends BaseController
         }
         if($session_key) {
             $data = $app->encryptor->decryptData($session_key, $request->input('iv'), $request->input('encryptedData'));
-            Log::info($data);
             if(isset($data['openId'])) {
                 if($request->input('bind')) {
                     $token = $request->header('X-Token');
@@ -49,9 +48,11 @@ class AuthController extends BaseController
                     ]);
                     if(empty($user)) return $this->error(['msg' => '用户不存在,请先绑定账户']);
                 }
+                $union_id = isset($data['unionId']) ? $data['unionId'] : $user->union_id;
                 $user->update([
                     'nickname' => $data['nickName'],
-                    'avatar' => $data['avatarUrl']
+                    'avatar' => $data['avatarUrl'],
+                    'union_id' => $union_id
                 ]);
                 $user->updateToken();
                 $user = $user->getUserInfo($session_key);

+ 16 - 5
app/Models/Notification.php

xqd xqd xqd
@@ -88,17 +88,24 @@ class Notification extends BaseModel
             $status = 5;
         }
         foreach($user_ids as $user_id) {
-            Notification::create([
+            $data = [
                 'user_id' => $user_id,
                 'order_id' => $order['id'],
                 'status' => $status,
                 'type' => $order['type'],
                 'is_read' => 2
-            ]);
+            ];
+            self::createAndSend($data);
         }
         return true;
     }
 
+    public static function createAndSend($data)
+    {
+        $item = Notification::create($data);
+
+    }
+
     /**
      * 租赁时间到期 status = 4
      * @param $id
@@ -114,13 +121,14 @@ class Notification extends BaseModel
             ['project_role_id', $role['id']]
         ])->pluck('user_id');
         foreach($user_ids as $user_id) {
-            Notification::create([
+            $data = [
                 'user_id' => $user_id,
                 'order_id' => $order['id'],
                 'status' => 4,
                 'type' => $order['type'],
                 'is_read' => 2
-            ]);
+            ];
+            self::createAndSend($data);
         }
         return false;
     }
@@ -136,7 +144,10 @@ class Notification extends BaseModel
             } else if($this['status'] == 2) {
                 return [
                     'name' => '租赁审批待处理通知',
-                    'content' => '你有一条设备租赁申请待审批,请确认相关信息:'
+                    'content' => '你有一条设备租赁申请待审批,请确认相关信息:',
+                    'official' => [
+                        'template_id'
+                    ]
                 ];
             } else if($this['status'] == 3) {
                 return [

+ 1 - 1
mini/utils/env.js

xqd
@@ -1,3 +1,3 @@
-const isTest = true;
+const isTest = false;
 export const baseUrl = isTest ? 'http://app.rt/api/mini/' : 'http://t18.9026.com/api/mini/';
 export const imgHost = isTest ? 'http://app.rt/images/' : 'http://t18.9026.com/images/'