diff --git a/common/models/common/Addons.php b/common/models/common/Addons.php index a58e4b855..55e7cd27e 100644 --- a/common/models/common/Addons.php +++ b/common/models/common/Addons.php @@ -55,7 +55,7 @@ public function rules() [['name', 'title', 'group', 'version', 'author'], 'required'], ['name', 'match', 'pattern' => '/^[_a-zA-Z]+$/', 'message' => '标识由英文和下划线组成'], [ - ['is_setting', 'is_rule', 'status', 'created_at', 'updated_at'], + ['is_setting', 'is_merchant_route_map', 'is_rule', 'status', 'created_at', 'updated_at'], 'integer', ], [['title', 'group', 'version'], 'string', 'max' => 20], @@ -89,6 +89,7 @@ public function attributeLabels() 'is_rule' => '嵌入规则', 'is_setting' => '全局设置项', 'is_mini_program' => 'Api/小程序', + 'is_merchant_route_map' => '商户映射', 'bootstrap' => '启动', 'console' => '控制台', 'default_config' => '默认配置', diff --git a/services/merchant/BankAccountService.php b/services/merchant/BankAccountService.php deleted file mode 100644 index 96f659523..000000000 --- a/services/merchant/BankAccountService.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ -class BankAccountService extends Service -{ - /** - * 获取默认地址 - * - * @param $member_id - * @return array|null|\yii\db\ActiveRecord|BankAccount - */ - public function findDefault() - { - return BankAccount::find() - ->where([ - 'status' => StatusEnum::ENABLED, - 'is_default' => StatusEnum::ENABLED, - 'merchant_id' => $this->getMerchantId() - ]) - ->one(); - } - - /** - * @param $id - * @param $member_id - * @return array|null|\yii\db\ActiveRecord - */ - public function findById($id) - { - return BankAccount::find() - ->where(['id' => $id, 'status' => StatusEnum::ENABLED]) - ->andWhere(['merchant_id' => $this->getMerchantId()]) - ->one(); - } - - public function getMapList() - { - $model = $this->findIdentity(); - $map = []; - - foreach ($model as $item) { - $tmp = []; - $tmp[] = $item['account_type_name']; - $tmp[] = $item['realname']; - $tmp[] = $item['mobile']; - if ($item['account_type'] == AccountTypeEnum::ALI) { - $tmp[] = $item['ali_number']; - } - - if ($item['account_type'] == AccountTypeEnum::UNION) { - $tmp[] = $item['branch_bank_name']; - $tmp[] = $item['account_number']; - } - - $map[$item['id']] = implode("\r", $tmp); - } - - return $map; - } - - /** - * @param $member_id - * @return array|\yii\db\ActiveRecord[] - */ - public function findIdentity() - { - return BankAccount::find() - ->where(['status' => StatusEnum::ENABLED]) - ->andWhere(['merchant_id' => $this->getMerchantId()]) - ->asArray() - ->all(); - } -} \ No newline at end of file diff --git a/services/merchant/CommissionWithdrawService.php b/services/merchant/CommissionWithdrawService.php deleted file mode 100644 index aa53e8c97..000000000 --- a/services/merchant/CommissionWithdrawService.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class CommissionWithdrawService extends Service -{ - /** - * @param $id - * @return array|\yii\db\ActiveRecord|null|CommissionWithdraw - */ - public function findById($id) - { - return CommissionWithdraw::find() - ->where(['id' => $id]) - ->andFilterWhere(['merchant_id' => $this->getMerchantId()]) - ->one(); - } -} \ No newline at end of file diff --git a/services/rbac/AuthRoleService.php b/services/rbac/AuthRoleService.php index e2fb304d6..193968172 100644 --- a/services/rbac/AuthRoleService.php +++ b/services/rbac/AuthRoleService.php @@ -9,6 +9,7 @@ use common\helpers\ArrayHelper; use common\helpers\TreeHelper; use common\models\rbac\AuthRole; +use common\enums\AppEnum; use yii\web\UnauthorizedHttpException; /** @@ -45,11 +46,16 @@ public function getRole() throw new UnauthorizedHttpException('未授权角色,请联系管理员'); } + $merchant_id = $this->getMerchantId(); + if (Yii::$app->id == AppEnum::BACKEND) { + $merchant_id = ''; + } + $assignment = ArrayHelper::toArray($assignment); $this->roles = AuthRole::find() ->where(['id' => $assignment['role_id']]) ->andWhere(['status' => StatusEnum::ENABLED]) - ->andFilterWhere(['merchant_id' => $this->getMerchantId()]) + ->andFilterWhere(['merchant_id' => $merchant_id]) ->asArray() ->one();