123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- /**
- * Created by Administrator.
- * User: 向往那片天空
- * Date: 2022\5\21 0021
- * Time: 11:33
- * 格言: 抓住中心,宁精勿杂,宁专勿多
- * QQ/微信: 250023777
- * 描述: 无
- */
- namespace app\admin\logic\enterprise;
- use app\admin\controller\AuthController;
- use app\admin\model\enterprise\EnterPriseType as Type;
- use app\admin\model\system\SystemAdmin;
- use app\admin\logic\BaseLogic;
- use crmeb\exceptions\AuthException;
- use crmeb\services\JsonService;
- use crmeb\traits\ModelTrait;
- use think\facade\Db;
- use think\facade\Route as Url;
- class JobLogic extends \app\admin\logic\BaseLogic
- {
- use ModelTrait;
- protected $pk = 'id';
- protected $name = 'job';
- public function toggleIsShow($id)
- {
- $find = self::find($id);
- if (empty($find)) {
- return JsonService::fail('找不到记录');
- }
- $res = self::update([
- 'id' => $id,
- 'is_show' => $find['is_show'] == 1 ? 0 : 1,
- 'update_time' => time(),
- 'update_admin_id' => $this->adminInfo['id']
- ]);
- if (empty($res)) {
- return JsonService::fail('操作失败');
- }
- return JsonService::successful('操作成功');
- }
- public function getPageList($where)
- {
- $query = [];
- $query['is_delete'] = '0';
- if ($where['is_show'] != -1) {
- $query['is_show'] = $where['is_show'];
- }
- $list = self::where($query)->page($where['page'], $where['limit'])->order('rank desc,add_time desc')->select()->toArray();
- $count = count($list);
- // 通过行业Id获取行业名
- foreach ($list as &$v) {
- $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
- }
- return JsonService::successlayui(['count' => $count, 'data' => $list]);
- }
- public function add($data)
- {
- $data['add_admin_id'] = $this->adminInfo['id'];
- $data['add_time'] = time();
- $res = self::insert($data);
- if (empty($res)) {
- return JsonService::fail('添加失败');
- }
- return JsonService::successful('添加成功');
- }
- public function edit($data)
- {
- $data['update_admin_id'] = $this->adminInfo['id'];
- $data['edit_time'] = time();
- $res = self::update($data);
- if (empty($res)) {
- return JsonService::fail('修改失败');
- }
- return JsonService::successful('修改成功');
- }
- public function getList($where)
- {
- return self::where($where)->order('rank desc,add_time desc')->select()->toArray();
- }
- }
|