|
12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- namespace app\admin\model;
-
- use think\Model;
-
- class Change extends Model
- {
-
- public function getAll($param, $page, $pageSize)
- {
- unset($param['page']);
- unset($param['pageSize']);
- foreach ($param as $k => $v) {
- if ($param[$k] === '' || $param[$k] === null) {
- unset($param[$k]);
- }
- }
- $result = $this->where($param)->with(['getUserOneData', 'getCustomerOneData'])->limit($page, $pageSize)->select();
- $total = $this->where($param)->count();
- return ['rows' => $result, 'total' => $total];
- }
-
- public function getUserOneData()
- {
- return $this->hasOne(\app\admin\model\User::class, 'id', 'user_id')->bind(['username' => 'username']);
- }
-
- public function getCustomerOneData()
- {
- return $this->hasOne(\app\admin\model\Customer::class, 'id', 'customer_id')->bind(['customer_name' => 'name']);
- }
-
- }
|