123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
-
-
- namespace app\admin\controller\sign_daily;
-
-
- use app\admin\logic\sign_daily\SignDailyLogic;
- use app\admin\validate\sign_daily\SignDailyValidate;
- use app\common\basics\AdminBase;
- use app\common\server\JsonServer;
-
-
- class SignDaily extends AdminBase
- {
-
-
-
- public function lists()
- {
- if ($this->request->isAjax()) {
- $lists = SignDailyLogic::lists();
- return JsonServer::success('获取成功', $lists);
- }
- return view('sign_daily/lists', [
- 'config' => SignDailyLogic::getSignRule()
- ]);
- }
-
-
-
-
- public function record()
- {
- if ($this->request->isAjax()) {
- $get = $this->request->get();
- return JsonServer::success('获取成功', SignDailyLogic::record($get));
- }
- }
-
-
-
-
- public function signRule()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] == 'on' ? 1 : 0;
- $post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] == 'on' ? 1 : 0;
- (new SignDailyValidate())->goCheck('sign', $post);
- $result = SignDailyLogic::setSignRule($post);
- if (true === $result) {
- return JsonServer::success('设置成功');
- }
- return JsonServer::error(SignDailyLogic::getError() ?: '操作失败');
- }
- }
-
-
-
-
- public function add()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] == 'on' ? 1 : 0;
- $post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] == 'on' ? 1 : 0;
- (new SignDailyValidate())->goCheck('add', $post);
- SignDailyLogic::add($post);
- return JsonServer::success('添加成功');
- }
- return view('sign_daily/add');
- }
-
-
-
-
- public function edit($id)
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] == 'on' ? 1 : 0;
- $post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] == 'on' ? 1 : 0;
- (new SignDailyValidate())->goCheck('edit', $post);
- SignDailyLogic::edit($post);
- return JsonServer::success('修改成功');
- }
- return view('sign_daily/edit', ['info' => SignDailyLogic::getSignDaily($id)]);
- }
-
-
-
-
- public function del()
- {
- if ($this->request->isAjax()) {
- $id = $this->request->post('id');
- SignDailyLogic::del($id);
- return JsonServer::success('删除成功');
- }
- return JsonServer::error('请求异常');
- }
-
-
- }
|