feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\model\regional_agent;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Agent extends Model
|
||||
{
|
||||
protected $name = 'shopro_regional_agent';
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
const STATUS_NORMAL = 'normal';
|
||||
const STATUS_PENDING = 'pending';
|
||||
const STATUS_FORBIDDEN = 'forbidden';
|
||||
|
||||
public function scopeNormal($query)
|
||||
{
|
||||
return $query->where('status', self::STATUS_NORMAL);
|
||||
}
|
||||
|
||||
public function scopeAvailable($query)
|
||||
{
|
||||
return $query->where('status', 'in', [self::STATUS_NORMAL]);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\addons\shopro\model\User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function agentLevel()
|
||||
{
|
||||
return $this->belongsTo(Level::class, 'level', 'level');
|
||||
}
|
||||
|
||||
public static function findByArea($areaId, $areaLevel)
|
||||
{
|
||||
return self::available()
|
||||
->where('area_id', $areaId)
|
||||
->where('area_level', $areaLevel)
|
||||
->find();
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户