| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace ghs\controllers;
- use biz\item\classes\PtItemClass;
- use bizGhs\item\classes\ItemClass;
- use common\components\imgUtil;
- use common\components\stringUtil;
- use common\components\util;
- use Yii;
- class PtItemController extends BaseController
- {
- //官方认证修改 ssh 20231125
- public function actionChangeAuth()
- {
- $id = Yii::$app->request->get('id', 0);
- $item = PtItemClass::getById($id, true);
- if (empty($item)) {
- util::fail('没有找到花材');
- }
- if (getenv('YII_ENV') == 'production') {
- if ($this->adminId != 4) {
- util::fail('请管理员操作');
- }
- } else {
- if ($this->adminId != 919) {
- util::fail('请管理员操作');
- }
- }
- $newAuth = $item->auth == 0 ? 1 : 0;
- $item->auth = $newAuth;
- $item->save();
- ItemClass::updateByCondition(['itemId' => $id], ['auth' => $newAuth]);
- util::complete('修改成功');
- }
- //获取平台里的花材列表
- public function actionList()
- {
- $name = Yii::$app->request->get('name', '');
- $search = Yii::$app->request->get('search', '');
- if (empty($name)) {
- $name = $search;
- }
- $where = [];
- if (!empty($name)) {
- if (stringUtil::isLetter($name)) {
- $where['py'] = ['like', $name];
- } else {
- $where['name'] = ['like', $name];
- }
- }
- $classId = Yii::$app->request->get('classId', 0);
- if (!empty($classId)) {
- $where['classId'] = $classId;
- }
- //没有删除的花材
- $where['delStatus'] = 0;
- $list = PtItemClass::getItemList($where, true, $this->mainId);
- util::success($list);
- }
- //获取平台花材详情 ssh 20210826
- public function actionDetail()
- {
- $id = Yii::$app->request->get('id', 0);
- $info = PtItemClass::getById($id);
- if (empty($info)) {
- util::fail('没有找到花材');
- }
- $shortCover = $info['cover'] ?? '';
- $info['shortCover'] = $shortCover;
- $info['cover'] = imgUtil::groupImg($shortCover);
- $info['bigCover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- $info['smallCover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
- util::success($info);
- }
- }
|