You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class LiuYanController
|
|
{
|
|
public function Mp_Create(){
|
|
$info = request('info');
|
|
if(empty($info['content'])){
|
|
return \Yz::echoError1('请输入留言内容');
|
|
}
|
|
$i=DB::table('liu_yan')->insert([
|
|
'content'=>$info['content'],
|
|
'openid'=>$info['openid'],
|
|
|
|
]);
|
|
if($i){
|
|
return \Yz::Return(true,'留言成功');
|
|
}
|
|
return \Yz::echoError1('留言失败');
|
|
}
|
|
public function Mp_InsertInfo(){
|
|
return \Yz::Return(true,'填写成功');
|
|
}
|
|
|
|
public function GetList(){
|
|
$page = request('page', 1);
|
|
$pageSize = request('pageSize', 10);
|
|
$start = ($page - 1) * $pageSize;
|
|
|
|
$list = DB::table('liu_yan')
|
|
->select('openid', 'content', 'created_at')
|
|
->orderBy('created_at', 'desc')
|
|
->offset($start)
|
|
->limit($pageSize)
|
|
->get();
|
|
|
|
$count = DB::table('liu_yan')->count();
|
|
|
|
return \Yz::Return(true, '查询成功', [
|
|
'list' => $list,
|
|
'count' => $count,
|
|
'page' => $page,
|
|
'pageSize' => $pageSize
|
|
]);
|
|
}
|
|
}
|