|
|
@ -18,6 +18,7 @@ use app\store\service\Auth as AuthService; |
|
|
|
use app\common\service\store\User as StoreUserService; |
|
|
|
use app\common\service\store\User as StoreUserService; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use app\common\model\Merchant as MerchantModel; |
|
|
|
use app\common\model\Merchant as MerchantModel; |
|
|
|
|
|
|
|
use app\api\model\Store as StoreModel; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 商户后台控制器基类 |
|
|
|
* 商户后台控制器基类 |
|
|
@ -32,6 +33,8 @@ class Controller extends BaseController |
|
|
|
// 当前商城ID |
|
|
|
// 当前商城ID |
|
|
|
protected int $storeId; |
|
|
|
protected int $storeId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $storeInfo; |
|
|
|
|
|
|
|
|
|
|
|
// 当前商户ID |
|
|
|
// 当前商户ID |
|
|
|
protected int $merchantId = 0; |
|
|
|
protected int $merchantId = 0; |
|
|
|
|
|
|
|
|
|
|
@ -84,6 +87,8 @@ class Controller extends BaseController |
|
|
|
$this->checkMethodRules(); |
|
|
|
$this->checkMethodRules(); |
|
|
|
|
|
|
|
|
|
|
|
$this->getMerchantId(); |
|
|
|
$this->getMerchantId(); |
|
|
|
|
|
|
|
// 验证当前商城状态 |
|
|
|
|
|
|
|
$this->checkStore(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -188,4 +193,27 @@ class Controller extends BaseController |
|
|
|
} |
|
|
|
} |
|
|
|
throwError('illegal request method'); |
|
|
|
throwError('illegal request method'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 验证当前商城状态 |
|
|
|
|
|
|
|
* @return void |
|
|
|
|
|
|
|
* @throws BaseException |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private function checkStore(): void |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 获取当前商城信息 |
|
|
|
|
|
|
|
$store = StoreModel::detail($this->storeId); |
|
|
|
|
|
|
|
if (empty($store)) { |
|
|
|
|
|
|
|
throwError('很抱歉,当前商城信息不存在'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($store['is_recycle'] || $store['is_delete']) { |
|
|
|
|
|
|
|
throwError('很抱歉,当前商城已删除'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if($store['effective_time']<time()){ |
|
|
|
|
|
|
|
throwError('很抱歉,当前商城已过期'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$this->storeInfo = $store; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|