UserBindPhoneService.php 718 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2019/7/4
  6. * Time: 16:52
  7. */
  8. namespace App\Modules\User\Services;
  9. use App\Modules\User\Models\UserBindPhone;
  10. class UserBindPhoneService
  11. {
  12. public static function bindInfo($uid)
  13. {
  14. $model = new UserBindPhone();
  15. return $model->join('users','users.openid','=','user_bind_phone.openid')
  16. ->select('user_bind_phone.uid','user_bind_phone.phone')
  17. ->where('users.id',$uid)
  18. ->first();
  19. }
  20. public static function bind($uid,$openid,$phone){
  21. $model = new UserBindPhone();
  22. $model->uid = $uid;
  23. $model->openid = $openid;
  24. $model->phone = $phone;
  25. $model->save();
  26. }
  27. }