feat: 新增
This commit is contained in:
parent
dd55b301a8
commit
a6941b8a81
|
@ -8,6 +8,7 @@ use App\Utils\ApiResponseApp;
|
|||
|
||||
|
||||
use App\model\Dictionary;
|
||||
use App\model\Message;
|
||||
use App\model\ExchangeRate;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
use support\Db;
|
||||
|
@ -60,30 +61,37 @@ class CommonController
|
|||
* @Apidoc\Title("1.0 消息根据type 判断类型")
|
||||
* @Apidoc\Url("api/common/messageList")
|
||||
* 3是首页弹窗 1是消息中心
|
||||
* {
|
||||
"data": [
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Announcement",
|
||||
"content": "<p><img src=\"https://112233job.com/uploads/20250120/039faa1fb225ef5814a325218f2e00ee.jpg\" data-filename=\"filename\" style=\"width: 277.516px; height: 275.69px;\"><br></p>",
|
||||
"status": 1,
|
||||
"createtime": 1737370611,
|
||||
"updatetime": 0,
|
||||
"status_text": "Status 1"
|
||||
}
|
||||
],
|
||||
"total": 0
|
||||
}
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function messageList(Request $request){
|
||||
$type=$request->get('type');
|
||||
/**
|
||||
* 返回轮播图
|
||||
*/
|
||||
if($type==5){
|
||||
$type = $request->get('type');
|
||||
$query = Message::query();
|
||||
|
||||
if ($type == 5) {
|
||||
// 大于 type(注意:这里假设你想比较的是 'id' 字段)
|
||||
$query->where('id', '>', $type);
|
||||
}
|
||||
|
||||
if ($type == 3) {
|
||||
// 小于 type(同样假设是 'id' 字段)
|
||||
$query->where('id', '<', $type);
|
||||
}
|
||||
|
||||
if ($type == 1) {
|
||||
// 等于特定值(这里是6)
|
||||
$query->where('id', '=', 6);
|
||||
}
|
||||
|
||||
// 执行查询并获取结果
|
||||
$list = $query->get();
|
||||
var_dump(1111);
|
||||
|
||||
// 准备返回的数据
|
||||
$map = [
|
||||
'data' => $list->toArray(),
|
||||
];
|
||||
|
||||
return ApiResponseApp::success($map);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class Message extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'message';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 221 KiB |
Binary file not shown.
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 186 KiB |
Loading…
Reference in New Issue