123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace backend\server;
- use Yii;
- use common\models\Vr;
- class Vrserver
- {
- //数据列表
- public function getList()
- {
- $input = Yii::$app->request->post();
- $model = new Vr();
- $data = $model->getList($input);
- if (!empty($data['data'])) {
- foreach ($data['data'] as &$val) {
- $val['img'] = Yii::$app->params['httpImg']['host'] . Yii::$app->params['httpImg']['video'] . $val['img'];
- $val['create_at'] = date('Y-m-d H:i:s', $val['create_at']);
- }
- }
- return $data;
- }
- //数据设置
- public function vrSet()
- {
- $input = Yii::$app->request->post();
- $row = Vr::findOne($input['id']);
- switch ($input['code']) {
- case 'del':
- if ($row->delete()) {
- return true;
- }
- break;
- case 'sort':
- $row->sort = $input['val'];
- if ($row->update(false)) {
- return true;
- }
- break;
- case 'state':
- $row->state = $input['val'];
- if ($row->update(false)) {
- return true;
- }
- break;
- }
- return false;
- }
- }
|