123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace app\store\controller;
- use library\Controller;
- use think\Db;
- class ExpressCompany extends Controller
- {
-
- protected $table = 'StoreExpressCompany';
-
- public function index()
- {
- $this->title = '快递公司管理';
- $query = $this->_query($this->table)->equal('status')->like('express_title,express_code');
- $query->dateBetween('create_at')->order('status desc,sort desc,id desc')->page();
- }
-
- public function add()
- {
- $this->_form($this->table, 'form');
- }
-
- public function edit()
- {
- $this->_form($this->table, 'form');
- }
-
- protected function _form_filter(array $data)
- {
- if ($this->request->isPost()) {
- $where = [['express_code', 'eq', $data['express_code']], ['is_deleted', 'eq', '0']];
- if (!empty($data['id'])) $where[] = ['id ', 'neq', $data['id']];
- if (Db::name($this->table)->where($where)->count() > 0) {
- $this->error('该快递编码已经存在,请使用其它编码!');
- }
- }
- }
-
- public function forbid()
- {
- $this->_save($this->table, ['status' => '0']);
- }
-
- public function resume()
- {
- $this->_save($this->table, ['status' => '1']);
- }
-
- public function remove()
- {
- $this->_delete($this->table);
- }
- }
|