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.
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Admin\YeWu;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class WeixinUserController
|
|
{
|
|
public function GetList(){
|
|
$page = request('page', 1);
|
|
$pageSize = request('pageSize', 15);
|
|
$searchInfo = request('searchInfo', []);
|
|
|
|
$list = DB::table('weixin_user')
|
|
->select('openid', 'status', 'created_at')
|
|
->orderBy('created_at', 'desc');
|
|
|
|
// 搜索功能
|
|
if (!empty($searchInfo['info'])) {
|
|
$list->where('openid', 'like', '%' . $searchInfo['info'] . '%');
|
|
}
|
|
|
|
$count = $list->count();
|
|
|
|
$list = $list
|
|
->offset(($page - 1) * $pageSize)
|
|
->limit($pageSize)
|
|
->get();
|
|
|
|
return \Yz::Return(true, '获取成功', ['list' => $list, 'count' => $count]);
|
|
}
|
|
|
|
public function UpdateStatus(){
|
|
$openid = request('openid');
|
|
$status = request('status');
|
|
|
|
if (empty($openid) || $status === null) {
|
|
return \Yz::echoError1('参数不完整');
|
|
}
|
|
|
|
$result = DB::table('weixin_user')
|
|
->where('openid', $openid)
|
|
->update(['status' => $status]);
|
|
|
|
if ($result) {
|
|
return \Yz::Return(true, '修改成功');
|
|
} else {
|
|
return \Yz::echoError1('修改失败');
|
|
}
|
|
}
|
|
} |