1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace app\admin\logic;
- use app\model\AccountBatchLogModel;
- use app\model\ExpressModel;
- use app\model\CommonModel;
- use app\model\VideoModel;
- use think\Exception;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Db;
- use think\response\Json;
- class ExpressLogic extends BaseLogic
- {
- //列表
- public static function list(array $data = []): Json
- {
- $where = [];
- if ($data['express_code'] != '') $where[] = ['express_code', 'like', '%' . $data['express_code'] . '%'];
- if ($data['express_name'] != '') $where[] = ['express_name', 'like', '%' . $data['express_name'] . '%'];
- if ($data['mobile'] != '') $where[] = ['mobile', 'like', '%' . $data['mobile'] . '%'];
- if ($data['status'] != '') $where[] = ['status', '=', $data['status']];
- $count = ExpressModel::where($where)->count('id');
- $list = ExpressModel::where($where)
- ->field(true)
- ->order('id', 'desc')
- ->page($data['page'], $data['size'])
- ->select()
- ->toArray();
- return json_show(CommonModel::$success, '获取快递公司列表成功', ['count' => $count, 'list' => $list]);
- }
- //删除
- public static function status(array $data = []): Json
- {
- $rs = ExpressModel::where(['id' => $data['id']])
- ->where('status', '<>', $data['status'])
- ->save(['status' => $data['status']]);
- return $rs ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$error_param, '操作失败,该快递公司不存在或重复操作');
- }
- }
|