where('is_delete',0); } public function record() { return self::hasMany(ZueCoinRecordModel::class,'zue_coin_id','id')->where('is_delete',0)->order('create_time', 'desc'); } /** * @param array $params * @return \think\Paginator * @throws \think\db\exception\DbException */ public function findByPaginate(array $params) { $where = []; if ($params['customer']) { $where = [['id|name_zh|name_en', 'like', '%'.$params['customer'].'%']]; } return $this->where('erp_customer_zue_coin.is_delete',0) ->with('customer') ->hasWhere('customer', $where) ->paginate(['list_rows'=>10, "query" => $params]); } public function findById($id) { return $this->where([ ['id' ,'=', $id], ['is_delete', '=', 0] ])->with(['customer', 'record'])->find(); } public function findByCustomerId($c_id) { return $this->where([ ['is_delete', '=', 0], ['lose_time', '<=', time()], ])->order('lose_time', 'Asc')->find(); } }