|
@@ -0,0 +1,37 @@
|
|
|
+<?php
|
|
|
+/**
|
|
|
+ * Created by PhpStorm.
|
|
|
+ * User: z-yang
|
|
|
+ * Date: 2019/4/11
|
|
|
+ * Time: 15:05
|
|
|
+ */
|
|
|
+
|
|
|
+namespace App\Modules\User\Services;
|
|
|
+
|
|
|
+
|
|
|
+use App\Modules\User\Models\UserBindHkWelfare;
|
|
|
+
|
|
|
+class UserBindHkWelfareService
|
|
|
+{
|
|
|
+ public static function isHasGet($uid){
|
|
|
+ $result = UserBindHkWelfare::join('users','users.openid','=','user_bind_hk_welfare.openid')
|
|
|
+ ->where('users.id',$uid)
|
|
|
+ ->select('user_bind_hk_welfare.id','user_bind_hk_welfare.fee','users.distribution_channel_id')
|
|
|
+ ->first();
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getfreeCurrency($uid,$fee=200){
|
|
|
+ if(self::isHasGet($uid)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $user = UserService::getById($uid);
|
|
|
+ UserBindHkWelfare::create([
|
|
|
+ 'uid'=>$uid,
|
|
|
+ 'openid'=>$user->openid,
|
|
|
+ 'fee'=>$fee,
|
|
|
+ 'type'=>'BIND_HK'
|
|
|
+ ]);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|