王总上门按摩后台代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
shangmenanmo/app/agent/controller/MessageConfigController.php

48 lines
1.3 KiB

<?php
namespace app\agent\controller;
use think\App;
use app\AdminRest;
use app\AgentRest;
use think\facade\Db;
use think\Validate;
class MessageConfigController extends AgentRest
{
public function __construct ( App $app ){
parent::__construct( $app );
if ($this->_user['role_name'] != 'admin') {
echo json_encode(['code' => 401, 'error' => lang('Permission denied')]);
exit;
}
}
public function delMessageByDay()
{
if (!isset($this->_input['modular_id']) || !isset($this->_input['days'])) {
return $this->success('success');
}
$validate = new Validate();
$validate->rule([
'days|清除时间' => 'integer',
]);
if (!$validate->check($this->_input)) {
return $this->error($validate->getError());
}
$modular_id = $this->_input['modular_id'];
$days = $this->_input['days'];
if ($days > 0) {
$beginTime = mktime(0, 0, 0, date('m'), date('d') - $days, date('Y'));
} else {
$beginTime = 99999999999;
}
$rst = Db::name('longbing_card_message')->where([['uniacid', '=', $modular_id], ['create_time', '<', $beginTime]])->delete(true);
return $this->success($rst);
}
}