1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * Created by Administrator.
- * User: 向往那片天空
- * Date: 2022\5\21 0021
- * Time: 12:57
- * 格言: 抓住中心,宁精勿杂,宁专勿多
- * QQ/微信: 250023777
- * 描述: 无
- */
- namespace app\admin\logic;
- use app\admin\model\system\SystemAdmin;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- use crmeb\services\JsonService;
- use think\facade\Route as Url;
- class BaseLogic extends BaseModel
- {
- protected $adminInfo;
- public function __construct(array $data = [])
- {
- parent::__construct($data);
- if (!SystemAdmin::hasActiveAdmin()) return $this->redirect(Url::buildUrl('login/index')->suffix(false)->build());
- try {
- $adminInfo = SystemAdmin::activeAdminInfoOrFail();
- } catch (\Exception $e) {
- return $this->failed(SystemAdmin::getErrorInfo($e->getMessage()), Url::buildUrl('login/index')->suffix(false)->build());
- }
- $this->adminInfo = $adminInfo;
- }
- public function delById($id)
- {
- $res = self::update([
- 'id' => $id,
- 'is_delete' => '1',
- ]);
- if (empty($res)) {
- return JsonService::fail('删除失败');
- }
- return JsonService::successful('删除成功');
- }
- }
|