zz %!s(int64=5) %!d(string=hai) anos
pai
achega
c3e8c81567

+ 10 - 2
app/Http/Controllers/Wap/User/CoflController.php

@@ -185,14 +185,15 @@ class CoflController extends Controller
 
         $this->statsDetail($user[0],'new_reward_'.$fee,0);
 
-        $get_free_currency = UserBindHkWelfareService::isHasGet($user[0]);
+        $get_free_currency = UserBindHkWelfareService::getByOpenidToken($openid,$token);
         if($get_free_currency){
             //已经领过
             $link = $this->getLink($get_free_currency->distribution_channel_id).'recent?'.http_build_query($params);
             return view('jump.bindHkFreeCurrency',['fee'=>$fee,'url'=>$link,'is_get'=>1,'uid'=>$get_free_currency->uid,'source'=>$source]);
         }else{
             $link = $this->getLink($user[1]).'recent?'.http_build_query($params);
-            $this->getReward($user[0],$fee,$source,$type);
+            //$this->getReward($user[0],$fee,$source,$type,$token);
+            $this->getRewardV2($user[0],$openid,$fee,$type,$source,$token);
             return view('jump.bindHkFreeCurrency',['fee'=>$fee,'url'=>$link,'is_get'=>0,'uid'=>$user[0],'source'=>$source]);
         }
     }
@@ -220,6 +221,13 @@ class CoflController extends Controller
             UserService::addBalance($uid,$fee,0,$fee);
         }
     }
+
+    private function getRewardV2($uid,$openid,$fee,$type,$source,$token){
+        $result = UserBindHkWelfareService::getfreeCurrencyV2($uid,$openid,$fee,$type,$source,$token);
+        if($result){
+            UserService::addBalance($uid,$fee,0,$fee);
+        }
+    }
     public function activity(Request $request){
         $token = $request->get('token');
         if(empty($token)){

+ 1 - 1
app/Modules/User/Models/UserBindHkWelfare.php

@@ -7,5 +7,5 @@ use Illuminate\Database\Eloquent\Model;
 class UserBindHkWelfare extends Model
 {
     protected $table = 'user_bind_hk_welfare';
-    protected $fillable = ['uid','openid','fee','type','source'];
+    protected $fillable = ['uid','openid','fee','type','source','token'];
 }

+ 11 - 0
app/Modules/User/Services/UserBindHkWelfareService.php

@@ -29,6 +29,12 @@ class UserBindHkWelfareService
         return   $result;
     }
 
+    public static function getByOpenidToken($openid,$token){
+        $result = UserBindHkWelfare::where('openid',$openid)->where('token',$token)->select('uid','openid','fee','type','source','token')->first();
+        return $result;
+    }
+
+
     public static function getfreeCurrency($uid,$fee=200,$type='BIND_HK',$source=''){
         if(self::isHasGet($uid)){
             return false;
@@ -47,4 +53,9 @@ class UserBindHkWelfareService
 
         return false;
     }
+
+    //'uid','openid','fee','type','source','token'
+    public static function getfreeCurrencyV2($uid,$openid,$fee,$type,$source,$token){
+        UserBindHkWelfare::create(compact('uid','openid','fee','type','source','token'));
+    }
 }