| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Product extends Model
- {
- public function getSonList($condition)
- {
- $result = $this
- ->where($condition)
- ->paginate(10);
- return $result;
- }
- public function getFartherList()
- {
- $result = $this
- ->where(['product_pid' => 0])
- ->select();
- return $result;
- }
- public function findProduct($condition)
- {
- $result = $this
- ->where($condition)
- ->find();
- return $result;
- }
- public function updateProduct($id, $data)
- {
- $result = $this
- ->where(['product_id' => $id])
- ->update($data);
- return $result;
- }
- public function addProduct($data)
- {
- $result = $this
- ->insert($data);
- return $result;
- }
- public function deleteProduct($condition)
- {
- $result = $this
- ->where($condition)
- ->delete();
- return $result;
- }
- }
|