| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers;
- use app\models\WechatConfig;
- use app\modules\admin\models\WechatConfigForm;
- class WechatConfigController extends BaseController
- {
- /**
- * 获取配置
- */
- public function actionConfig() {
- $form = new WechatConfigForm();
- $form->store_id = get_store_id();
- $form->type = get_params('type');
- return $this->asJson($form->getConfig());
- }
- /**
- * 存储配置
- */
- public function actionSave() {
- $store_id = get_store_id();
- $form = new WechatConfigForm();
- $model = WechatConfig::findOne(['store_id' => $store_id, 'type' => post_params('type')]);
- if (!$model) {
- $model = new WechatConfig();
- }
- $form->store_id = $store_id;
- $form->model = $model;
- $form->attributes = post_params();
- return $this->asJson($form->saveConfig());
- }
- }
|