12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class ChainGoods extends BaseModel
- {
- public $page_info;
-
- public function addChainGoods($data)
- {
- return Db::name('chain_goods')->insertGetId($data);
- }
-
- public function getChainGoodsList($condition, $pagesize = 0, $order = 'chain_goods_id desc')
- {
- if($pagesize){
- $res = Db::name('chain_goods')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false);
- $this->page_info=$res;
- return $res->items();
- }else{
- return Db::name('chain_goods')->where($condition)->order($order)->select()->toArray();
- }
- }
-
- public function getChainGoodsInfo($condition, $field = '*')
- {
- return Db::name('chain_goods')->where($condition)->field($field)->find();
- }
-
- public function editChainGoods($update, $condition)
- {
- return Db::name('chain_goods')->where($condition)->update($update);
- }
- }
|