ConfController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers\jushuitan;
  8. use app\models\Option;
  9. use app\constants\OptionSetting;
  10. use app\modules\admin\models\jushuitan\JuShuiTanForm;
  11. class ConfController extends BaseController
  12. {
  13. public $need_mp = false;
  14. public function actionConf(){
  15. $conf = Option::get(OptionSetting::JU_SHUI_TAN, 0, 'saas')['value'];
  16. if($conf){
  17. $conf = json_decode($conf, true);
  18. }else{
  19. $conf = [
  20. 'app_Key' => '',
  21. 'app_Secret' => '',
  22. ];
  23. }
  24. return $this->asJson([
  25. 'code'=>0,
  26. 'msg'=>'ok',
  27. 'data' => $conf,
  28. 'callbackLink' => \Yii::$app->request->hostInfo . '/index.php/jushuitan/callback',
  29. ]);
  30. }
  31. public function actionConfSave(){
  32. $conf = input_params('conf');
  33. if(!is_array($conf)){
  34. $conf = json_decode($conf, true);
  35. }
  36. Option::set(OptionSetting::JU_SHUI_TAN, json_encode($conf), 0, 'saas');
  37. return $this->asJson([
  38. 'code'=>0,
  39. 'msg'=>'保存成功'
  40. ]);
  41. }
  42. }