54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
||
/*
|
||
* description:
|
||
* author:wh
|
||
* email:
|
||
* createTime:{2024/6/22} {15:02}
|
||
*/
|
||
|
||
namespace app\api\controller;
|
||
|
||
|
||
use app\common\model\TabConf;
|
||
use think\Db;
|
||
use wanghua\general_utility_tools_php\Mmodel;
|
||
use wanghua\general_utility_tools_php\SundryConfig;
|
||
use wanghua\general_utility_tools_php\tool\Tools;
|
||
|
||
class Power extends BaseHttpApi
|
||
{
|
||
|
||
/**
|
||
* desc:当前用户消耗体力
|
||
*
|
||
* api/Power/cutPower
|
||
*
|
||
* 参数:
|
||
* num 消耗体力 默认1
|
||
*
|
||
* author:wh
|
||
*/
|
||
function cutPower()
|
||
{
|
||
return Mmodel::catchJson(function (){
|
||
$openid = api_user_openid();
|
||
$num = input('num',1);
|
||
Db::table(TabConf::$fa_users)
|
||
->where('openid',$openid)
|
||
->setDec('power',$num);
|
||
return Tools::set_ok('ok');
|
||
});
|
||
}
|
||
|
||
/**
|
||
* desc:获取体力上限配置
|
||
* api/Power/getPowerLimitConfig
|
||
* author:wh
|
||
*/
|
||
function getPowerLimitConfig(){
|
||
return Mmodel::catchJson(function (){
|
||
$power_limit_config = SundryConfig::val('power_limit_config');
|
||
return Tools::set_ok('ok',$power_limit_config);
|
||
});
|
||
}
|
||
} |