| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\wechat_mp;
- use app\models\Option;
- use app\constants\OptionSetting;
- class ConfController extends BaseController
- {
- public $need_mp = false;
- public function actionConf(){
- $conf = Option::get(OptionSetting::WECHAT_MP, 0, 'saas')['value'];
- if($conf){
- $conf = json_decode($conf, true);
- }else{
- $conf = [
- 'app_id' => '',
- 'secret' => '',
- 'token' => '',
- 'aes_key' => '',
- ];
- }
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'ok',
- 'data' => $conf,
- 'callback' => \Yii::$app->request->hostInfo . '/index.php/wechat_mp/push',
- ]);
- }
- public function actionConfSave(){
- $conf = input_params('conf');
- if(!is_array($conf)){
- $conf = json_decode($conf, true);
- }
- Option::set(OptionSetting::WECHAT_MP, json_encode($conf), 0, 'saas');
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'保存成功'
- ]);
- }
- }
|