feat : login wx

This commit is contained in:
2024-11-11 17:04:10 +08:00
parent 83a38d5001
commit 3a5739ee19
20 changed files with 844 additions and 4 deletions

51
app/Model/User.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property string $mobile
* @property string $nickname
* @property string $password
* @property string $salt
* @property int $avatar_id
* @property int $gender
* @property int $age
* @property string $birthday
* @property int $city
* @property string $token
* @property string $last_ip
* @property string $reg_ip
* @property string $last_time
* @property string $create_time
* @property string $update_time
* @property int $is_del
*/
class User extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'user';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'avatar_id' => 'integer', 'gender' => 'integer', 'age' => 'integer', 'city' => 'integer', 'is_del' => 'integer'];
const CREATED_AT = 'create_time';
const UPDATED_AT = 'update_time';
}

43
app/Model/UserThird.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property int $user_id
* @property string $open_id
* @property int $type
* @property string $union_id
*/
class UserThird extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'user_third';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'type' => 'integer'];
/**
* @param string $openId
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getThirdInfoByOpenId(string $openId): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('open_id', $openId)->first();
}
}