Files
xk-api-yii/member/modules/v1/controllers/OtherController.php

115 lines
2.8 KiB
PHP

<?php
namespace member\modules\v1\controllers;
use common\core\BaseAppController;
use common\models\oldDb\BaseConfig;
use common\models\oldDb\SystemConfig;
use yii\db\Exception;
/**
* @doc-module 设置
*/
class OtherController extends BaseAppController
{
public $optional = ['xcx-version'];
/**
* @doc-name 隐私保护政策
* @doc-param int store_id 门店id
* @doc-return mixed @BaseConfig{*} 信息
*/
function actionPolicy()
{
$post=\Yii::$app->request->post();
$BaseConfig=BaseConfig::find()->where([
'type'=>2,
'end'=>1,
'status'=>0
])->one();
if (!$BaseConfig) throw new Exception('不存在有关信息');
return $BaseConfig;
}
/**
* @doc-name 客服热线
* @doc-return string text 标题
* @doc-return string msg 电话
*/
function actionServiceLine()
{
$post=\Yii::$app->request->post();
$this->requestValidate($post,[
[ 'store_id','required']
]);
switch ($post['store_id']){
case 11001:
return [
'text'=>'客服热线',
'msg'=>'13429684168'
];
default:
return [
'text'=>'客服热线',
'msg'=>'13429684168'
];
}
}
/**
* @doc-name 服务协议或隐私政策或挂号须知
* @doc-param int type 类型1服务协议2隐私政策3挂号须知4知情同意书
* @doc-return mixed @BaseConfig{*} 信息
*/
public function actionService()
{
$get=\Yii::$app->request->get();
$this->requestValidate($get, [
['type', 'required','message'=>'类型不能为空']
]);
$BaseConfig=BaseConfig::find()->where([
'type'=>$get['type'],
'end'=>1,
'status'=>0
])->one();
if (!$BaseConfig) throw new Exception('不存在有关信息');
return $BaseConfig;
}
/**
* 关于我们
*/
public function actionAboutUs()
{
$post = \Yii::$app->request->post();
$this->requestValidate($post, [
['store_id', 'required']
]);
$BaseConfig = BaseConfig::find()->where([
'store_id' => $post['store_id'],
'type' => 1,
'end' => 1,
])->andWhere(['like','desc','关于我们'])->one();
if (!$BaseConfig) throw new Exception('不存在有关信息');
return $BaseConfig;
}
/**
* 查询小程序版本
*/
public function actionXcxVersion(){
$systemConfig=SystemConfig::find()->select('value')->where([
'config_type'=>3,
])->one();
return $systemConfig;
}
}