diff --git a/app/common/model/PaymentTemplate.php b/app/common/model/PaymentTemplate.php index 6d88ac6f..f1a28a05 100644 --- a/app/common/model/PaymentTemplate.php +++ b/app/common/model/PaymentTemplate.php @@ -110,9 +110,15 @@ class PaymentTemplate extends BaseModel * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getAll() + public function getAll($merchantId = 0) { - return $this->where('is_delete', '=', 0) + $where = [ + ['is_delete', '=', 0], + ]; + if (isset($merchantId) && $merchantId) { + $where[] = ['merchant_id', '=', $merchantId]; + } + return $this->where($where) ->order(['sort' => 'asc', $this->getPk()]) ->select(); } diff --git a/app/store/controller/setting/payment/Template.php b/app/store/controller/setting/payment/Template.php index 1cbd5cd1..dec07850 100644 --- a/app/store/controller/setting/payment/Template.php +++ b/app/store/controller/setting/payment/Template.php @@ -45,7 +45,7 @@ class Template extends Controller public function all(): Json { $model = new PaymentTemplateModel; - $list = $model->getAll(); + $list = $model->getAll($this->merchantId); return $this->renderSuccess(compact('list')); }