1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\models\mining;
- use app\models\user\User;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- class UserMining extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'user_mining';
- use ModelTrait;
- public static function getList($where)
- {
- $model = new self();
- if (isset($where['uid']) && $where['uid']) {
- if (is_array($where['uid'])) {
- $umid = UserMiningMachine::where('uid', 'in', $where['uid'])->column('id');
- } else {
- $umid = UserMiningMachine::where('uid', $where['uid'])->column('id');
- }
- $model = $model->where('umid', 'in', $umid);
- }
- if (isset($where['type']) && $where['type']) $model = $model->where('get_money_type', $where['type']);
- $model = $model->order('id desc');
- $data = ($data = $model->page((int)$where['page'], (int)$where['limit'])->select()->each(function ($item) {
- $item['user_machine'] = UserMiningMachine::get($item['umid']);
- $item['machine'] = MiningMachine::get($item['user_machine']['mid']);
- })) && count($data) ? $data->toArray() : [];
- $count = $model->count();
- return compact('count', 'data');
- }
- }
|