tp5:service:create public $db; public function __construct() { parent::__construct(); $this-db = new WarehouseOrderPerson(); } public function create($data) { return $this-db-add($data) 0 ? ret_ok('创建成功') : ret_no('创建失败'); }
public $db; public function __construct() { parent::__construct(); $this->db = new WarehouseOrderPerson(); } public function create($data) { return $this->db->add($data) > 0 ? ret_ok('创建成功') : ret_no('创建失败'); } public function delete() { $this->request->post(['is_delete' => 1]); return $this->db->modifyOne_byId(input('post.')) > 0 ? ret_ok('删除成功') : ret_no('删除失败'); } public function modify() { return $this->db->modifyOne_byId(input('post')) > 0 ? ret_ok('修改成功') : ret_no('修改失败'); }