first commit
This commit is contained in:
84
application/system/controller/Index.php
Normal file
84
application/system/controller/Index.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// |http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace app\system\controller;
|
||||
|
||||
use app\common\model\Member as MemberModel;
|
||||
use app\common\model\VipOrder as VipOrderModel;
|
||||
use app\common\model\Withdrawal as WithdrawalModel;
|
||||
use app\common\service\Member as MemberService;
|
||||
use app\common\service\Menu as MenuService;
|
||||
use think\Request;
|
||||
|
||||
class Index extends _Init
|
||||
{
|
||||
/**
|
||||
* 后台首页
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->user = MemberService::info(UID);
|
||||
$this->menu = MenuService::show(UID);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
* @param Request $request 提交的信息 用户名
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function info(Request $request)
|
||||
{
|
||||
if (IS_POST) {
|
||||
$data = $request->post();
|
||||
if (MemberService::editInfo(UID, $data, 'nickname') === true) {
|
||||
return $this->success();
|
||||
} else {
|
||||
return $this->error(MemberService::getError());
|
||||
}
|
||||
} else {
|
||||
$this->assign('info', MemberService::info(UID));
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 修改密码
|
||||
* @param Request $request 数据集
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function password(Request $request)
|
||||
{
|
||||
if (IS_POST) {
|
||||
$old = $request->post('oldpass');
|
||||
$new = $request->post('newpass');
|
||||
$repass = $request->post('repass');
|
||||
$result = MemberService::changePassword(UID, $old, $new, $repass);
|
||||
return $this->back($result);
|
||||
} else {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
public function main()
|
||||
{
|
||||
$this->reg_num = MemberModel::where(['id' => ['gt', 1]])->count('id');
|
||||
$this->no_mobile_num = MemberModel::where(['id' => ['gt', 1], 'username' => ['eq', '']])->count('id');
|
||||
$this->vip_empty = MemberModel::where('empty_vip', 1)->count();
|
||||
$this->agent_empty = MemberModel::where('empty_agent', 1)->count();
|
||||
$this->pay_vip_num = VipOrderModel::where('type', 'vip')->where('status', 20)->count();
|
||||
$this->pay_agent_num = VipOrderModel::where('type', 'agent')->where('status', 20)->count();
|
||||
$this->pay_vip_money = VipOrderModel::where('type', 'vip')->where('status', 20)->sum('money');
|
||||
$this->pay_agent_money = VipOrderModel::where('type', 'agent')->where('status', 20)->sum('money');
|
||||
$this->withdrawal_sum = WithdrawalModel::where('')->count();
|
||||
$this->withdrawal_audit_sum = WithdrawalModel::where('status', 1)->sum('money');
|
||||
$this->withdrawal_pass_sum = WithdrawalModel::where('status', 2)->sum('money');
|
||||
$this->withdrawal_reject_sum = WithdrawalModel::where('status', 3)->sum('money');
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user