Initial commit,修正

This commit is contained in:
2025-07-13 19:37:38 +08:00
parent 38ce288e27
commit 65bbd06981
12384 changed files with 3985464 additions and 8 deletions
+98
View File
@@ -0,0 +1,98 @@
<?php
# @Author: 嗨噜客(三亚) <fm453>
# @Date: 2022-05-22T07:37:06+08:00
# @Email: fm453@lukegzs.com
# @Last modified by: fm453
# @Last modified time: 2022-10-23T11:51:39+08:00
# @Copyright: www.hiluker.cn
namespace backend\controllers;
use Yii;
use yii\data\Pagination;
use yii\helpers\Url;
use addons\models\AcWeituoren;
use common\models\Member as User;
use addons\models\AcUserExt;
class WeituorenController extends Common
{
public function beforeAction($action)
{
if (!$this->pid) {
// $this->result('您正使用本系统内部接口,禁止非法链接使用!');
}
return parent::beforeAction($action);
}
public function actionIndex()
{
$apis = [
'list'=>'搜索委托单位清单',
'detail'=>'委托单位详情'
];
$this->result('您正使用CMTS系统委托单位管理接口!', $apis, 200);
}
//列表
public function actionList()
{
$pid = $this->pid;
$return = [];
$model = new AcWeituoren();
$where = $where2 = [];
$where2[]='and';
$where['pid'] = $pid;
$post = $this->postdata;
$search = isset($post['search']) ? $post['search'] : null;
if (!$search) {
$search = [];
}
$search['title'] = isset($search['title']) ? trim(htmlspecialchars_decode($search['title'])) : '';
if (!empty($search['title'])) {
$where2[] = ['LIKE','company',$search['title']];
}
$where['deleted'] = 0;
$data = $model->find()->asArray()->where($where); //asArray() 放在find后,可让查询结果以数组形式呈现
if ($search['title']) {
$data = $data->andwhere($where2);
}
$page = $this->page;
$pageSize = $this->pageSize;
$pages = new Pagination(['totalCount' =>$data->count(), 'pageSize' => $pageSize]);
$pages->setPage($page-1, true); //设置分页的当前页面值
$_orderby = 'orderby DESC,id ASC';
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
if (!$res) {
$this->result('没有符合条件的结果');
}
$status = Yii::$app->params['CommonStatus'];
$return['code'] = 200;
$return['msg'] = '委托单位查询成功!';
$return['data']= ['total'=>$data->count(),
'data'=>[
'weituoren' => $res
],
'page'=>$this->page];
exit(json_encode($return, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT));
}
public function actionDetail()
{
$pid = $this->pid;
$post = $this->postdata;
$id = isset($post['id']) ? $post['id'] : 0;
if ($id<=0) {
$this->result('查询参数错误!');
}
$model = new AcWeituoren();
$weituo = $model->findOne($id);
$detail = $weituo->toArray();
$this->result('查询成功!', $detail, 200);
}
}