12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Http\Controllers\Fpdx;
- use App\Http\Controllers\Controller;
- use App\Http\Controllers\Core\Auth;
- use App\Models\User\UserModel;
- use App\Models\Fpdx\SyjUserModel;
- class Syj extends Controller
- {
- /**
- * 检验是否是时遇记用户
- * @param string $phone
- * @return array
- * @throws \Tymon\JWTAuth\Exceptions\JWTException
- */
- public function sync(string $phone)
- {
- $uid = Auth::auth();
- $user = UserModel::find($uid);
- if ($user->phone != $phone) {
- return array(
- 'code' => 400,
- 'message' => "无权限"
- );
- } else {
- $syj = SyjUserModel::where('phone', $phone)->whereNull('bind')->first();
- if (collect($syj)->isEmpty()) {
- return array(
- 'code' => 202,
- 'message' => '无用户信息'
- );
- } else {
- $syj->bind = $uid;
- $syj->save();
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $syj
- );
- }
- }
- }
- }
|