分享链接用户信息
Showing
2 changed files
with
23 additions
and
2 deletions
... | @@ -95,3 +95,15 @@ if (!function_exists('crc64')) { | ... | @@ -95,3 +95,15 @@ if (!function_exists('crc64')) { |
95 | return sprintf($format, $crc); | 95 | return sprintf($format, $crc); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | |||
99 | if (!function_exists('getToken')) { | ||
100 | /** | ||
101 | * @param $key | ||
102 | * @return void | ||
103 | */ | ||
104 | function getToken($key){ | ||
105 | $key = mt_rand(); | ||
106 | $hash = hash_hmac("sha1", $v . mt_rand() . time(), $key, true); | ||
107 | $token = str_replace('=', '', strtr(base64_encode($hash), '+/', '-_')); | ||
108 | } | ||
109 | } | ... | ... |
... | @@ -4,6 +4,7 @@ namespace App\Services; | ... | @@ -4,6 +4,7 @@ namespace App\Services; |
4 | 4 | ||
5 | use App\Helper\CosHelper; | 5 | use App\Helper\CosHelper; |
6 | use App\Helper\ErrorCode; | 6 | use App\Helper\ErrorCode; |
7 | use App\Helper\RedisClient; | ||
7 | use App\Helper\Response; | 8 | use App\Helper\Response; |
8 | use App\Models\Legal\Contract; | 9 | use App\Models\Legal\Contract; |
9 | use App\Models\Legal\PropertyShare; | 10 | use App\Models\Legal\PropertyShare; |
... | @@ -135,7 +136,7 @@ class PropertyTrackService extends Service | ... | @@ -135,7 +136,7 @@ class PropertyTrackService extends Service |
135 | 'share_url_hash'=> $share_url_hash, | 136 | 'share_url_hash'=> $share_url_hash, |
136 | 'expire_time' => date('Y-m-d H:i:s', $expire_time), | 137 | 'expire_time' => date('Y-m-d H:i:s', $expire_time), |
137 | 'from' => $this->request->input('from'), | 138 | 'from' => $this->request->input('from'), |
138 | 'user_id' => $this->request->input('user_id'), //用户 | 139 | 'user_id' => $this->request->input('from') ? $this->request->get('identifier')->company_id : $this->request->input('user_id'), //用户 |
139 | 'created_at' => $this->now, | 140 | 'created_at' => $this->now, |
140 | ])) { | 141 | ])) { |
141 | return Response::success(['url'=>$share]); | 142 | return Response::success(['url'=>$share]); |
... | @@ -145,7 +146,7 @@ class PropertyTrackService extends Service | ... | @@ -145,7 +146,7 @@ class PropertyTrackService extends Service |
145 | } | 146 | } |
146 | 147 | ||
147 | /** | 148 | /** |
148 | * @return \Illuminate\Http\JsonResponse | 149 | * @return \Illuminate\Http\JsonResponse|mixed |
149 | */ | 150 | */ |
150 | public function shareUser() | 151 | public function shareUser() |
151 | { | 152 | { |
... | @@ -179,7 +180,15 @@ class PropertyTrackService extends Service | ... | @@ -179,7 +180,15 @@ class PropertyTrackService extends Service |
179 | } | 180 | } |
180 | 181 | ||
181 | //验证成功 - 生成token | 182 | //验证成功 - 生成token |
183 | $info = [ | ||
184 | 'track_id' => $res->pf_id, | ||
185 | 'id' => $res->id, | ||
186 | ]; | ||
187 | |||
188 | $token = getToken(mt_rand()); | ||
189 | |||
182 | 190 | ||
191 | RedisClient::instance()->set(""); | ||
183 | 192 | ||
184 | return Response::success(); | 193 | return Response::success(); |
185 | } | 194 | } | ... | ... |
-
Please register or sign in to post a comment