| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace pt\controllers;
- use biz\cp\classes\PtCpClass;
- use common\components\stringUtil;
- use common\components\util;
- use Yii;
- class PtCpController extends BaseController
- {
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $classId = $get['classId'] ?? 0;
- $search = $get['search'] ?? '';
- $classStyle = $get['classStyle'] ?? -1;
- $where = [];
- if ($classStyle == 0) {
- $where['classId'] = 0;
- } else {
- if (!empty($classId) && is_numeric($classId)) {
- $where['classId'] = $classId;
- }
- }
- if (!empty($search)) {
- if (stringUtil::isLetter($search)) {
- $where['py'] = ['like', $search];
- } else {
- $where['name'] = ['like', $search];
- }
- }
- $respond = PtCpClass::getCpList($where);
- util::success($respond);
- }
- //添加产品 ssh 20240119
- public function actionAddCp()
- {
- $post = Yii::$app->request->post();
- PtCpClass::addCp($post);
- util::complete('添加成功');
- }
- //修改产品 ssh 20240119
- public function actionUpdateCp()
- {
- $post = Yii::$app->request->post();
- PtCpClass::updateCp($post);
- util::complete('修改成功');
- }
- }
|