42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Models\business;
|
|||
|
|
|
|||
|
|
use App\BaseApp\BaseBusinessModel;
|
|||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 小程序用户(cc_wx_user)
|
|||
|
|
*
|
|||
|
|
* is_p 代理商 / pid 上级代理商 / price_number 价格倍率 / show_price 价格是否可见 /
|
|||
|
|
* template_code 经销商专属装修模板(空=跟随品牌默认)。
|
|||
|
|
* session_key 是微信会话密钥,只能留在服务端,任何接口都不要把它输出出去。
|
|||
|
|
*/
|
|||
|
|
class WxUserModel extends BaseBusinessModel
|
|||
|
|
{
|
|||
|
|
protected $table = 'wx_user';
|
|||
|
|
|
|||
|
|
protected $guarded = [];
|
|||
|
|
|
|||
|
|
protected $hidden = ['session_key'];
|
|||
|
|
|
|||
|
|
public function enterprise(): BelongsTo
|
|||
|
|
{
|
|||
|
|
return $this->belongsTo(EnterpriseModel::class, 'enterprise_id', 'id');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 该代理商名下的下级用户
|
|||
|
|
*/
|
|||
|
|
public function children(): HasMany
|
|||
|
|
{
|
|||
|
|
return $this->hasMany(self::class, 'pid', 'id');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public function parent(): BelongsTo
|
|||
|
|
{
|
|||
|
|
return $this->belongsTo(self::class, 'pid', 'id');
|
|||
|
|
}
|
|||
|
|
}
|