mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
代码注释
This commit is contained in:
parent
bf7c83b270
commit
478229e5a1
@ -84,7 +84,6 @@ class Login extends Controller
|
|||||||
'login_num' => $this->app->db->raw('login_num+1'),
|
'login_num' => $this->app->db->raw('login_num+1'),
|
||||||
]);
|
]);
|
||||||
sysoplog('系统用户登录', '登录系统后台成功');
|
sysoplog('系统用户登录', '登录系统后台成功');
|
||||||
$GLOBALS['oplogs'] = [];
|
|
||||||
$this->success('登录成功', sysuri('admin/index/index'));
|
$this->success('登录成功', sysuri('admin/index/index'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,7 @@ class Plugs extends Controller
|
|||||||
$this->app->db->name('SystemConfig')->insertAll($alldata);
|
$this->app->db->name('SystemConfig')->insertAll($alldata);
|
||||||
});
|
});
|
||||||
$this->app->cache->delete('SystemConfig');
|
$this->app->cache->delete('SystemConfig');
|
||||||
$GLOBALS['oplogs'] = [];
|
sysoplog('系统运维管理', '清理系统参数配置成功');
|
||||||
sysoplog('系统运维管理', '清理系统配置成功');
|
|
||||||
$this->success('清理系统配置成功!');
|
$this->success('清理系统配置成功!');
|
||||||
} catch (HttpResponseException $exception) {
|
} catch (HttpResponseException $exception) {
|
||||||
throw $exception;
|
throw $exception;
|
||||||
@ -134,7 +133,7 @@ class Plugs extends Controller
|
|||||||
if (AdminService::instance()->isSuper()) try {
|
if (AdminService::instance()->isSuper()) try {
|
||||||
AdminService::instance()->clearCache();
|
AdminService::instance()->clearCache();
|
||||||
SystemService::instance()->pushRuntime();
|
SystemService::instance()->pushRuntime();
|
||||||
sysoplog('系统运维管理', '网站缓存加速成功');
|
sysoplog('系统运维管理', '刷新并创建网站路由缓存');
|
||||||
$this->success('网站缓存加速成功!');
|
$this->success('网站缓存加速成功!');
|
||||||
} catch (HttpResponseException $exception) {
|
} catch (HttpResponseException $exception) {
|
||||||
throw $exception;
|
throw $exception;
|
||||||
@ -154,8 +153,8 @@ class Plugs extends Controller
|
|||||||
if (AdminService::instance()->isSuper()) try {
|
if (AdminService::instance()->isSuper()) try {
|
||||||
AdminService::instance()->clearCache();
|
AdminService::instance()->clearCache();
|
||||||
SystemService::instance()->clearRuntime();
|
SystemService::instance()->clearRuntime();
|
||||||
sysoplog('系统运维管理', '清理网站缓存日志');
|
sysoplog('系统运维管理', '清理网站日志及缓存数据');
|
||||||
$this->success('清理网站缓存成功!');
|
$this->success('清理网站日志及缓存数据成功!');
|
||||||
} catch (HttpResponseException $exception) {
|
} catch (HttpResponseException $exception) {
|
||||||
throw $exception;
|
throw $exception;
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
@ -21,6 +21,9 @@ use think\admin\storage\AliossStorage;
|
|||||||
use think\admin\storage\LocalStorage;
|
use think\admin\storage\LocalStorage;
|
||||||
use think\admin\storage\QiniuStorage;
|
use think\admin\storage\QiniuStorage;
|
||||||
use think\admin\storage\TxcosStorage;
|
use think\admin\storage\TxcosStorage;
|
||||||
|
use think\file\UploadedFile;
|
||||||
|
use think\Response;
|
||||||
|
use think\response\Json;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传接口
|
* 文件上传接口
|
||||||
@ -32,11 +35,12 @@ class Upload extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传JS支持
|
* 文件上传JS支持
|
||||||
|
* @return Response
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(): Response
|
||||||
{
|
{
|
||||||
$data = ['exts' => []];
|
$data = ['exts' => []];
|
||||||
foreach (explode(',', sysconf('storage.allow_exts')) as $ext) {
|
foreach (explode(',', sysconf('storage.allow_exts')) as $ext) {
|
||||||
@ -93,13 +97,13 @@ class Upload extends Controller
|
|||||||
/**
|
/**
|
||||||
* 文件上传入口
|
* 文件上传入口
|
||||||
* @login true
|
* @login true
|
||||||
* @return \think\response\Json
|
* @return Json
|
||||||
* @throws \think\admin\Exception
|
* @throws \think\admin\Exception
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function file()
|
public function file(): Json
|
||||||
{
|
{
|
||||||
if (!($file = $this->getFile()) || empty($file)) {
|
if (!($file = $this->getFile()) || empty($file)) {
|
||||||
return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]);
|
return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]);
|
||||||
@ -134,7 +138,7 @@ class Upload extends Controller
|
|||||||
* 获取文件上传类型
|
* 获取文件上传类型
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function getSafe()
|
private function getSafe(): bool
|
||||||
{
|
{
|
||||||
return boolval(input('safe', '0'));
|
return boolval(input('safe', '0'));
|
||||||
}
|
}
|
||||||
@ -146,7 +150,7 @@ class Upload extends Controller
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
private function getType()
|
private function getType(): string
|
||||||
{
|
{
|
||||||
$this->uptype = strtolower(input('uptype', ''));
|
$this->uptype = strtolower(input('uptype', ''));
|
||||||
if (!in_array($this->uptype, ['local', 'qiniu', 'alioss', 'txcos'])) {
|
if (!in_array($this->uptype, ['local', 'qiniu', 'alioss', 'txcos'])) {
|
||||||
@ -157,9 +161,9 @@ class Upload extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取本地文件对象
|
* 获取本地文件对象
|
||||||
* @return \think\file\UploadedFile
|
* @return UploadedFile
|
||||||
*/
|
*/
|
||||||
private function getFile()
|
private function getFile(): UploadedFile
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->request->file('file');
|
return $this->request->file('file');
|
||||||
|
@ -22,7 +22,7 @@ class Notify extends Controller
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function wxpay(string $scene = 'order')
|
public function wxpay(string $scene = 'order'): string
|
||||||
{
|
{
|
||||||
$notify = ($payment = WechatService::WePayOrder())->getNotify();
|
$notify = ($payment = WechatService::WePayOrder())->getNotify();
|
||||||
if ($notify['result_code'] == 'SUCCESS' && $notify['return_code'] == 'SUCCESS') {
|
if ($notify['result_code'] == 'SUCCESS' && $notify['return_code'] == 'SUCCESS') {
|
||||||
@ -47,7 +47,7 @@ class Notify extends Controller
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
private function setOrder(string $code, string $amount, string $paycode, string $paytype = 'wxpay')
|
private function setOrder(string $code, string $amount, string $paycode, string $paytype = 'wxpay'): bool
|
||||||
{
|
{
|
||||||
// 检查订单支付状态
|
// 检查订单支付状态
|
||||||
$map = ['order_no' => $code, 'payment_status' => 0, 'status' => 2];
|
$map = ['order_no' => $code, 'payment_status' => 0, 'status' => 2];
|
||||||
|
@ -5,6 +5,7 @@ namespace app\data\controller\api;
|
|||||||
use app\data\service\UserService;
|
use app\data\service\UserService;
|
||||||
use think\admin\Controller;
|
use think\admin\Controller;
|
||||||
use think\exception\HttpResponseException;
|
use think\exception\HttpResponseException;
|
||||||
|
use think\Response;
|
||||||
use WeMini\Crypt;
|
use WeMini\Crypt;
|
||||||
use WeMini\Live;
|
use WeMini\Live;
|
||||||
use WeMini\Qrcode;
|
use WeMini\Qrcode;
|
||||||
@ -41,6 +42,7 @@ class Wxapp extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权Code换取会话信息
|
* 授权Code换取会话信息
|
||||||
|
* @throws \think\Exception
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
@ -94,7 +96,7 @@ class Wxapp extends Controller
|
|||||||
* @param string $code 换取授权CODE
|
* @param string $code 换取授权CODE
|
||||||
* @return array [openid, sessionkey]
|
* @return array [openid, sessionkey]
|
||||||
*/
|
*/
|
||||||
private function _getSessionKey(string $code)
|
private function _getSessionKey(string $code): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$cache = $this->app->cache->get($code, []);
|
$cache = $this->app->cache->get($code, []);
|
||||||
@ -120,7 +122,7 @@ class Wxapp extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取小程序码
|
* 获取小程序码
|
||||||
*/
|
*/
|
||||||
public function qrcode()
|
public function qrcode(): Response
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $this->_vali([
|
$data = $this->_vali([
|
||||||
@ -169,7 +171,7 @@ class Wxapp extends Controller
|
|||||||
'start.default' => 0,
|
'start.default' => 0,
|
||||||
'limit.default' => 10,
|
'limit.default' => 10,
|
||||||
'action.default' => 'get_replay',
|
'action.default' => 'get_replay',
|
||||||
'room_id.require' => '直播间ID不能为空',
|
'room_id.require' => '直播间不能为空',
|
||||||
]);
|
]);
|
||||||
$result = Live::instance($this->config)->getLiveInfo($data);
|
$result = Live::instance($this->config)->getLiveInfo($data);
|
||||||
$this->success('获取回放视频成功!', $result);
|
$this->success('获取回放视频成功!', $result);
|
||||||
|
@ -124,12 +124,12 @@ class Address extends Auth
|
|||||||
/**
|
/**
|
||||||
* 获取指定的收货地址
|
* 获取指定的收货地址
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @return array
|
* @return null|array
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
private function _getAddress(string $code)
|
private function _getAddress(string $code): ?array
|
||||||
{
|
{
|
||||||
$map = ['code' => $code, 'uid' => $this->uuid, 'deleted' => 0];
|
$map = ['code' => $code, 'uid' => $this->uuid, 'deleted' => 0];
|
||||||
return $this->app->db->name($this->table)->withoutField('deleted')->where($map)->find();
|
return $this->app->db->name($this->table)->withoutField('deleted')->where($map)->find();
|
||||||
|
@ -25,15 +25,16 @@ class MessageService extends Service
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务初始化
|
* 短信服务初始化
|
||||||
* @return MessageService|void
|
* @return MessageService
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
protected function initialize()
|
protected function initialize(): MessageService
|
||||||
{
|
{
|
||||||
$this->username = sysconf('zt.username');
|
$this->username = sysconf('zt.username');
|
||||||
$this->password = sysconf('zt.password');
|
$this->password = sysconf('zt.password');
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +68,7 @@ class MessageService extends Service
|
|||||||
* @param string $tplcode
|
* @param string $tplcode
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkVerifyCode(string $code, string $phone, string $tplcode = 'zt.tplcode_register')
|
public function checkVerifyCode(string $code, string $phone, string $tplcode = 'zt.tplcode_register'): bool
|
||||||
{
|
{
|
||||||
$cache = $this->app->cache->get($ckey = md5("code-{$tplcode}-{$phone}"), []);
|
$cache = $this->app->cache->get($ckey = md5("code-{$tplcode}-{$phone}"), []);
|
||||||
return is_array($cache) && isset($cache['code']) && $cache['code'] == $code;
|
return is_array($cache) && isset($cache['code']) && $cache['code'] == $code;
|
||||||
@ -83,7 +84,7 @@ class MessageService extends Service
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function sendVerifyCode(string $phone, int $wait = 120, string $tplcode = 'zt.tplcode_register')
|
public function sendVerifyCode(string $phone, int $wait = 120, string $tplcode = 'zt.tplcode_register'): array
|
||||||
{
|
{
|
||||||
$content = sysconf($tplcode) ?: '您的短信验证码为{code},请在十分钟内完成操作!';
|
$content = sysconf($tplcode) ?: '您的短信验证码为{code},请在十分钟内完成操作!';
|
||||||
$cache = $this->app->cache->get($ckey = md5("code-{$tplcode}-{$phone}"), []);
|
$cache = $this->app->cache->get($ckey = md5("code-{$tplcode}-{$phone}"), []);
|
||||||
|
@ -89,7 +89,7 @@ class TruckService extends Service
|
|||||||
* @return array
|
* @return array
|
||||||
* @throws \think\admin\Exception
|
* @throws \think\admin\Exception
|
||||||
*/
|
*/
|
||||||
public function company()
|
public function company(): array
|
||||||
{
|
{
|
||||||
return $this->_getInterface()->doRequest('api.auth.express/getCompany');
|
return $this->_getInterface()->doRequest('api.auth.express/getCompany');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user