generated from php/site_api
61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\WechatHistory;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\WechatHistory\WechatHistory as ModelWechatHistory;
|
|
use app\Request;
|
|
use think\Validate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Filesystem;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\common\arw\adjfut\src\UploadFile;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Db;
|
|
use think\facade\Env;
|
|
|
|
|
|
class WechatHistory extends BaseController
|
|
{
|
|
/**
|
|
* 获取列表
|
|
*/
|
|
public function getWechatHistoryList(Request $request, $isExport = false): array
|
|
{
|
|
$con = Tool::getOptionalQuery(['wechat_history_nickname', 'LIKE']);
|
|
|
|
$query = ModelWechatHistory::where($con)
|
|
->field([
|
|
'wechat_history_id',
|
|
'wechat_history_ip',
|
|
'wechat_history_openid',
|
|
'wechat_history_useragent',
|
|
'wechat_history_nickname',
|
|
'wechat_history_avatar',
|
|
'wechat_history_refer',
|
|
'create_time',
|
|
'delete_time',
|
|
])
|
|
->order('wechat_history_id', 'desc');
|
|
|
|
return $isExport ? $query->select()->toArray() : msg("获取列表成功!", $query);
|
|
}
|
|
|
|
|
|
/**
|
|
* 删除
|
|
*/
|
|
public function deleteWechatHistory(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$this->validate($params, [
|
|
'wechat_history_id' => 'require',
|
|
]);
|
|
$wechat_history = ModelWechatHistory::where([
|
|
'wechat_history_id' => explode(',', $params['wechat_history_id'])
|
|
])->select();
|
|
$wechat_history->delete();
|
|
return msg('删除成功!');
|
|
}
|
|
}
|