| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\pospal;
- use app\models\Option;
- use app\constants\OptionSetting;
- class ConfController extends BaseController
- {
- public $need_mp = false;
- public function actionConf(){
- $conf = Option::get(OptionSetting::POSPAL, get_store_id(), 'store')['value'];
- if($conf){
- $conf = json_decode($conf, true);
- }else{
- $conf = [
- 'app_id' => '',
- 'app_key' => '',
- 'api_host' => 'https://area11-win.pospal.cn:443',
- ];
- }
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'ok',
- 'data' => $conf,
- 'crontabLink' => \Yii::$app->request->hostInfo . '/index.php?r=common/task/yinbao-sync-orders',
- ]);
- }
- public function actionConfSave(){
- $conf = input_params('conf');
- if(!is_array($conf)){
- $conf = json_decode($conf, true);
- }
- $conf['api_host'] = trim($conf['api_host'], '/');
- Option::set(OptionSetting::POSPAL, json_encode($conf), get_store_id(), 'store');
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'保存成功'
- ]);
- }
- }
|