1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- /**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2019/7/4
- * Time: 16:52
- */
- namespace App\Modules\User\Services;
- use App\Modules\User\Models\UserBindPhone;
- class UserBindPhoneService
- {
- public static function bindInfo($uid)
- {
- $model = new UserBindPhone();
- return $model->join('users','users.openid','=','user_bind_phone.openid')
- ->select('user_bind_phone.uid','user_bind_phone.phone')
- ->where('users.id',$uid)
- ->first();
- }
- public static function bind($uid,$openid,$phone,$from){
- $model = new UserBindPhone();
- $info = $model->where('phone',$phone)->select('id')->first();
- if($info){
- return -1;
- }
- $info2 = $model->where('openid',$openid)->select('id')->first();
- if($info2){
- return -2;
- }
- $model->uid = $uid;
- $model->openid = $openid;
- $model->phone = $phone;
- $model->from = $from;
- $model->save();
- return 0;
- }
- }
|