修补api/gm接口的几处错误

This commit is contained in:
2025-07-16 03:12:35 +08:00
parent d76625fb34
commit 974cc83476
9 changed files with 80 additions and 29 deletions
@@ -21,7 +21,7 @@
$apis = [
'list'=>'城市列表',
];
$this->result('您正使用CMTS-GM系统车主管理接口!', $apis, 200);
$this->result('您正使用CMTS-GM系统城市管理接口!', $apis, 200);
}
public function actionList()
@@ -31,6 +31,7 @@
class JiaocheController extends Common
{
private $addtionWhere;
public function beforeAction($action)
{
if (!$this->pid) {
@@ -36,10 +36,13 @@ class NewsController extends Common
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$news = [];
foreach ($res as $v) {
$news[] = $v->toArray();
}
$data= [
'total'=>intval($s['query']->count()),
'news' => $res,
'news' => $news,
'page'=>$this->page
];
$this->result('文章查询成功!', $data, 200);
@@ -5,7 +5,7 @@ use addons\models\AcNewsCat;
use Yii;
use yii\data\Pagination;
class NewsCatController extends Common
class NewscatController extends Common
{
public function beforeAction($action)
{
@@ -37,10 +37,13 @@ class NewsCatController extends Common
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$cats = [];
foreach ($res as $v) {
$cats[$v->id] = $v->toArray();
}
$data= [
'total'=>intval($s['query']->count()),
'cats' => $res,
'cats' => $cats,
'page'=>$this->page
];
$this->result('文章分类查询成功!', $data, 200);
+32 -10
View File
@@ -36,10 +36,10 @@ class NoticeController extends Common
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$notices = $this->formatList($res);
$data= [
'total'=>intval($s['query']->count()),
'news' => $res,
'notices' => $notices,
'page'=>$this->page
];
$this->result('通知查询成功!', $data, 200);
@@ -58,7 +58,7 @@ class NoticeController extends Common
if($sn) $res->sn = $sn;
$res->save();
}
$this->result('文章信息查询完成', $res->toArray(), 200);
$this->result('通知信息查询完成', $res->toArray(), 200);
}
public function actionAdd()
@@ -133,20 +133,20 @@ class NoticeController extends Common
$detail->is_show = 0;
$res = $detail->save();
if ($res) {
$msg = '文章隐藏标记成功';
$msg = '通知隐藏标记成功';
$errorCode = 200;
} else {
$msg = '文章隐藏标记失败';
$msg = '通知隐藏标记失败';
}
break;
case 'show':
$detail->is_show = 1;
$res = $detail->save();
if ($res) {
$msg = '文章显示标记成功';
$msg = '通知显示标记成功';
$errorCode = 200;
} else {
$msg = '文章显示标记失败';
$msg = '通知显示标记失败';
}
break;
default:
@@ -176,9 +176,11 @@ class NoticeController extends Common
$data = $data->andwhere($where2);
}
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $this->pageSize]);
$res = $data->offset($pages->offset)->limit($pages->limit)->orderBy('order_by DESC')->all();
return ['res'=>$res,'query'=>$data];
$query = $data->offset($pages->offset)->limit($pages->limit);
//->orderBy('order_by DESC')
$res = $query->all();
$arr = $query->asArray()->all();
return ['res'=>$res,'query'=>$data,'arr'=>$arr];
}
/*
@@ -266,4 +268,24 @@ class NoticeController extends Common
return $data;
}
private function formatList($res)
{
$unsets = ['pid','create_at','deleted'];
$list = [];
foreach ($res as $s) {
$s = $s->toArray();
foreach ($unsets as $us) {
unset($s[$us]);
}
$weekdays = [0=>'日',1=>'一',2=>'二',3=>'三',4=>'四',5=>'五',6=>'六'];
$wk = date('w', $s['update_at']);
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期'.$weekdays[$wk];
$list[] = $s;
}
unset($s);
return $list;
}
}
+23 -11
View File
@@ -690,6 +690,15 @@
$search['is_commission'] = (int)$search['is_commission'];
$where[] = ['=', 'is_commission', $search['is_commission']];
}
//是否验车 TD:查询结果异常,待
if (isset($search['is_check'])) {
$search['is_check'] = (int)$search['is_check'];
if($search['is_check']){
$where[] = ['<>', 'checker', ''];
}else{
$where[] = ['=', 'checker', ''];
}
}
//运单是否通过了财务确认
$search['is_cwqr'] = $search['is_cwqr'] ?? ($get['is_cwqr'] ?? '');
if ($search['is_cwqr'] != '') {
@@ -1113,16 +1122,18 @@
{
$detail = $order->toArray();
$model = new Fans();
$fans = $model->findOne($detail['from_mid']);
$user = $fans->toArray();
$model = new AcFansExt();
$_exts = $model->find()->where(['mid' => $detail['from_mid'],'mobile'=>$fans->mobile, 'pid' => $this->pid, 'deleted' => 0])->indexBy('id')->all();
foreach ($_exts as $ext) {
$ext = $ext->toArray();
$user[$ext['key']] = $ext['value'];
if($detail['from_mid']){
$model = new Fans();
$fans = $model->findOne($detail['from_mid']);
$user = $fans->toArray();
$model = new AcFansExt();
$_exts = $model->find()->where(['mid' => $detail['from_mid'],'mobile'=>$fans->mobile, 'pid' => $this->pid, 'deleted' => 0])->indexBy('id')->all();
foreach ($_exts as $ext) {
$ext = $ext->toArray();
$user[$ext['key']] = $ext['value'];
}
$detail['_user'] = $user;
}
$detail['_user'] = $user;
if ($detail['store_id']) {
$model = new AcStore();
@@ -1180,7 +1191,7 @@
$detail['sn'] = $detail['sn'] ? $detail['sn'] : $sn;
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
$wk = date('w', $detail['date']);
$wk = date('w', $detail['sign_date']);
$detail['signdate'] = date('Y-m-d 星期' . $weekdays[$wk], $detail['sign_date']);
$detail['from_province'] = isset($detail['start_province']) ? Yii::$app->params['regionAreas'][$detail['start_province']] : '';
$detail['to_province'] = isset($detail['aim_province']) ? Yii::$app->params['regionAreas'][$detail['aim_province']] : '';
@@ -1193,7 +1204,8 @@
$detail[$k] = $detail[$k] ? $detail[$k] : '/pics/nopic.jpg';
$url_pre = substr($detail[$k], 0, 4);
if ($url_pre == '/pic') {
$detail[$k . '_url'] = Url::to('@upload' . $detail[$k], $this->imgHttp);
// $detail[$k . '_url'] = Url::to('@upload' . $detail[$k], $this->imgHttp);
$detail[$k . '_url'] = Yii::$app->params['mainDomain'] .'/'.$imgDir. $detail[$k];
} else if ($url_pre == 'http') {
$detail[$k . '_url'] = $detail[$k];
}
@@ -38,9 +38,13 @@
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$stores = [];
foreach ($res as $v) {
$stores[] = $v->toArray();
}
$data= [
'total'=>$s['query']->count(),
'stores' => $res,
'stores' => $stores,
'page'=>$this->page
];
$this->result('网点列表查询成功!', $data, 200);
@@ -180,6 +184,7 @@
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $this->pageSize]);
$_orderby = 'order_by DESC';
$res = $data->offset($pages->offset)->limit($pages->limit)->orderBy($_orderby)->all();
return ['res'=>$res,'query'=>$data];
}
@@ -42,10 +42,14 @@
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$weituoren = [];
foreach ($res as $key=>$val) {
$weituoren[$key] = $val->toArray();
}
$data= [
'total'=>$s['query']->count(),
'weituoren' => $res,
'weituoren' => $weituoren,
'page'=>$this->page
];
$this->result('合作单位查询成功!', $data, 200);