123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class Spec extends BaseModel {
- public $page_info;
-
- public function getSpecList($condition, $pagesize = '', $order = 'sp_id desc') {
- if($pagesize){
- $result= Db::name('spec')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
- $this->page_info=$result;
- return $result->items();
- }else{
- return Db::name('spec')->where($condition)->order($order)->select()->toArray();
- }
- }
-
- public function getSpecInfo($sp_id, $field = '*') {
- return Db::name('spec')->where('sp_id',$sp_id)->field($field)->find();
- }
-
- public function getSpecvalueList($where, $field = '*', $order = 'spvalue_sort asc,spvalue_id asc') {
- $result = Db::name('specvalue')->field($field)->where($where)->order($order)->select()->toArray();
- return empty($result) ? array() : $result;
- }
-
- public function editSpecvalue($update, $where) {
- $result = Db::name('specvalue')->where($where)->update($update);
- return $result;
- }
-
- public function addSpecvalue($data) {
- $result = Db::name('specvalue')->insertGetId($data);
- return $result;
- }
-
- public function addSpecvalueALL($data) {
- $result = Db::name('specvalue')->insertAll($data);
- return $result;
- }
-
- public function delSpecvalue($where) {
- $result = Db::name('specvalue')->where($where)->delete();
- return $result;
- }
-
- public function editSpec($update, $condition) {
- if (empty($update)) {
- return false;
- }
- return Db::name('spec')->where($condition)->update($update);
- }
-
- public function addSpec($data) {
-
- $result = Db::name('spec')->insertGetId($data);
- return $result;
- }
-
-
- public function delSpec($condition) {
- return Db::name('spec')->where($condition)->delete();
- }
- }
- ?>
|