Jelajahi Sumber

Merge branch 'master' into we7

dyjh 6 tahun lalu
induk
melakukan
710efb42b8

+ 8 - 10
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd xqd
@@ -157,9 +157,9 @@ class AlbumController extends Controller
         $session = $res['session_key'];
         $decryptedData = $app->encryptor->decryptData($session, $datas['iv'], $datas['encryptData']);
         if (!isset($decryptedData['unionId'])) {
-            $check = AlbumUserModel::where('open_id', $res['openid'])->first();
+            $check = AlbumUserModel::where([['open_id', $res['openid']],['store_id',$datas['store_id']]])->first();
         } else {
-            $check = AlbumUserModel::where('wechat_union_id', $decryptedData['unionId'])->first();
+            $check = AlbumUserModel::where([['wechat_union_id', $decryptedData['unionId']],['store_id',$datas['store_id']]])->first();
         }
 
         if(!$check){
@@ -226,17 +226,13 @@ class AlbumController extends Controller
                 AlbumWatchRecord::create($add_record);
                 //   dd($add_record);
                 // print_r($add_record['agent_id']);die;
-                $user_agent = AlbumAgentModel::where('id',$add_record['agent_id'])->first();
+                $user_agent = AlbumAgentModel::where([['id',$add_record['agent_id']],['store_id',$datas['store_id']]])->first();
                 //dd($user_agent);
-                if($user_agent){
+                if ($user_agent) {
                     $user_agent->get_count++;
                     $user_agent->save();
-                    $agent = AlbumUserModel::where('id',$user_agent->user_id)->first();
-                    try{
-                        $this->sendLogsMessage($datas['store_id'],$agent->open_id,4,$userAuth->username,$agent->g_open_id);
-                    }catch (\Exception $e){
-
-                    }
+                    $agent = AlbumUserModel::where([['id',$user_agent->user_id],['store_id',$datas['store_id']]])->first();
+                    $this->sendLogsMessage($datas['store_id'], $agent->open_id, 4, $userAuth->username, $agent->g_open_id);
                 }else{
                     $userAuth->up_agent_id = 0;
                 }
@@ -1935,6 +1931,8 @@ class AlbumController extends Controller
         }
         $data['status'] = 0;
         $data['user_id'] = $userAuth->id;
+        $data['lon'] = $res['result']['location']['lng'];
+        $data['lat'] = $res['result']['location']['lat'];
         $data['name'] = $userAuth->username;
         $res = AlbumAgentModel::create($data);
         if($res){

+ 3 - 3
resources/views/admin/base/user/edit.blade.php

xqd
@@ -164,14 +164,14 @@
         },
         methods:{
             init:function(){
-                if(store_name&&store_id!=0){
+                if(store_name && store_id!=0){
                     Vue.set(this.checkstore,'name',store_name);
                     Vue.set(this.checkstore,'id',store_id);
                 }
             },
             checkStore:function (store) {
-                Vue.set(this.checkuser,'name',store.name);
-                Vue.set(this.checkuser,'id',store.id);
+                Vue.set(this.checkstore,'name',store.name);
+                Vue.set(this.checkstore,'id',store.id);
             },
             changeData:function (e) {
                 var num = e.length;