1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\models\lala;
- use app\models\mining\UserMiningMachine;
- use app\models\system\SystemMoney;
- use app\models\user\User;
- use app\models\user\UserMoney;
- use Exception;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- /**
- * TODO 文章Model
- * Class Article
- * @package app\models\article
- */
- class AutoPink extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'auto_pink';
- use ModelTrait;
- /**
- * @return AutoPink
- */
- public static function validWhere($admin = false)
- {
- return $admin ? self::where('is_del', 0) : self::where('is_show', 1)->where('is_del', 0);
- }
- /**
- * @param $where
- * @param $page
- * @param $limit
- * @param bool $admin
- * @return array
- */
- public static function getList($where, $page, $limit, bool $admin = false): array
- {
- $model = self::validWhere($admin);
- if (isset($where['is_show']) && $where['is_show'] != '') $model = $model->where('is_show', $where['is_show']);
- if (isset($where['title']) && $where['title'] != '') $model = $model->where('name', 'like', "%" . $where['title'] . "%");
- if (isset($where['lala_id']) && $where['lala_id'] != '') $model = $model->where("FIND_IN_SET('" . $where['lala_id'] . "',lala_id)");
- $data = $model->page((int)$page, (int)$limit)->select()->each(function ($item){
- $item['money_type'] = get_money_name($item['money_type']);
- });
- $count = $model->count();
- return compact('data', 'count');
- }
- }
|