فهرست منبع

Merge branch 'master' into stabble

zz 5 سال پیش
والد
کامیت
668dba4cb4

+ 1 - 1
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -195,7 +195,7 @@ class WelcomeController extends BaseController
         }
 
         //用户分割
-        $this->userPproperty($user->openid);
+        $this->userPproperty();
         $month_order_info = $this->monthOrderInfo($user->openid);
         $options = json_encode([
             'distribution_channel_id' => (int)$this->distribution_channel_id,

+ 16 - 2
app/Modules/User/Services/UserDivisionCpcPropertyService.php

@@ -268,7 +268,14 @@ WHERE openid in (SELECT openid FROM users WHERE id = $uid)";
         $result =  UserDivisionCpcPropertyV2::where('openid',$openid)->where('is_enable',1)->select('property')->first();
         if($result)
             return $result->property;
-        return 'none';
+        $sql_format = 'select id,created_at from users WHERE  openid="%s" ORDER by created_at limit 1';
+        $info = DB::select(sprintf($sql_format,$openid));
+        if(!$info) return 'unknown';
+        foreach ($info as $item){
+            if( time()-strtotime($item->created_at) > 3*86400 )
+                return 'none';
+        }
+        return 'unknown';
     }
 
     public static function getUserPropertyV2($uid){
@@ -277,7 +284,14 @@ WHERE openid in (SELECT openid FROM users WHERE id = $uid)";
             ->select('user_division_cpc_property_v2.property')->first();
         if($result)
             return $result->property;
-        return 'none';
+        $sql_format = 'select id,created_at from users WHERE  openid = (select openid FROM users WHERE id=%s) ORDER by created_at limit 1';
+        $info = DB::select(sprintf($sql_format,$uid));
+        if(!$info) return 'unknown';
+        foreach ($info as $item){
+            if( time()-strtotime($item->created_at) > 3*86400 )
+                return 'none';
+        }
+        return 'unknown';
     }
 
     public static function updateV2($openid,$property=''){