123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace app\admin\controller\user;
- use app\admin\controller\AuthController;
- use crmeb\services\{FormBuilder as Form, UtilService as Util, JsonService as Json};
- use crmeb\services\JsonService;
- use think\facade\Route as Url;
- use app\admin\model\user\UserNotice as UserNoticeModel;
- use app\admin\model\user\UserNoticeSee as UserNoticeSeeModel;
- use app\admin\model\wechat\WechatUser as UserModel;
- Use app\admin\model\user\UserApply as model;
- /**
- * 用户通知
- * Class UserNotice
- * @package app\admin\controller\user
- */
- class UserApply extends AuthController
- {
- /**
- * 显示资源列表
- *
- * @return \think\Response
- */
- public function index($type)
- {
- $this->assign('type', $type);
- return $this->fetch();
- }
- public function indexs($type)
- {
- $this->assign('type', $type);
- return $this->fetch();
- }
- public function list()
- {
- $where = Util::getMore([
- ['status', ''],
- ['page', 1],
- ['limit', 20],
- ['name', ''],
- ['type', ''],
- ['status', ''],
- ]);
- return Json::successlayui(model::list($where));
- }
- public function tg($id,$type)
- {
- $data = model::find($id);
- if (!$data) return Json::fail('数据不存在');
- $data['status'] = 1;
- //老师
- if ($type == 1){
- $res = \app\admin\model\user\User::where('uid', $data['uid'])->update(['alliance' => 1]) && $data->save();
- }elseif($type == 2) {
- // 点击
- $res = \app\admin\model\user\User::where('uid', $data['uid'])->update(['shopkeeper' => 1]) && $data->save();
- }
- if ($res) return Json::successful('成功');
- return Json::fail('失败');
- }
- public function btg($id,$type)
- {
- $data = model::find($id);
- if (!$data) return Json::fail('数据不存在');
- $data['status'] = -1;
- $res = $data->save();
- if ($res) return Json::successful('成功');
- return Json::fail('失败');
- }
- /**
- * 删除指定资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function delete($id)
- {
- if (!model::del($id))
- return Json::fail(UserNoticeModel::getErrorInfo('删除失败,请稍候再试!'));
- else
- return Json::successful('删除成功!');
- }
- }
|