ChargeController.php
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/8/30
* Time: 14:29
*/
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use think\Db;
class ChargeController extends AdminBaseController {
/**
* 普通充值
*/
public function commonCharge() {
return $this->fetch('', [
'list' => Db::name('charge')->where(['is_bonus'=>0,'is_on_sale'=>1])->select()
]);
}
/**
* 活动专享
*/
public function bonusCharge() {
return $this->fetch('', [
'list' => Db::name('charge')->where(['is_bonus'=>1,'is_on_sale'=>1])->select()
]);
}
public function commonChargeAdd() {
$request=request();
if($request->isPost()) {
if(Db::name('charge')->insert($request->param())) {
$this->success('添加成功');
}else {
$this->error('添加失败');
}
}else {
return $this->fetch();
}
}
public function commonChargeEdit() {
$request=request();
if($request->isPost()) {
if(Db::name('charge')->update($request->param())) {
$this->success('编辑成功');
}else {
$this->error('您为做出任何修改');
}
}else {
return $this->fetch('', [
'info' => Db::name('charge')->where(['id'=>$request->param('id')])->find()
]);
}
}
public function chargeDel() {
$id=request()->param('id');
if(Db::name('charge')->delete($id)) {
$this->success('删除成功');
}else {
$this->error('删除失败');
}
}
public function bonusChargeAdd() {
$request=request();
if($request->isPost()) {
if(Db::name('charge')->insert($request->param())) {
$this->success('添加成功');
}else {
$this->error('添加失败');
}
}else {
return $this->fetch();
}
}
public function bonusChargeEdit() {
$request=request();
if($request->isPost()) {
if(Db::name('charge')->update($request->param())) {
$this->success('编辑成功');
}else {
$this->error('您为做出任何修改');
}
}else {
return $this->fetch('', [
'info' => Db::name('charge')->where(['id'=>$request->param('id')])->find()
]);
}
}
}