where(['user_id' => $userId]) ->count(); return $result; } public function getRenewProductCount($userId) { $allData = $this ->field(['userProduct_maturityTime']) ->where(['user_id' => $userId]) ->select(); $count = 0; foreach ($allData as $key => $value) { $remindDate = date("Y-m-d",strtotime(15 . " day")); if ($value->userProduct_maturityTime <= $remindDate) { $count++; } } return $count; } public function getUserProduct($condition) { $result = $this ->alias('a') ->join('product b', 'a.product_id = b.product_id') ->where($condition) ->order('userProduct_buyTime desc') ->paginate(10); return $result; } public function findUserProduct($condition) { $result = $this ->where($condition) ->find(); return $result; } public function updateUserProduct($condition, $data) { $result = $this ->where($condition) ->update($data); return $result; } }