You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.5 KiB

<?php
namespace backend\modules\wx_public_account\controllers;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use backend\modules\wx_public_account\models\ars\WxPublicAccountConfig;
use backend\modules\wx_public_account\logic\PublicAccountManager;
/**
* PublicAccountController manage WeChat public account platform.
*/
class PublicAccountController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all AfterSale models.
* @return mixed
* @throws \yii\web\ServerErrorHttpException
*/
public function actionCustomMenu()
{
$wxPublicAccountConfig = WxPublicAccountConfig::find()->one();
if (Yii::$app->request->isPost) {
Yii::$app->response->format = 'json';
$data = Yii::$app->request->post('data');
$res = PublicAccountManager::dealCustomMenuData($data, $wxPublicAccountConfig);
if ($res) {
return ['status' => true];
} else {
return ['status' => false, 'info' => $res['info']];
}
}
return $this->render('custom_menu', [
'customPageList' => [],
'data' => $wxPublicAccountConfig->menu_setting ?: '[]'
]);
}
}