| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Order extends Model
- {
- protected $pk = 'order_id';
- public function user()
- {
- return $this->belongsTo('User', 'user_id', 'user_id');
- }
- public function product()
- {
- return $this->belongsTo('Product', 'product_id', 'product_id');
- }
- public function getOrdList($condition, $fileds = '*', $limit = 10)
- {
- if (empty($condition)) {
- $result = $this
- ->field($fileds)
- ->order('order_id', 'desc')
- ->paginate($limit);
- } else {
- $result = $this
- ->where($condition)
- ->order('order_id', 'desc')
- ->paginate($limit);
- }
- return $result;
- }
- }
|